From 515b0515875c536202a674e05a2e22b9c4c69de1 Mon Sep 17 00:00:00 2001 From: rngsurrounded Date: Mon, 3 Mar 2025 20:55:17 +0900 Subject: [PATCH] last ssolution fixes --- .../TaskSolution/components/FileSolution/index.tsx | 9 ++++----- .../CompetitionSession/modules/TaskSolution/index.tsx | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/components/FileSolution/index.tsx b/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/components/FileSolution/index.tsx index b7d351b..59c883e 100644 --- a/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/components/FileSolution/index.tsx +++ b/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/components/FileSolution/index.tsx @@ -8,6 +8,7 @@ interface FileSolutionProps { fileInputRef: React.RefObject; existingFileUrl?: string | null; onClearExistingFile?: () => void; // New prop to clear existing file URL + firstSolution: boolean } const FileSolution: React.FC = ({ @@ -15,7 +16,8 @@ const FileSolution: React.FC = ({ setSelectedFile, fileInputRef, existingFileUrl = null, - onClearExistingFile + onClearExistingFile, + firstSolution }) => { const handleFileChange = (event: React.ChangeEvent) => { if (event.target.files && event.target.files[0]) { @@ -59,9 +61,6 @@ const FileSolution: React.FC = ({ } }; - const handleSelectNewFile = () => { - fileInputRef.current?.click(); - }; const fileName = selectedFile ? selectedFile.name @@ -69,7 +68,7 @@ const FileSolution: React.FC = ({ ? existingFileUrl.split('/').pop() || 'file' : ''; - const hasFile = !!selectedFile || !!existingFileUrl; + const hasFile = !!selectedFile || (!!existingFileUrl && !firstSolution); return ( <> diff --git a/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/index.tsx b/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/index.tsx index 2b1c8d1..e7233d5 100644 --- a/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/index.tsx +++ b/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/index.tsx @@ -140,6 +140,7 @@ fileInputRef={fileInputRef} existingFileUrl={selectedSolutionUrl} onClearExistingFile={handleClearExistingFile} + firstSolution={solutionHistory.length > 0} /> )}