Skip to content

Commit ca25bc0

Browse files
authored
Make event timestamp copyable (#2647)
1 parent 1f7d6c0 commit ca25bc0

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

Diff for: src/lib/components/event/event-summary-row.svelte

+22-7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import { page } from '$app/stores';
55
66
import Badge from '$lib/holocene/badge.svelte';
7+
import Copyable from '$lib/holocene/copyable/index.svelte';
78
import Icon from '$lib/holocene/icon/icon.svelte';
89
import Link from '$lib/holocene/link.svelte';
910
import Tooltip from '$lib/holocene/tooltip.svelte';
@@ -114,6 +115,13 @@
114115
secondaryAttribute?.key &&
115116
secondaryAttribute?.key !== primaryAttribute?.key &&
116117
!currentEvent?.userMetadata?.summary;
118+
$: eventTime = formatDate(currentEvent?.eventTime, $timeFormat, {
119+
relative: $relativeTime,
120+
});
121+
$: abbrEventTime = formatDate(currentEvent?.eventTime, $timeFormat, {
122+
relative: $relativeTime,
123+
abbrFormat: true,
124+
});
117125
</script>
118126

119127
<tr
@@ -160,10 +168,13 @@
160168
text={isEventGroup(event) ? `Duration: ${duration}` : `+${elapsedTime}`}
161169
bottom
162170
>
163-
{formatDate(currentEvent?.eventTime, $timeFormat, {
164-
relative: $relativeTime,
165-
abbrFormat: true,
166-
})}
171+
<Copyable
172+
copyIconTitle={translate('common.copy-icon-title')}
173+
copySuccessIconTitle={translate('common.copy-success-icon-title')}
174+
content={abbrEventTime}
175+
>
176+
{abbrEventTime}
177+
</Copyable>
167178
</Tooltip>
168179
</td>
169180
<td class="hidden text-right md:block">
@@ -172,9 +183,13 @@
172183
text={isEventGroup(event) ? `Duration: ${duration}` : `+${elapsedTime}`}
173184
bottom
174185
>
175-
{formatDate(currentEvent?.eventTime, $timeFormat, {
176-
relative: $relativeTime,
177-
})}
186+
<Copyable
187+
copyIconTitle={translate('common.copy-icon-title')}
188+
copySuccessIconTitle={translate('common.copy-success-icon-title')}
189+
content={eventTime}
190+
>
191+
{eventTime}
192+
</Copyable>
178193
</Tooltip>
179194
</td>
180195
<td class="truncate md:min-w-fit">

0 commit comments

Comments
 (0)