1
- import { ComponentProps , Fragment , useMemo , useRef } from 'react' ;
1
+ import { ComponentProps , Fragment , useMemo , useRef , useState } from 'react' ;
2
2
import styled from '@emotion/styled' ;
3
3
import screenfull from 'screenfull' ;
4
4
5
5
import { Alert } from 'sentry/components/alert' ;
6
- import { Button , LinkButton } from 'sentry/components/button' ;
6
+ import { LinkButton } from 'sentry/components/button' ;
7
7
import ButtonBar from 'sentry/components/buttonBar' ;
8
8
import ErrorBoundary from 'sentry/components/errorBoundary' ;
9
9
import Placeholder from 'sentry/components/placeholder' ;
@@ -13,11 +13,14 @@ import {
13
13
Provider as ReplayContextProvider ,
14
14
useReplayContext ,
15
15
} from 'sentry/components/replays/replayContext' ;
16
+ import ReplayCurrentUrl from 'sentry/components/replays/replayCurrentUrl' ;
17
+ import { ReplayFullscreenButton } from 'sentry/components/replays/replayFullscreenButton' ;
16
18
import ReplayPlayer from 'sentry/components/replays/replayPlayer' ;
17
19
import ReplayPlayPauseButton from 'sentry/components/replays/replayPlayPauseButton' ;
18
20
import ReplayProcessingError from 'sentry/components/replays/replayProcessingError' ;
21
+ import { ReplaySidebarToggleButton } from 'sentry/components/replays/replaySidebarToggleButton' ;
19
22
import TimeAndScrubberGrid from 'sentry/components/replays/timeAndScrubberGrid' ;
20
- import { IconContract , IconDelete , IconExpand } from 'sentry/icons' ;
23
+ import { IconDelete } from 'sentry/icons' ;
21
24
import { t } from 'sentry/locale' ;
22
25
import { space } from 'sentry/styles/space' ;
23
26
import getRouteStringFromRoutes from 'sentry/utils/getRouteStringFromRoutes' ;
@@ -30,6 +33,8 @@ import {useRoutes} from 'sentry/utils/useRoutes';
30
33
import useFullscreen from 'sentry/utils/window/useFullscreen' ;
31
34
import useIsFullscreen from 'sentry/utils/window/useIsFullscreen' ;
32
35
import { normalizeUrl } from 'sentry/utils/withDomainRequired' ;
36
+ import Breadcrumbs from 'sentry/views/replays/detail/breadcrumbs' ;
37
+ import BrowserOSIcons from 'sentry/views/replays/detail/browserOSIcons' ;
33
38
import FluidHeight from 'sentry/views/replays/detail/layout/fluidHeight' ;
34
39
import { ReplayRecord } from 'sentry/views/replays/types' ;
35
40
@@ -77,6 +82,7 @@ function ReplayPreviewPlayer({
77
82
} ) {
78
83
const routes = useRoutes ( ) ;
79
84
const organization = useOrganization ( ) ;
85
+ const [ isSidebarOpen , setIsSidebarOpen ] = useState ( true ) ;
80
86
const isFullscreen = useIsFullscreen ( ) ;
81
87
const { currentTime} = useReplayContext ( ) ;
82
88
@@ -95,30 +101,36 @@ function ReplayPreviewPlayer({
95
101
96
102
return (
97
103
< Fragment >
98
- < StaticPanel >
99
- < ReplayPlayer />
100
- </ StaticPanel >
104
+ < PlayerBreadcrumbContainer >
105
+ < PlayerContextContainer >
106
+ { isFullscreen ? (
107
+ < ContextContainer >
108
+ < ReplayCurrentUrl />
109
+ < BrowserOSIcons />
110
+ < ReplaySidebarToggleButton
111
+ isOpen = { isSidebarOpen }
112
+ setIsOpen = { setIsSidebarOpen }
113
+ />
114
+ </ ContextContainer >
115
+ ) : null }
116
+ < StaticPanel >
117
+ < ReplayPlayer />
118
+ </ StaticPanel >
119
+ </ PlayerContextContainer >
120
+ { isFullscreen && isSidebarOpen ? < Breadcrumbs /> : null }
121
+ </ PlayerBreadcrumbContainer >
101
122
< ErrorBoundary mini >
102
123
< ButtonGrid >
103
124
< ReplayPlayPauseButton />
104
125
< Container >
105
126
< TimeAndScrubberGrid />
106
127
</ Container >
107
128
< ButtonBar gap = { 1 } >
108
- < LinkButton size = "sm" to = { fullReplayUrl } >
129
+ < LinkButton size = "sm" to = { fullReplayUrl } { ... fullReplayButtonProps } >
109
130
{ t ( 'See Full Replay' ) }
110
131
</ LinkButton >
111
132
{ showFullscreenButton ? (
112
- < Button
113
- size = "sm"
114
- title = { isFullscreen ? t ( 'Exit full screen' ) : t ( 'Enter full screen' ) }
115
- aria-label = { isFullscreen ? t ( 'Exit full screen' ) : t ( 'Enter full screen' ) }
116
- icon = {
117
- isFullscreen ? < IconContract size = "sm" /> : < IconExpand size = "sm" />
118
- }
119
- onClick = { toggleFullscreen }
120
- { ...fullReplayButtonProps }
121
- />
133
+ < ReplayFullscreenButton toggleFullscreen = { toggleFullscreen } />
122
134
) : null }
123
135
</ ButtonBar >
124
136
</ ButtonGrid >
@@ -218,11 +230,33 @@ function ReplayClipPreview({
218
230
) ;
219
231
}
220
232
233
+ const PlayerBreadcrumbContainer = styled ( FluidHeight ) `
234
+ position: relative;
235
+ height: 100%;
236
+ ` ;
237
+
221
238
const PlayerContainer = styled ( FluidHeight ) `
222
239
position: relative;
223
240
background: ${ p => p . theme . background } ;
224
241
gap: ${ space ( 1 ) } ;
225
242
max-height: 448px;
243
+
244
+ :fullscreen {
245
+ padding: ${ space ( 1 ) } ;
246
+
247
+ ${ PlayerBreadcrumbContainer } {
248
+ display: grid;
249
+ grid-template-columns: 1fr auto;
250
+ height: 100%;
251
+ gap: ${ space ( 1 ) } ;
252
+ }
253
+ }
254
+ ` ;
255
+
256
+ const PlayerContextContainer = styled ( FluidHeight ) `
257
+ display: flex;
258
+ flex-direction: column;
259
+ gap: ${ space ( 1 ) } ;
226
260
` ;
227
261
228
262
const StaticPanel = styled ( FluidHeight ) `
@@ -249,4 +283,12 @@ const Container = styled('div')`
249
283
justify-content: center;
250
284
` ;
251
285
286
+ const ContextContainer = styled ( 'div' ) `
287
+ display: grid;
288
+ grid-auto-flow: column;
289
+ grid-template-columns: 1fr max-content max-content;
290
+ align-items: center;
291
+ gap: ${ space ( 1 ) } ;
292
+ ` ;
293
+
252
294
export default ReplayClipPreview ;
0 commit comments