chore: disable discard button for binary files for now

This commit is contained in:
Meesayen 2024-02-17 13:23:13 +01:00
parent 7023e43806
commit f477d8d277

View File

@ -6,11 +6,16 @@
import ContextMenuItem from '$lib/components/contextmenu/ContextMenuItem.svelte';
import ContextMenuSection from '$lib/components/contextmenu/ContextMenuSection.svelte';
import type { BranchController } from '$lib/vbranches/branchController';
import type { AnyFile } from '$lib/vbranches/types';
export let branchController: BranchController;
let confirmationModal: Modal;
let popupMenu: PopupMenu;
function containsBinaryFiles(item: any) {
return item.files.some((f: AnyFile) => f.binary);
}
export function openByMouse(e: MouseEvent, item: any) {
popupMenu.openByMouse(e, item);
}
@ -20,7 +25,11 @@
<ContextMenu>
<ContextMenuSection>
{#if item.files !== undefined}
<ContextMenuItem label="Discard" on:click={() => confirmationModal.show(item)} />
{#if containsBinaryFiles(item)}
<ContextMenuItem label="Discard (Binary files not yet supported)" disabled />
{:else}
<ContextMenuItem label="Discard" on:click={() => confirmationModal.show(item)} />
{/if}
{/if}
</ContextMenuSection>
</ContextMenu>