file solution fix

This commit is contained in:
rngsurrounded
2025-03-03 23:00:23 +09:00
parent bc0c24fa5a
commit 304704d392
2 changed files with 1 additions and 4 deletions
@@ -8,7 +8,6 @@ interface FileSolutionProps {
fileInputRef: React.RefObject<HTMLInputElement>; fileInputRef: React.RefObject<HTMLInputElement>;
existingFileUrl?: string | null; existingFileUrl?: string | null;
onClearExistingFile?: () => void; // New prop to clear existing file URL onClearExistingFile?: () => void; // New prop to clear existing file URL
firstSolution: boolean
} }
const FileSolution: React.FC<FileSolutionProps> = ({ const FileSolution: React.FC<FileSolutionProps> = ({
@@ -17,7 +16,6 @@ const FileSolution: React.FC<FileSolutionProps> = ({
fileInputRef, fileInputRef,
existingFileUrl = null, existingFileUrl = null,
onClearExistingFile, onClearExistingFile,
firstSolution
}) => { }) => {
const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => { const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {
if (event.target.files && event.target.files[0]) { if (event.target.files && event.target.files[0]) {
@@ -68,7 +66,7 @@ const FileSolution: React.FC<FileSolutionProps> = ({
? existingFileUrl.split('/').pop() || 'file' ? existingFileUrl.split('/').pop() || 'file'
: ''; : '';
const hasFile = !!selectedFile || (!!existingFileUrl && !firstSolution); const hasFile = !!selectedFile || !!existingFileUrl;
return ( return (
<> <>
@@ -149,7 +149,6 @@ const TaskSolution: React.FC<TaskSolutionProps> = ({
fileInputRef={fileInputRef} fileInputRef={fileInputRef}
existingFileUrl={selectedSolutionUrl} existingFileUrl={selectedSolutionUrl}
onClearExistingFile={handleClearExistingFile} onClearExistingFile={handleClearExistingFile}
firstSolution={solutionHistory.length > 0}
/> />
)} )}