From f477d8d277a3c618f4dfbe9f19a47a5fa770d900 Mon Sep 17 00:00:00 2001 From: Meesayen Date: Sat, 17 Feb 2024 13:23:13 +0100 Subject: [PATCH] chore: disable discard button for binary files for now --- .../src/lib/components/FileContextMenu.svelte | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gitbutler-ui/src/lib/components/FileContextMenu.svelte b/gitbutler-ui/src/lib/components/FileContextMenu.svelte index f8b94267b..a8b079a12 100644 --- a/gitbutler-ui/src/lib/components/FileContextMenu.svelte +++ b/gitbutler-ui/src/lib/components/FileContextMenu.svelte @@ -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 @@ {#if item.files !== undefined} - confirmationModal.show(item)} /> + {#if containsBinaryFiles(item)} + + {:else} + confirmationModal.show(item)} /> + {/if} {/if}