Skip to content

Commit d573be1

Browse files
authored
chore(preprod): add ellipsis + tooltip to file path name (EME-487) (#102329)
on compare diff table, add ellipsis + tooltip with copy button https://github.com/user-attachments/assets/62125421-d620-43ef-8b9d-17d5a0281899 ### Legal Boilerplate Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
1 parent 482ff66 commit d573be1

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

static/app/views/preprod/buildComparison/main/sizeCompareItemDiffTable.tsx

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import {useState} from 'react';
22
import styled from '@emotion/styled';
33

4+
import {CopyToClipboardButton} from 'sentry/components/copyToClipboardButton';
5+
import {Flex} from 'sentry/components/core/layout/flex';
6+
import {Tooltip} from 'sentry/components/core/tooltip';
47
import {SimpleTable} from 'sentry/components/tables/simpleTable';
8+
import TextOverflow from 'sentry/components/textOverflow';
59
import {IconAdd, IconFix, IconSubtract} from 'sentry/icons';
610
import {t} from 'sentry/locale';
711
import {formatBytesBase10} from 'sentry/utils/bytes/formatBytesBase10';
@@ -144,7 +148,37 @@ export function SizeCompareItemDiffTable({diffItems}: SizeCompareItemDiffTablePr
144148
{changeTypeLabel}
145149
</ChangeTag>
146150
</SimpleTable.RowCell>
147-
<SimpleTable.RowCell>{diffItem.path}</SimpleTable.RowCell>
151+
<SimpleTable.RowCell justify="flex-start" style={{minWidth: 0}}>
152+
<Tooltip
153+
title={
154+
diffItem.path ? (
155+
<Flex
156+
align="start"
157+
gap="xs"
158+
style={{maxWidth: '100%', textAlign: 'left'}}
159+
>
160+
<FilePathTooltipText>{diffItem.path}</FilePathTooltipText>
161+
<CopyToClipboardButton
162+
borderless
163+
size="zero"
164+
text={diffItem.path}
165+
style={{flexShrink: 0}}
166+
/>
167+
</Flex>
168+
) : null
169+
}
170+
disabled={!diffItem.path}
171+
isHoverable
172+
maxWidth={420}
173+
>
174+
<TextOverflow
175+
ellipsisDirection="right"
176+
style={{display: 'block', width: '100%'}}
177+
>
178+
{diffItem.path ?? ''}
179+
</TextOverflow>
180+
</Tooltip>
181+
</SimpleTable.RowCell>
148182
<SimpleTable.RowCell>
149183
{capitalize(diffItem.item_type ?? '')}
150184
</SimpleTable.RowCell>
@@ -214,6 +248,14 @@ const ChangeTag = styled('span')<{changeType: DiffType}>`
214248
}};
215249
`;
216250

251+
const FilePathTooltipText = styled('span')`
252+
flex: 1;
253+
overflow-wrap: break-word;
254+
word-break: break-all;
255+
white-space: normal;
256+
user-select: text;
257+
`;
258+
217259
const ChangeAmountCell = styled(SimpleTable.RowCell)<{changeType: DiffType}>`
218260
align-items: end;
219261
color: ${p => {

0 commit comments

Comments
 (0)