fix: disable deleting series if there is only 1

This commit is contained in:
ndom91 2024-10-09 15:27:43 +02:00 committed by Nico Domino
parent e5fbb18883
commit 7858230812
2 changed files with 10 additions and 1 deletions

View File

@ -103,6 +103,7 @@
bind:contextMenuEl={contextMenu}
target={meatballButtonEl}
headName={name}
seriesCount={branch.series?.length ?? 0}
{addDescription}
/>
</div>

View File

@ -13,10 +13,17 @@
contextMenuEl?: ReturnType<typeof ContextMenu>;
target?: HTMLElement;
headName: string;
seriesCount: number;
addDescription: () => void;
}
let { contextMenuEl = $bindable(), target, headName, addDescription }: Props = $props();
let {
contextMenuEl = $bindable(),
target,
seriesCount,
headName,
addDescription
}: Props = $props();
const branchStore = getContextStore(VirtualBranch);
const branchController = getContext(BranchController);
@ -48,6 +55,7 @@
/>
<ContextMenuItem
label="Delete"
disabled={seriesCount <= 1}
on:click={() => {
deleteSeriesModal.show(branch);
contextMenuEl?.close();