From a966e9f753af25eb9d813dfdbce39be6f3014d82 Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Tue, 12 Nov 2024 14:39:57 -0800 Subject: [PATCH] Hide upload button after upload when `file_count="single"` (#9946) * format' * add changeset * add story --------- Co-authored-by: gradio-pr-bot Co-authored-by: Hannah --- .changeset/nice-rice-smash.md | 7 +++ js/file/shared/FileUpload.svelte | 32 +++++++------ .../MultimodalTextbox.stories.svelte | 14 ++++++ .../shared/MultimodalTextbox.svelte | 46 ++++++++++--------- 4 files changed, 62 insertions(+), 37 deletions(-) create mode 100644 .changeset/nice-rice-smash.md diff --git a/.changeset/nice-rice-smash.md b/.changeset/nice-rice-smash.md new file mode 100644 index 0000000000..d50ca87ff8 --- /dev/null +++ b/.changeset/nice-rice-smash.md @@ -0,0 +1,7 @@ +--- +"@gradio/file": patch +"@gradio/multimodaltextbox": patch +"gradio": patch +--- + +fix:Hide upload button after upload when `file_count="single"` diff --git a/js/file/shared/FileUpload.svelte b/js/file/shared/FileUpload.svelte index 11f1957390..051137b50d 100644 --- a/js/file/shared/FileUpload.svelte +++ b/js/file/shared/FileUpload.svelte @@ -61,21 +61,23 @@ {#if value && (Array.isArray(value) ? value.length > 0 : true)} - - - + {#if !(file_count === "single" && (Array.isArray(value) ? value.length > 0 : value !== null))} + + + + {/if} + diff --git a/js/multimodaltextbox/shared/MultimodalTextbox.svelte b/js/multimodaltextbox/shared/MultimodalTextbox.svelte index 4cf2e30ca3..6a10fc5edb 100644 --- a/js/multimodaltextbox/shared/MultimodalTextbox.svelte +++ b/js/multimodaltextbox/shared/MultimodalTextbox.svelte @@ -315,28 +315,30 @@ {/if}
- - + {#if !disabled && !(file_count === "single" && value.files.length > 0)} + + + {/if}