last ssolution fixes

This commit is contained in:
rngsurrounded
2025-03-03 20:55:17 +09:00
parent 1d340b798c
commit 515b051587
2 changed files with 5 additions and 5 deletions
@@ -8,6 +8,7 @@ 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> = ({
@@ -15,7 +16,8 @@ const FileSolution: React.FC<FileSolutionProps> = ({
setSelectedFile, setSelectedFile,
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]) {
@@ -59,9 +61,6 @@ const FileSolution: React.FC<FileSolutionProps> = ({
} }
}; };
const handleSelectNewFile = () => {
fileInputRef.current?.click();
};
const fileName = selectedFile const fileName = selectedFile
? selectedFile.name ? selectedFile.name
@@ -69,7 +68,7 @@ const FileSolution: React.FC<FileSolutionProps> = ({
? existingFileUrl.split('/').pop() || 'file' ? existingFileUrl.split('/').pop() || 'file'
: ''; : '';
const hasFile = !!selectedFile || !!existingFileUrl; const hasFile = !!selectedFile || (!!existingFileUrl && !firstSolution);
return ( return (
<> <>
@@ -140,6 +140,7 @@
fileInputRef={fileInputRef} fileInputRef={fileInputRef}
existingFileUrl={selectedSolutionUrl} existingFileUrl={selectedSolutionUrl}
onClearExistingFile={handleClearExistingFile} onClearExistingFile={handleClearExistingFile}
firstSolution={solutionHistory.length > 0}
/> />
)} )}