Skip to content

Commit e839f8d

Browse files
authored
ref(replay): Refactor video-replay related css (#82514)
This moves two bits of mobile-replay video-replay CSS closer to where it's needed. first, i moved the `.video-replayer` class down from [videoReplayerWithInteractions.tsx](https://github.com/getsentry/sentry/compare/ryan953/ref-video-replayer-css?expand=1#diff-fddd507998d34043d72bbf4f1aef9e995a8cfea4ce3903d460102fb8faf815c2) and into [videoReplayer.tsx](https://github.com/getsentry/sentry/compare/ryan953/ref-video-replayer-css?expand=1#diff-e351f1b474cf18c091f79bc29e785970cbbb5da2d4a623b5b4e7e9272dfd9670) with the new name `.video-replayer-wrapper`. Then i updated the selectors to use sibling selections. So if the video wrapper exists it'll kick in. We want the `opacity` rule to kick in no matter the use-case, so that stays inside styles.tsx. But the absolute positioning is only for the older `static/app/components/replays/replayPlayer.tsx` and not the newer `static/app/components/replays/player/replayPlayer.tsx`. The newer one, when it gets support for video replays, will use `<Stacked>` instead of `postition:absolute;` like this.
1 parent 819b6fb commit e839f8d

File tree

4 files changed

+12
-16
lines changed

4 files changed

+12
-16
lines changed

static/app/components/replays/player/styles.tsx

+3-14
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ export const baseReplayerCss = css`
1919
border: none;
2020
background: white;
2121
}
22+
.video-replayer-wrapper + .replayer-wrapper > iframe {
23+
opacity: 0;
24+
}
2225
2326
&[data-inspectable='true'] .replayer-wrapper > iframe {
2427
/* Set pointer-events to make it easier to right-click & inspect */
@@ -111,18 +114,4 @@ export const sentryReplayerCss = (theme: Theme) => css`
111114
height: 10px;
112115
}
113116
}
114-
115-
/* Correctly positions the canvas for video replays and shows the purple "mousetails" */
116-
&.video-replayer {
117-
.replayer-wrapper {
118-
position: absolute;
119-
top: 0;
120-
left: 0;
121-
width: 100%;
122-
height: 100%;
123-
}
124-
.replayer-wrapper > iframe {
125-
opacity: 0;
126-
}
127-
}
128117
`;

static/app/components/replays/replayPlayer.tsx

+8
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,14 @@ const SentryPlayerRoot = styled(BasePlayerRoot)`
217217
${baseReplayerCss}
218218
/* Sentry-specific styles for the player */
219219
${p => sentryReplayerCss(p.theme)}
220+
221+
.video-replayer-wrapper + .replayer-wrapper {
222+
position: absolute;
223+
top: 0;
224+
left: 0;
225+
width: 100%;
226+
height: 100%;
227+
}
220228
`;
221229

222230
const Overlay = styled('div')`

static/app/components/replays/videoReplayer.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export class VideoReplayer {
9090
this.config = config;
9191

9292
this.wrapper = document.createElement('div');
93+
this.wrapper.className = 'video-replayer-wrapper';
9394
root.appendChild(this.wrapper);
9495

9596
this._trackList = this._attachments.map(({timestamp}, i) => [timestamp, i]);

static/app/components/replays/videoReplayerWithInteractions.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ export class VideoReplayerWithInteractions {
6565
config: this.config,
6666
});
6767

68-
root.classList.add('video-replayer');
69-
7068
const grouped = Object.groupBy(touchEvents, (t: any) => t.data.pointerId);
7169
Object.values(grouped).forEach(t => {
7270
if (t?.length !== 2) {

0 commit comments

Comments
 (0)