|
1 |
| -import {useEffect, useState} from 'react'; |
| 1 | +import {Fragment, useEffect, useState} from 'react'; |
2 | 2 | import styled from '@emotion/styled';
|
3 | 3 | import beautify from 'js-beautify';
|
4 | 4 |
|
5 | 5 | import {ModalRenderProps} from 'sentry/actionCreators/modal';
|
| 6 | +import {CopyToClipboardButton} from 'sentry/components/copyToClipboardButton'; |
6 | 7 | import {Flex} from 'sentry/components/profiling/flex';
|
7 | 8 | import {
|
8 | 9 | Provider as ReplayContextProvider,
|
@@ -90,9 +91,33 @@ export default function ReplayComparisonModal({
|
90 | 91 | </ReplayContextProvider>
|
91 | 92 | </Flex>
|
92 | 93 | {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> |
96 | 121 | ) : null}
|
97 | 122 | </Flex>
|
98 | 123 | </Body>
|
@@ -132,3 +157,12 @@ const SplitDiffScrollWrapper = styled('div')`
|
132 | 157 | height: 70vh;
|
133 | 158 | overflow: auto;
|
134 | 159 | `;
|
| 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