Skip to content

Commit 85bec5e

Browse files
Use shared button components in queue overlay (#6793)
## Summary - replace raw button elements in queue progress overlay UI with shared IconButton/TextButton/IconTextButton components - remove forced justify-start from IconTextButton base and add explicit alignment where needed - keep queue overlay actions consistent with button styling patterns ## Testing - pnpm typecheck - pnpm lint:fix ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6793-Use-shared-button-components-in-queue-overlay-2b26d73d3650814d9ebfebba74226036) by [Unito](https://www.unito.io)
1 parent bdf6d4d commit 85bec5e

File tree

11 files changed

+189
-138
lines changed

11 files changed

+189
-138
lines changed

src/components/button/IconButton.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
import { cn } from '@/utils/tailwindUtil'
2525
2626
interface IconButtonProps extends BaseButtonProps {
27-
onClick: (event: Event) => void
27+
onClick?: (event: MouseEvent) => void
2828
}
2929
3030
defineOptions({

src/components/button/IconTextButton.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const {
4747
} = defineProps<IconTextButtonProps>()
4848
4949
const buttonStyle = computed(() => {
50-
const baseClasses = `${getBaseButtonClasses()} justify-start! gap-2`
50+
const baseClasses = `${getBaseButtonClasses()} justify-start gap-2`
5151
const sizeClasses = getButtonSizeClasses(size)
5252
const typeClasses = border
5353
? getBorderButtonTypeClasses(type)

src/components/queue/CompletionSummaryBanner.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<template>
2-
<button
3-
type="button"
4-
class="group flex w-full items-center justify-between gap-3 rounded-lg border-0 bg-secondary-background p-1 text-left transition-colors duration-200 ease-in-out hover:cursor-pointer hover:bg-secondary-background-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-background"
2+
<IconButton
3+
type="secondary"
4+
size="fit-content"
5+
class="group w-full justify-between gap-3 rounded-lg p-1 text-left font-normal hover:cursor-pointer focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-background"
56
:aria-label="props.ariaLabel"
7+
@click="emit('click', $event)"
68
>
79
<span class="inline-flex items-center gap-2">
810
<span v-if="props.mode === 'allFailed'" class="inline-flex items-center">
@@ -76,10 +78,11 @@
7678
>
7779
<i class="icon-[lucide--chevron-down] block size-4 leading-none" />
7880
</span>
79-
</button>
81+
</IconButton>
8082
</template>
8183

8284
<script setup lang="ts">
85+
import IconButton from '@/components/button/IconButton.vue'
8386
import type {
8487
CompletionSummary,
8588
CompletionSummaryMode
@@ -96,4 +99,8 @@ type Props = {
9699
const props = withDefaults(defineProps<Props>(), {
97100
thumbnailUrls: () => []
98101
})
102+
103+
const emit = defineEmits<{
104+
(e: 'click', event: MouseEvent): void
105+
}>()
99106
</script>

src/components/queue/QueueOverlayActive.vue

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,19 @@
4242
t('sideToolbar.queueProgressOverlay.running')
4343
}}</span>
4444
</span>
45-
<button
45+
<IconButton
4646
v-if="runningCount > 0"
4747
v-tooltip.top="cancelJobTooltip"
48-
class="inline-flex size-6 cursor-pointer items-center justify-center rounded border-0 bg-secondary-background p-0 transition-colors hover:bg-destructive-background"
48+
type="secondary"
49+
size="sm"
50+
class="size-6 bg-secondary-background hover:bg-destructive-background"
4951
:aria-label="t('sideToolbar.queueProgressOverlay.interruptAll')"
5052
@click="$emit('interruptAll')"
5153
>
5254
<i
5355
class="icon-[lucide--x] block size-4 leading-none text-text-primary"
5456
/>
55-
</button>
57+
</IconButton>
5658
</div>
5759

5860
<div class="flex items-center gap-2">
@@ -62,26 +64,28 @@
6264
t('sideToolbar.queueProgressOverlay.queuedSuffix')
6365
}}</span>
6466
</span>
65-
<button
67+
<IconButton
6668
v-if="queuedCount > 0"
6769
v-tooltip.top="clearQueueTooltip"
68-
class="inline-flex size-6 cursor-pointer items-center justify-center rounded border-0 bg-secondary-background p-0 transition-colors hover:bg-destructive-background"
70+
type="secondary"
71+
size="sm"
72+
class="size-6 bg-secondary-background hover:bg-destructive-background"
6973
:aria-label="t('sideToolbar.queueProgressOverlay.clearQueued')"
7074
@click="$emit('clearQueued')"
7175
>
7276
<i
7377
class="icon-[lucide--list-x] block size-4 leading-none text-text-primary"
7478
/>
75-
</button>
79+
</IconButton>
7680
</div>
7781
</div>
7882

79-
<button
80-
class="inline-flex h-6 min-w-[120px] flex-1 cursor-pointer items-center justify-center rounded border-0 bg-secondary-background px-2 py-0 text-[12px] text-text-primary hover:bg-secondary-background-hover hover:opacity-90"
83+
<TextButton
84+
class="h-6 min-w-[120px] flex-1 px-2 py-0 text-[12px]"
85+
type="secondary"
86+
:label="t('sideToolbar.queueProgressOverlay.viewAllJobs')"
8187
@click="$emit('viewAllJobs')"
82-
>
83-
{{ t('sideToolbar.queueProgressOverlay.viewAllJobs') }}
84-
</button>
88+
/>
8589
</div>
8690
</div>
8791
</template>
@@ -90,6 +94,8 @@
9094
import { computed } from 'vue'
9195
import { useI18n } from 'vue-i18n'
9296
97+
import IconButton from '@/components/button/IconButton.vue'
98+
import TextButton from '@/components/button/TextButton.vue'
9399
import { buildTooltipConfig } from '@/composables/useTooltipConfig'
94100
95101
defineProps<{

src/components/queue/QueueOverlayExpanded.vue

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,20 @@
88
/>
99

1010
<div class="flex items-center justify-between px-3">
11-
<button
12-
class="inline-flex grow cursor-pointer items-center justify-center gap-1 rounded border-0 bg-secondary-background p-2 text-center font-inter text-[12px] leading-none text-text-primary hover:bg-secondary-background-hover hover:opacity-90"
11+
<IconTextButton
12+
class="grow gap-1 p-2 text-center font-inter text-[12px] leading-none hover:opacity-90 justify-center"
13+
type="secondary"
14+
:label="t('sideToolbar.queueProgressOverlay.showAssets')"
1315
:aria-label="t('sideToolbar.queueProgressOverlay.showAssets')"
1416
@click="$emit('showAssets')"
1517
>
16-
<div
17-
class="pointer-events-none block size-4 shrink-0 leading-none icon-[comfy--image-ai-edit]"
18-
aria-hidden="true"
19-
/>
20-
<span>{{ t('sideToolbar.queueProgressOverlay.showAssets') }}</span>
21-
</button>
18+
<template #icon>
19+
<div
20+
class="pointer-events-none block size-4 shrink-0 leading-none icon-[comfy--image-ai-edit]"
21+
aria-hidden="true"
22+
/>
23+
</template>
24+
</IconTextButton>
2225
<div class="ml-4 inline-flex items-center">
2326
<div
2427
class="inline-flex h-6 items-center text-[12px] leading-none text-text-primary opacity-90"
@@ -28,16 +31,18 @@
2831
t('sideToolbar.queueProgressOverlay.queuedSuffix')
2932
}}</span>
3033
</div>
31-
<button
34+
<IconButton
3235
v-if="queuedCount > 0"
33-
class="group ml-2 inline-flex size-6 cursor-pointer items-center justify-center rounded border-0 bg-secondary-background p-0 transition-colors hover:bg-destructive-background"
36+
class="group ml-2 size-6 bg-secondary-background hover:bg-destructive-background"
37+
type="secondary"
38+
size="sm"
3439
:aria-label="t('sideToolbar.queueProgressOverlay.clearQueued')"
3540
@click="$emit('clearQueued')"
3641
>
3742
<i
3843
class="pointer-events-none icon-[lucide--list-x] block size-4 leading-none text-text-primary transition-colors group-hover:text-base-background"
3944
/>
40-
</button>
45+
</IconButton>
4146
</div>
4247
</div>
4348

@@ -75,6 +80,8 @@
7580
import { ref } from 'vue'
7681
import { useI18n } from 'vue-i18n'
7782
83+
import IconButton from '@/components/button/IconButton.vue'
84+
import IconTextButton from '@/components/button/IconTextButton.vue'
7885
import type {
7986
JobGroup,
8087
JobListItem,

src/components/queue/QueueOverlayHeader.vue

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,18 @@
1818
</span>
1919
</div>
2020
<div class="flex items-center gap-1">
21-
<button
21+
<IconButton
2222
v-tooltip.top="moreTooltipConfig"
23-
class="inline-flex size-6 cursor-pointer items-center justify-center rounded border-0 bg-transparent p-0 hover:bg-secondary-background hover:opacity-100"
23+
type="transparent"
24+
size="sm"
25+
class="size-6 bg-transparent hover:bg-secondary-background hover:opacity-100"
2426
:aria-label="t('sideToolbar.queueProgressOverlay.moreOptions')"
2527
@click="onMoreClick"
2628
>
2729
<i
2830
class="icon-[lucide--more-horizontal] block size-4 leading-none text-text-secondary"
2931
/>
30-
</button>
32+
</IconButton>
3133
<Popover
3234
ref="morePopoverRef"
3335
:dismissable="true"
@@ -45,18 +47,19 @@
4547
<div
4648
class="flex flex-col items-stretch rounded-lg border border-interface-stroke bg-interface-panel-surface px-2 py-3 font-inter"
4749
>
48-
<button
49-
class="inline-flex w-full cursor-pointer items-center justify-start gap-2 rounded-lg border-0 bg-transparent p-2 font-inter text-[12px] leading-none text-text-primary hover:bg-transparent hover:opacity-90"
50+
<IconTextButton
51+
class="w-full justify-start gap-2 bg-transparent p-2 font-inter text-[12px] leading-none text-text-primary hover:bg-transparent hover:opacity-90"
52+
type="transparent"
53+
:label="t('sideToolbar.queueProgressOverlay.clearHistory')"
5054
:aria-label="t('sideToolbar.queueProgressOverlay.clearHistory')"
5155
@click="onClearHistoryFromMenu"
5256
>
53-
<i
54-
class="icon-[lucide--file-x-2] block size-4 leading-none text-text-secondary"
55-
/>
56-
<span>{{
57-
t('sideToolbar.queueProgressOverlay.clearHistory')
58-
}}</span>
59-
</button>
57+
<template #icon>
58+
<i
59+
class="icon-[lucide--file-x-2] block size-4 leading-none text-text-secondary"
60+
/>
61+
</template>
62+
</IconTextButton>
6063
</div>
6164
</Popover>
6265
</div>
@@ -69,6 +72,8 @@ import type { PopoverMethods } from 'primevue/popover'
6972
import { computed, ref } from 'vue'
7073
import { useI18n } from 'vue-i18n'
7174
75+
import IconButton from '@/components/button/IconButton.vue'
76+
import IconTextButton from '@/components/button/IconTextButton.vue'
7277
import { buildTooltipConfig } from '@/composables/useTooltipConfig'
7378
7479
defineProps<{

src/components/queue/dialogs/QueueClearHistoryDialog.vue

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
<p class="m-0 text-[14px] font-normal leading-none">
99
{{ t('sideToolbar.queueProgressOverlay.clearHistoryDialogTitle') }}
1010
</p>
11-
<button
12-
class="inline-flex size-6 cursor-pointer items-center justify-center rounded border-0 bg-transparent p-0 text-text-secondary transition hover:bg-secondary-background hover:opacity-100"
11+
<IconButton
12+
type="transparent"
13+
size="sm"
14+
class="size-6 bg-transparent text-text-secondary hover:bg-secondary-background hover:opacity-100"
1315
:aria-label="t('g.close')"
1416
@click="onCancel"
1517
>
1618
<i class="icon-[lucide--x] block size-4 leading-none" />
17-
</button>
19+
</IconButton>
1820
</header>
1921

2022
<div class="flex flex-col gap-4 px-4 py-4 text-[14px] text-text-secondary">
@@ -30,21 +32,19 @@
3032

3133
<footer class="flex items-center justify-end px-4 py-4">
3234
<div class="flex items-center gap-4 text-[14px] leading-none">
33-
<button
34-
class="inline-flex min-h-[24px] cursor-pointer items-center rounded-md border-0 bg-transparent px-1 py-1 text-[14px] leading-[1] text-text-secondary transition hover:text-text-primary"
35-
:aria-label="t('g.cancel')"
35+
<TextButton
36+
class="min-h-[24px] px-1 py-1 text-[14px] leading-[1] text-text-secondary hover:text-text-primary"
37+
type="transparent"
38+
:label="t('g.cancel')"
3639
@click="onCancel"
37-
>
38-
{{ t('g.cancel') }}
39-
</button>
40-
<button
41-
class="inline-flex min-h-[32px] items-center rounded-lg border-0 bg-secondary-background px-4 py-2 text-[12px] font-normal leading-[1] text-text-primary transition hover:bg-secondary-background-hover hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-60"
42-
:aria-label="t('g.clear')"
40+
/>
41+
<TextButton
42+
class="min-h-[32px] px-4 py-2 text-[12px] font-normal leading-[1]"
43+
type="secondary"
44+
:label="t('g.clear')"
4345
:disabled="isClearing"
4446
@click="onConfirm"
45-
>
46-
{{ t('g.clear') }}
47-
</button>
47+
/>
4848
</div>
4949
</footer>
5050
</section>
@@ -54,6 +54,8 @@
5454
import { ref } from 'vue'
5555
import { useI18n } from 'vue-i18n'
5656
57+
import IconButton from '@/components/button/IconButton.vue'
58+
import TextButton from '@/components/button/TextButton.vue'
5759
import { useErrorHandling } from '@/composables/useErrorHandling'
5860
import { useDialogStore } from '@/stores/dialogStore'
5961
import { useQueueStore } from '@/stores/queueStore'

src/components/queue/job/JobContextMenu.vue

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,24 @@
2020
<div v-if="entry.kind === 'divider'" class="px-2 py-1">
2121
<div class="h-px bg-interface-stroke" />
2222
</div>
23-
<button
23+
<IconTextButton
2424
v-else
25-
class="inline-flex w-full cursor-pointer items-center justify-start gap-2 rounded-lg border-0 bg-transparent p-2 font-inter text-[12px] leading-none text-text-primary transition-colors duration-150 hover:bg-interface-panel-hover-surface"
25+
class="w-full justify-start gap-2 bg-transparent p-2 font-inter text-[12px] leading-none text-text-primary hover:bg-interface-panel-hover-surface"
26+
type="transparent"
27+
:label="entry.label"
2628
:aria-label="entry.label"
2729
@click="onEntry(entry)"
2830
>
29-
<i
30-
v-if="entry.icon"
31-
:class="[
32-
entry.icon,
33-
'block size-4 shrink-0 leading-none text-text-secondary'
34-
]"
35-
/>
36-
<span>{{ entry.label }}</span>
37-
</button>
31+
<template #icon>
32+
<i
33+
v-if="entry.icon"
34+
:class="[
35+
entry.icon,
36+
'block size-4 shrink-0 leading-none text-text-secondary'
37+
]"
38+
/>
39+
</template>
40+
</IconTextButton>
3841
</template>
3942
</div>
4043
</Popover>
@@ -44,6 +47,7 @@
4447
import Popover from 'primevue/popover'
4548
import { ref } from 'vue'
4649
50+
import IconTextButton from '@/components/button/IconTextButton.vue'
4751
import type { MenuEntry } from '@/composables/queue/useJobMenu'
4852
4953
defineProps<{ entries: MenuEntry[] }>()

0 commit comments

Comments
 (0)