|
5 | 5 | import {useViewService} from '../view-service.svelte'; |
6 | 6 | import {FW_CLASSIC_VIEW, FW_LITE_VIEW} from '../view-data'; |
7 | 7 | import {Icon} from '$lib/components/ui/icon'; |
| 8 | + import * as ButtonGroup from '$lib/components/ui/button-group'; |
8 | 9 | import CreateCustomViewDialog from './CreateCustomViewDialog.svelte'; |
9 | 10 | import EditCustomViewDialog from './EditCustomViewDialog.svelte'; |
10 | 11 | import {useDialogsService} from '$lib/services/dialogs-service'; |
|
67 | 68 | {#if customViews.length === 0} |
68 | 69 | <p class="text-sm text-muted-foreground">{$t`No custom views yet.`}</p> |
69 | 70 | {:else} |
70 | | - <div class="rounded-md border divide-y"> |
| 71 | + <div class="space-y-2"> |
71 | 72 | {#each customViews as view (view.id)} |
72 | | - <button |
73 | | - type="button" |
74 | | - class="flex w-full items-center justify-between px-3 py-2 text-left hover:bg-muted cursor-pointer" |
75 | | - onclick={() => openEdit(view)} |
76 | | - > |
77 | | - <div class="min-w-0"> |
78 | | - <div class="truncate text-sm font-medium">{view.name}</div> |
79 | | - <div class="truncate text-xs text-muted-foreground"> |
80 | | - {$t`Based on ${view.base === ViewBase.FieldWorks ? FW_CLASSIC_VIEW.name : FW_LITE_VIEW.name}`} |
| 73 | + <ButtonGroup.Root class="w-full"> |
| 74 | + <Button |
| 75 | + variant="outline" |
| 76 | + class="flex-1 text-start h-auto" |
| 77 | + onclick={() => openEdit(view)} |
| 78 | + > |
| 79 | + <div class="min-w-0 grow"> |
| 80 | + <div class="truncate text-sm font-medium">{view.name}</div> |
| 81 | + <div class="truncate text-xs text-muted-foreground"> |
| 82 | + {$t`Based on ${view.base === ViewBase.FieldWorks ? FW_CLASSIC_VIEW.name : FW_LITE_VIEW.name}`} |
| 83 | + </div> |
81 | 84 | </div> |
82 | | - </div> |
83 | | - <div class="flex items-center gap-1"> |
84 | | - <Button |
85 | | - size="icon" |
86 | | - variant="ghost" |
87 | | - class="hover:bg-destructive/20! hover:text-destructive" |
88 | | - icon="i-mdi-trash-can-outline" |
89 | | - onclick={(e: MouseEvent) => { |
90 | | - e.stopPropagation(); |
91 | | - void onDelete(view); |
92 | | - }} |
93 | | - /> |
94 | 85 | <Icon icon="i-mdi-chevron-right" class="text-muted-foreground" /> |
95 | | - </div> |
96 | | - </button> |
| 86 | + </Button> |
| 87 | + <Button |
| 88 | + variant="outline" |
| 89 | + class="h-auto hover:bg-destructive/20! hover:text-destructive" |
| 90 | + icon="i-mdi-trash-can-outline" |
| 91 | + onclick={() => void onDelete(view)} |
| 92 | + /> |
| 93 | + </ButtonGroup.Root> |
97 | 94 | {/each} |
98 | 95 | </div> |
99 | 96 | {/if} |
|
0 commit comments