your personal website on atproto - mirror blento.app

Merge pull request #18 from jycouet/feat/all-card-options

Always show all cards options

authored by

Florian and committed by
GitHub
4444adc4 b20b24aa

+4 -4
+4 -4
src/lib/cards/BaseCard/BaseEditingCard.svelte
··· 152 152 let changePopoverOpen = $state(false); 153 153 154 154 const changeOptions = $derived( 155 - AllCardDefinitions.filter((def) => def.type !== item.cardType && def.canChange?.(item)) 155 + AllCardDefinitions.filter((def) => def.canChange?.(item)) 156 156 ); 157 157 158 158 function applyChange(def: (typeof AllCardDefinitions)[number]) { ··· 183 183 {#snippet controls()} 184 184 <!-- class="bg-base-100 border-base-200 dark:bg-base-800 dark:border-base-700 absolute -top-3 -left-3 hidden cursor-pointer items-center justify-center rounded-full border p-2 shadow-lg group-focus-within:inline-flex group-hover/card:inline-flex" --> 185 185 {#if canEdit()} 186 - {#if changeOptions.length > 0} 186 + {#if changeOptions.length > 1} 187 187 <div 188 188 class={[ 189 189 'absolute -top-3 -right-3 hidden group-focus-within:inline-flex group-hover/card:inline-flex', ··· 213 213 {/snippet} 214 214 215 215 <div class="flex min-w-36 flex-col gap-1"> 216 - <Label class="mb-2">Change card to</Label> 216 + <Label class="mb-2">Card type</Label> 217 217 {#each changeOptions as changeDef} 218 218 <Button 219 219 class="justify-start" 220 - variant="ghost" 220 + variant={changeDef.type === item.cardType ? 'primary' : 'ghost'} 221 221 onclick={() => applyChange(changeDef)} 222 222 > 223 223 {getChangeLabel(changeDef)}