Skip to content

Commit 7295a7d

Browse files
authored
Merge pull request #102 from buggregator/issue/#95-improve-copy-image
2 parents f9f1080 + a735ba1 commit 7295a7d

File tree

10 files changed

+200
-56
lines changed

10 files changed

+200
-56
lines changed

app.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66

77
<script lang="ts" setup>
88
import "./assets/index.css";
9-
import "./assets/index";
9+
import "./assets/vendor";
1010
</script>
File renamed without changes.

src/entities/sentry/ui/preview-card/preview-card.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { SentryException } from "../sentry-exception";
88
99
type Props = {
1010
event: NormalizedEvent<Sentry>;
11-
maxFrames: number;
11+
maxFrames?: number;
1212
};
1313
1414
const props = withDefaults(defineProps<Props>(), {
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading

src/shared/ui/icon-svg/icon-svg.vue

Lines changed: 89 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,43 @@ type Props = {
33
name: string;
44
};
55
6-
const props = defineProps<Props>();
6+
defineProps<Props>();
77
</script>
88

99
<template>
1010
<div class="icon-svg">
1111
<svg
1212
v-if="name === 'bolt'"
1313
xmlns="http://www.w3.org/2000/svg"
14-
width="24" height="24" viewBox="0 0 24 24" fill="none"
14+
width="24"
15+
height="24"
16+
viewBox="0 0 24 24"
17+
fill="none"
1518
>
16-
<path d="M3.75 13.5L14.25 2.25L12 10.5H20.25L9.75 21.75L12 13.5H3.75Z" stroke-width="1.5"
17-
stroke-linecap="round" stroke-linejoin="round"/>
19+
<path
20+
d="M3.75 13.5L14.25 2.25L12 10.5H20.25L9.75 21.75L12 13.5H3.75Z"
21+
stroke-width="1.5"
22+
stroke-linecap="round"
23+
stroke-linejoin="round"
24+
/>
1825
</svg>
1926
<svg
20-
v-if="name === 'bolt-slash'"
27+
v-else-if="name === 'bolt-slash'"
2128
xmlns="http://www.w3.org/2000/svg"
22-
width="24" height="24" viewBox="0 0 24 24" fill="none"
29+
width="24"
30+
height="24"
31+
viewBox="0 0 24 24"
32+
fill="none"
2333
>
2434
<path
2535
d="M11.4123 15.6549L9.75 21.75L13.4949 17.7376M9.25736 13.5H3.75L6.40873 10.6514M8.4569 8.4569L14.25 2.25L12 10.5H20.25L15.5431 15.5431M8.4569 8.4569L3 3M8.4569 8.4569L15.5431 15.5431M15.5431 15.5431L21 21"
26-
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
36+
stroke-width="1.5"
37+
stroke-linecap="round"
38+
stroke-linejoin="round"
39+
/>
2740
</svg>
2841
<svg
29-
v-if="name === 'copy'"
42+
v-else-if="name === 'copy'"
3043
xmlns="http://www.w3.org/2000/svg"
3144
viewBox="0 0 460 460"
3245
>
@@ -73,14 +86,17 @@ const props = defineProps<Props>();
7386
/>
7487
</svg>
7588

76-
<svg v-else-if="name === 'discord'"
77-
viewBox="0 -28.5 256 256" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid">
89+
<svg
90+
v-else-if="name === 'discord'"
91+
viewBox="0 -28.5 256 256"
92+
xmlns="http://www.w3.org/2000/svg"
93+
preserveAspectRatio="xMidYMid"
94+
>
7895
<path
7996
d="M216.856 16.597A208.502 208.502 0 0 0 164.042 0c-2.275 4.113-4.933 9.645-6.766 14.046-19.692-2.961-39.203-2.961-58.533 0-1.832-4.4-4.55-9.933-6.846-14.046a207.809 207.809 0 0 0-52.855 16.638C5.618 67.147-3.443 116.4 1.087 164.956c22.169 16.555 43.653 26.612 64.775 33.193A161.094 161.094 0 0 0 79.735 175.3a136.413 136.413 0 0 1-21.846-10.632 108.636 108.636 0 0 0 5.356-4.237c42.122 19.702 87.89 19.702 129.51 0a131.66 131.66 0 0 0 5.355 4.237 136.07 136.07 0 0 1-21.886 10.653c4.006 8.02 8.638 15.67 13.873 22.848 21.142-6.58 42.646-16.637 64.815-33.213 5.316-56.288-9.08-105.09-38.056-148.36ZM85.474 135.095c-12.645 0-23.015-11.805-23.015-26.18s10.149-26.2 23.015-26.2c12.867 0 23.236 11.804 23.015 26.2.02 14.375-10.148 26.18-23.015 26.18Zm85.051 0c-12.645 0-23.014-11.805-23.014-26.18s10.148-26.2 23.014-26.2c12.867 0 23.236 11.804 23.015 26.2 0 14.375-10.148 26.18-23.015 26.18Z"
8097
/>
8198
</svg>
8299

83-
84100
<svg
85101
v-else-if="name === 'heartBeat'"
86102
xmlns="http://www.w3.org/2000/svg"
@@ -98,19 +114,19 @@ const props = defineProps<Props>();
98114
xmlns="http://www.w3.org/2000/svg"
99115
viewBox="0 0 489.8 489.8"
100116
>
101-
<circle cx="245" cy="453.9" r="26.8"/>
102-
<circle cx="422.8" cy="453.9" r="26.8"/>
103-
<circle cx="67" cy="453.9" r="26.8"/>
117+
<circle cx="245" cy="453.9" r="26.8" />
118+
<circle cx="422.8" cy="453.9" r="26.8" />
119+
<circle cx="67" cy="453.9" r="26.8" />
104120
<path
105121
d="M443 31c0-17-14-31-31-31H78C61 0 47 14 47 31v69c0 8 4 15 9 21-5 6-9 13-9 21v70c0 8 4 15 9 21-5 5-9 13-9 21v69c0 17 14 31 31 31h334c17 0 31-14 31-31v-69c0-8-3-16-9-21 6-6 9-13 9-22v-69c0-8-3-16-9-21 6-6 9-13 9-21V31zM65 31c0-7 6-13 12-13h335c7 0 13 6 13 13v69c0 6-6 12-13 12H78c-7 0-13-5-13-12V31zm360 111v70c0 6-6 12-13 12H78c-7 0-13-6-13-12v-70c0-6 6-12 13-12h334c7 0 13 6 13 12zm0 181c0 7-6 13-13 13H78c-7 0-13-6-13-13v-69c0-7 6-12 13-12h334c7 0 13 5 13 12v69z"
106122
/>
107-
<path d="M241 74h113c5 0 9-4 9-9s-4-9-9-9H241c-5 0-9 4-9 9s4 9 9 9z"/>
108-
<circle cx="148.8" cy="65.1" r="10.8"/>
123+
<path d="M241 74h113c5 0 9-4 9-9s-4-9-9-9H241c-5 0-9 4-9 9s4 9 9 9z" />
124+
<circle cx="148.8" cy="65.1" r="10.8" />
109125
<path
110126
d="M241 186h113c5 0 9-4 9-9s-4-9-9-9H241c-5 0-9 4-9 9s4 9 9 9zM354 280H241c-5 0-9 4-9 9s4 9 9 9h113c5 0 9-4 9-9s-4-9-9-9z"
111127
/>
112-
<circle cx="148.8" cy="177" r="10.8"/>
113-
<circle cx="148.8" cy="288.9" r="10.8"/>
128+
<circle cx="148.8" cy="177" r="10.8" />
129+
<circle cx="148.8" cy="288.9" r="10.8" />
114130
<path
115131
d="M423 418c-17 0-31 11-35 27H280c-4-13-13-22-26-26v-28c0-5-4-9-9-9s-9 4-9 9v28c-13 3-22 13-26 26H102a36 36 0 100 18h108a36 36 0 0070 0h108a36 36 0 1035-45zM67 472a18 18 0 010-36 18 18 0 010 36zm178 0a18 18 0 010-36 18 18 0 010 36zm178 0a18 18 0 010-36 18 18 0 010 36z"
116132
/>
@@ -176,7 +192,7 @@ const props = defineProps<Props>();
176192
xmlns="http://www.w3.org/2000/svg"
177193
viewBox="0 0 12 12"
178194
>
179-
<path d="M12 6c0 .6-.4 1-1 1H1a1 1 0 0 1 0-2h10c.6 0 1 .4 1 1Z"/>
195+
<path d="M12 6c0 .6-.4 1-1 1H1a1 1 0 0 1 0-2h10c.6 0 1 .4 1 1Z" />
180196
</svg>
181197

182198
<svg
@@ -196,8 +212,8 @@ const props = defineProps<Props>();
196212
xmlns="http://www.w3.org/2000/svg"
197213
viewBox="0 0 12 12"
198214
>
199-
<path d="M6 0c.6 0 1 .4 1 1v10a1 1 0 1 1-2 0V1c0-.6.4-1 1-1Z"/>
200-
<path d="M12 6c0 .6-.4 1-1 1H1a1 1 0 0 1 0-2h10c.6 0 1 .4 1 1Z"/>
215+
<path d="M6 0c.6 0 1 .4 1 1v10a1 1 0 1 1-2 0V1c0-.6.4-1 1-1Z" />
216+
<path d="M12 6c0 .6-.4 1-1 1H1a1 1 0 0 1 0-2h10c.6 0 1 .4 1 1Z" />
201217
</svg>
202218

203219
<svg
@@ -379,7 +395,7 @@ const props = defineProps<Props>();
379395
y2="30"
380396
gradientUnits="userSpaceOnUse"
381397
>
382-
<stop class="transition-all duration-200" stop-color="#FACC15"/>
398+
<stop class="transition-all duration-200" stop-color="#FACC15" />
383399
<stop
384400
class="transition-all duration-200"
385401
offset="1"
@@ -410,7 +426,7 @@ const props = defineProps<Props>();
410426
<path
411427
d="M128 406c4 0 8-4 8-8V124a8 8 0 0 0-15 0v274c0 4 3 8 7 8zM384 264c-4 0-7 3-7 7v204c0 12-11 22-23 22H158c-12 0-22-10-22-22v-47a8 8 0 0 0-15 0v47c0 20 16 37 37 37h196c21 0 38-17 38-37V271c0-4-4-7-8-7zM354 0H158c-21 0-37 17-37 38v56a8 8 0 0 0 15 0V38c0-13 10-23 22-23h31c8 15 24 25 41 25h52c17 0 33-10 41-25h31c12 0 23 10 23 23v203a8 8 0 0 0 15 0V38c0-21-17-38-38-38zm-72 25h-52c-9 0-17-4-23-10h98c-6 6-14 10-23 10z"
412428
/>
413-
<path d="M287 478a8 8 0 0 0 0-15h-62a8 8 0 0 0 0 15h62z"/>
429+
<path d="M287 478a8 8 0 0 0 0-15h-62a8 8 0 0 0 0 15h62z" />
414430
</svg>
415431

416432
<svg
@@ -424,7 +440,7 @@ const props = defineProps<Props>();
424440
<path
425441
d="M90 61v284a8 8 0 0 0 15 0V69h302v103a8 8 0 0 0 15 0V61c0-4-3-7-7-7H97c-4 0-7 3-7 7zM90 432c0 4 3 8 7 8h318c4 0 7-4 7-8V202a8 8 0 0 0-15 0v223H105v-50a8 8 0 0 0-15 0v57zM233 467a23 23 0 1 0 46-1 23 23 0 0 0-46 1zm31 0a8 8 0 1 1-16 0 8 8 0 0 1 16 0zM288 42a8 8 0 0 0 0-15h-34a8 8 0 0 0 0 15h34z"
426442
/>
427-
<circle cx="225.6" cy="34.3" r="7.5"/>
443+
<circle cx="225.6" cy="34.3" r="7.5" />
428444
</svg>
429445

430446
<svg
@@ -487,12 +503,12 @@ const props = defineProps<Props>();
487503
stroke-linecap="round"
488504
stroke-linejoin="round"
489505
>
490-
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
506+
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
491507
<path
492508
d="M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6z"
493509
/>
494-
<path d="M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0"/>
495-
<path d="M8 11v-4a4 4 0 1 1 8 0v4"/>
510+
<path d="M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0" />
511+
<path d="M8 11v-4a4 4 0 1 1 8 0v4" />
496512
</svg>
497513

498514
<svg
@@ -506,13 +522,55 @@ const props = defineProps<Props>();
506522
stroke-linecap="round"
507523
stroke-linejoin="round"
508524
>
509-
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
525+
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
510526
<path
511527
d="M15 11h2a2 2 0 0 1 2 2v2m0 4a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6a2 2 0 0 1 2 -2h4"
512528
/>
513-
<path d="M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0"/>
514-
<path d="M8 11v-3m.719 -3.289a4 4 0 0 1 7.281 2.289v4"/>
515-
<path d="M3 3l18 18"/>
529+
<path d="M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0" />
530+
<path d="M8 11v-3m.719 -3.289a4 4 0 0 1 7.281 2.289v4" />
531+
<path d="M3 3l18 18" />
532+
</svg>
533+
534+
<svg
535+
v-else-if="name === 'image-download'"
536+
viewBox="0 0 24 24"
537+
width="24"
538+
height="24"
539+
stroke-width="2"
540+
stroke="currentColor"
541+
fill="none"
542+
stroke-linecap="round"
543+
stroke-linejoin="round"
544+
>
545+
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
546+
<path d="M15 8h.01" />
547+
<path
548+
d="M12.5 21h-6.5a3 3 0 0 1 -3 -3v-12a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v6.5"
549+
/>
550+
<path d="M3 16l5 -5c.928 -.893 2.072 -.893 3 0l4 4" />
551+
<path d="M14 14l1 -1c.653 -.629 1.413 -.815 2.13 -.559" />
552+
<path d="M19 16v6" />
553+
<path d="M22 19l-3 3l-3 -3" />
554+
</svg>
555+
556+
<svg
557+
v-else-if="name === 'file-download'"
558+
viewBox="0 0 24 24"
559+
width="24"
560+
height="24"
561+
stroke-width="2"
562+
stroke="currentColor"
563+
fill="none"
564+
stroke-linecap="round"
565+
stroke-linejoin="round"
566+
>
567+
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
568+
<path d="M14 3v4a1 1 0 0 0 1 1h4" />
569+
<path
570+
d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"
571+
/>
572+
<path d="M12 17v-6" />
573+
<path d="M9.5 14.5l2.5 2.5l2.5 -2.5" />
516574
</svg>
517575
</div>
518576
</template>

src/shared/ui/preview-card/preview-card-header.vue

Lines changed: 70 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<script lang="ts" setup>
22
import { computed } from "vue";
3-
import { EVENT_TYPES } from "../../types";
3+
import type { EventType } from "../../types";
44
import { IconSvg } from "../icon-svg";
5+
import { DownloadType } from "./types";
56
67
type Props = {
7-
eventType: EVENT_TYPES;
8+
eventType: EventType | "unknown";
89
eventId: string;
910
eventUrl: string;
1011
tags: string[];
@@ -17,7 +18,7 @@ type Emits = {
1718
delete: [value: boolean];
1819
toggleView: [value: boolean];
1920
copy: [value: boolean];
20-
download: [value: boolean];
21+
download: [value: DownloadType];
2122
lock: [value: boolean];
2223
};
2324
@@ -40,8 +41,12 @@ const copyEvent = () => {
4041
emit("copy", true);
4142
};
4243
43-
const downloadEvent = () => {
44-
emit("download", true);
44+
const downloadImageEvent = () => {
45+
emit("download", DownloadType.Image);
46+
};
47+
48+
const downloadFile = () => {
49+
emit("download", DownloadType.File);
4550
};
4651
4752
const lockEvent = () => {
@@ -76,14 +81,37 @@ const isVisibleTags = computed(() => props.tags.length > 0);
7681
</template>
7782
</div>
7883

79-
<div v-if="isVisibleControls" class="preview-card-header__container">
80-
<button
81-
class="preview-card-header__button preview-card-header__button--copy"
82-
@click="downloadEvent"
83-
@click.right.prevent="copyEvent"
84-
>
85-
<IconSvg name="copy" class="preview-card-header__button-icon" />
86-
</button>
84+
<div v-if="isVisibleControls" class="preview-card-header__buttons">
85+
<div class="preview-card-header__buttons-expand">
86+
<button
87+
class="preview-card-header__button preview-card-header__button--copy"
88+
@click="copyEvent"
89+
>
90+
<IconSvg name="copy" class="preview-card-header__button-icon" />
91+
</button>
92+
93+
<div class="preview-card-header__buttons-expand-list">
94+
<button
95+
class="preview-card-header__button preview-card-header__button--copy"
96+
@click="downloadFile"
97+
>
98+
<IconSvg
99+
name="file-download"
100+
class="preview-card-header__button-icon"
101+
/>
102+
</button>
103+
104+
<button
105+
class="preview-card-header__button preview-card-header__button--copy"
106+
@click="downloadImageEvent"
107+
>
108+
<IconSvg
109+
name="image-download"
110+
class="preview-card-header__button-icon"
111+
/>
112+
</button>
113+
</div>
114+
</div>
87115

88116
<button
89117
class="preview-card-header__button preview-card-header__button--collapse"
@@ -139,10 +167,6 @@ $eventTypeColorsMap: (
139167
@apply w-full flex sm:flex-row flex-col-reverse justify-between gap-y-3;
140168
}
141169
142-
.preview-card-header__container {
143-
@apply flex justify-end space-x-2;
144-
}
145-
146170
.preview-card-header__tags {
147171
@apply flex flex-wrap gap-3;
148172
}
@@ -182,6 +206,28 @@ $eventTypeColorsMap: (
182206
}
183207
}
184208
209+
.preview-card-header__buttons {
210+
@apply flex justify-end space-x-2;
211+
}
212+
213+
.preview-card-header__buttons-expand {
214+
@apply relative left-[2px] flex border-x-2 rounded-3xl border-transparent dark:border-transparent cursor-pointer;
215+
216+
&:hover {
217+
@apply bg-gray-200 dark:bg-gray-700 ring-1 ring-gray-200 dark:ring-gray-700 border-gray-200 dark:border-gray-700;
218+
}
219+
}
220+
221+
.preview-card-header__buttons-expand-list {
222+
@apply flex flex-row justify-end space-x-2 pr-2 transition-all;
223+
@apply hidden overflow-hidden opacity-0;
224+
order: -1;
225+
226+
.preview-card-header__buttons-expand:hover & {
227+
@apply flex overflow-visible opacity-100;
228+
}
229+
}
230+
185231
.preview-card-header__button {
186232
@apply w-5 h-5 md:w-4 md:h-4 rounded-full opacity-90 hover:opacity-100 transition-all hover:ring-4 ring-offset-1;
187233
@apply text-white bg-gray-300 dark:bg-gray-600 ring-blue-200 dark:ring-blue-800;
@@ -218,10 +264,14 @@ $eventTypeColorsMap: (
218264
}
219265
220266
.preview-card-header__button-icon {
221-
@apply p-1 dark:fill-white;
267+
@apply p-0.5 dark:fill-white;
268+
269+
.preview-card-header__button--collapse & {
270+
@apply p-1;
271+
}
222272
223-
.preview-card-header__button--lock & {
224-
@apply p-0.5;
273+
.preview-card-header__button--delete & {
274+
@apply p-1;
225275
}
226276
}
227277
</style>

0 commit comments

Comments
 (0)