Skip to content

Commit 6c50a92

Browse files
committed
ref(issues): Clarify markdown copy button label and show line count
Changes the button text from "Copy to Clipboard" to "Copy as Markdown" to make it clearer what format is being copied. Adds a tooltip showing the number of lines that will be copied, helping users understand the amount of content being copied.
1 parent 4063ab8 commit 6c50a92

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

static/app/views/issueDetails/streamline/eventTitle.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {useActionableItemsWithProguardErrors} from 'sentry/components/events/int
1010
import {useGroupSummaryData} from 'sentry/components/group/groupSummary';
1111
import TimeSince from 'sentry/components/timeSince';
1212
import {IconCopy, IconWarning} from 'sentry/icons';
13-
import {t} from 'sentry/locale';
13+
import {t, tct} from 'sentry/locale';
1414
import type {Event} from 'sentry/types/event';
1515
import type {Group} from 'sentry/types/group';
1616
import {trackAnalytics} from 'sentry/utils/analytics';
@@ -53,6 +53,7 @@ function GroupMarkdownButton({group, event}: {event: Event; group: Group}) {
5353
const markdownText = useMemo(() => {
5454
return issueAndEventToMarkdown(group, event, groupSummaryData, autofixData);
5555
}, [group, event, groupSummaryData, autofixData]);
56+
const markdownLines = markdownText.trim().split('\n').length.toLocaleString();
5657

5758
const {copy} = useCopyToClipboard();
5859

@@ -79,7 +80,15 @@ function GroupMarkdownButton({group, event}: {event: Event; group: Group}) {
7980
]);
8081

8182
return (
82-
<MarkdownButton onClick={handleCopyMarkdown}>{t('Copy to Clipboard')}</MarkdownButton>
83+
<MarkdownButton
84+
title={tct('Copies [numLines] lines of Markdown', {
85+
numLines: <strong>{markdownLines}</strong>,
86+
})}
87+
priority="link"
88+
onClick={handleCopyMarkdown}
89+
>
90+
{t('Copy as Markdown')}
91+
</MarkdownButton>
8392
);
8493
}
8594

@@ -250,14 +259,12 @@ const JsonLink = styled(ExternalLink)`
250259
}
251260
`;
252261

253-
const MarkdownButton = styled('button')`
254-
background: none;
255-
border: none;
256-
padding: 0;
262+
const MarkdownButton = styled(Button)`
257263
color: ${p => p.theme.subText};
258264
text-decoration: underline;
259265
text-decoration-color: ${p => Color(p.theme.gray300).alpha(0.5).string()};
260266
font-size: inherit;
267+
font-weight: normal;
261268
cursor: pointer;
262269
white-space: nowrap;
263270

0 commit comments

Comments
 (0)