From dfba5d2e2d0d110c5a05e6933447f8d3b1ca5238 Mon Sep 17 00:00:00 2001 From: sudipnext Date: Wed, 8 Apr 2026 09:31:55 +0545 Subject: [PATCH] refactor: Remove unused status panel and script from homepage; add file limit handling in SupportingDoc component --- electron/resources/ui/homepage/index.html | 150 ------------------ .../upload/components/SupportingDoc.tsx | 18 ++- 2 files changed, 16 insertions(+), 152 deletions(-) diff --git a/electron/resources/ui/homepage/index.html b/electron/resources/ui/homepage/index.html index 1bca9ddb..495af613 100644 --- a/electron/resources/ui/homepage/index.html +++ b/electron/resources/ui/homepage/index.html @@ -4,7 +4,6 @@ Presenton - @@ -160,23 +27,6 @@ Presenton Logo

Just a moment...

- -
-
- - Dependencies -
-
-
- LibreOffice - Checking... -
-
- Chromium - Checking... -
-
-
\ No newline at end of file diff --git a/electron/servers/nextjs/app/(presentation-generator)/upload/components/SupportingDoc.tsx b/electron/servers/nextjs/app/(presentation-generator)/upload/components/SupportingDoc.tsx index 54ca830c..6f013ec0 100644 --- a/electron/servers/nextjs/app/(presentation-generator)/upload/components/SupportingDoc.tsx +++ b/electron/servers/nextjs/app/(presentation-generator)/upload/components/SupportingDoc.tsx @@ -11,6 +11,8 @@ interface SupportingDocProps { multiple?: boolean } +const MAX_SUPPORTED_FILES = 8 + const PDF_TYPES = ['.pdf'] const TEXT_TYPES = ['.txt'] const WORD_TYPES = ['.doc', '.docx', '.docm', '.odt', '.rtf'] @@ -93,12 +95,24 @@ const SupportingDoc = ({ } } + const applyFileLimit = (candidateFiles: File[]) => { + if (candidateFiles.length <= MAX_SUPPORTED_FILES) { + return candidateFiles + } + + toast.warning('Maximum file limit reached', { + description: `You can upload up to ${MAX_SUPPORTED_FILES} documents only.`, + }) + + return candidateFiles.slice(0, MAX_SUPPORTED_FILES) + } + const handleFilesSelected = (e: ChangeEvent) => { const selectedFiles = Array.from(e.target.files ?? []) if (selectedFiles.length === 0) return const nextFiles = multiple ? [...files, ...selectedFiles] : [selectedFiles[0]] - const allowedFiles = nextFiles.filter(isAllowedFile) + const allowedFiles = applyFileLimit(nextFiles.filter(isAllowedFile)) onFilesChange(allowedFiles) handleValidate(nextFiles) @@ -118,7 +132,7 @@ const SupportingDoc = ({ if (droppedFiles.length === 0) return const nextFiles = multiple ? [...files, ...droppedFiles] : [droppedFiles[0]] - const allowedFiles = nextFiles.filter(isAllowedFile) + const allowedFiles = applyFileLimit(nextFiles.filter(isAllowedFile)) onFilesChange(allowedFiles) handleValidate(nextFiles)