Skip to content

Commit dda91e0

Browse files
authored
feat(replay): Add hydration header w/ copy (#62033)
1 parent a83eeca commit dda91e0

File tree

1 file changed

+38
-4
lines changed

1 file changed

+38
-4
lines changed

static/app/components/replays/breadcrumbs/replayComparisonModal.tsx

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import {useEffect, useState} from 'react';
1+
import {Fragment, useEffect, useState} from 'react';
22
import styled from '@emotion/styled';
33
import beautify from 'js-beautify';
44

55
import {ModalRenderProps} from 'sentry/actionCreators/modal';
6+
import {CopyToClipboardButton} from 'sentry/components/copyToClipboardButton';
67
import {Flex} from 'sentry/components/profiling/flex';
78
import {
89
Provider as ReplayContextProvider,
@@ -90,9 +91,33 @@ export default function ReplayComparisonModal({
9091
</ReplayContextProvider>
9192
</Flex>
9293
{activeTab === 'html' && leftBody && rightBody ? (
93-
<SplitDiffScrollWrapper>
94-
<SplitDiff base={leftBody} target={rightBody} type="words" />
95-
</SplitDiffScrollWrapper>
94+
<Fragment>
95+
<DiffHeader>
96+
<Flex flex="1" align="center">
97+
{t('Before Hydration')}
98+
<CopyToClipboardButton
99+
text={leftBody}
100+
size="xs"
101+
iconSize="xs"
102+
borderless
103+
aria-label={t('Copy Before')}
104+
/>
105+
</Flex>
106+
<Flex flex="1" align="center">
107+
{t('After Hydration')}
108+
<CopyToClipboardButton
109+
text={rightBody}
110+
size="xs"
111+
iconSize="xs"
112+
borderless
113+
aria-label={t('Copy After')}
114+
/>
115+
</Flex>
116+
</DiffHeader>
117+
<SplitDiffScrollWrapper>
118+
<SplitDiff base={leftBody} target={rightBody} type="words" />
119+
</SplitDiffScrollWrapper>
120+
</Fragment>
96121
) : null}
97122
</Flex>
98123
</Body>
@@ -132,3 +157,12 @@ const SplitDiffScrollWrapper = styled('div')`
132157
height: 70vh;
133158
overflow: auto;
134159
`;
160+
161+
const DiffHeader = styled('div')`
162+
display: flex;
163+
flex-direction: row;
164+
align-items: center;
165+
flex: 1;
166+
font-weight: 600;
167+
line-height: 1.2;
168+
`;

0 commit comments

Comments
 (0)