From db5d243fb10041fd2db5022504cbf65241308359 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=99=8D=EC=B0=BD=EA=B8=B0?= Date: Mon, 30 Sep 2024 14:05:41 +0900 Subject: [PATCH 1/3] =?UTF-8?q?Refactor:=20=ED=95=84=EC=9A=94=EC=97=86?= =?UTF-8?q?=EB=8A=94=20console=20=EC=B6=9C=EB=A0=A5=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/WorkspaceDropdownMenu/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/components/WorkspaceDropdownMenu/index.tsx b/frontend/src/components/WorkspaceDropdownMenu/index.tsx index f6c836e..c77eaa5 100644 --- a/frontend/src/components/WorkspaceDropdownMenu/index.tsx +++ b/frontend/src/components/WorkspaceDropdownMenu/index.tsx @@ -45,7 +45,6 @@ export default function WorkspaceDropdownMenu({ }; const handleFileCount = (fileCount: number) => { - console.log(fileCount); setFileCount(fileCount); }; From 8fbc2b92213901fdf6c3ea50e688065080d13fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=99=8D=EC=B0=BD=EA=B8=B0?= Date: Mon, 30 Sep 2024 14:11:54 +0900 Subject: [PATCH 2/3] =?UTF-8?q?Fix:=20=EA=B0=99=EC=9D=80=20=ED=8F=B4?= =?UTF-8?q?=EB=8D=94=20=EB=8B=A4=EC=8B=9C=20=EC=B6=94=EA=B0=80=ED=95=98?= =?UTF-8?q?=EB=A9=B4=20=EC=84=A0=ED=83=9D=20=EC=95=88=EB=90=98=EB=8A=94=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95,=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=20=EB=AA=A9=EB=A1=9D=20=EB=8C=80=EC=8B=A0=20=ED=8F=B4=EB=8D=94?= =?UTF-8?q?=20=EC=9D=B4=EB=A6=84=EB=A7=8C=20=EB=B3=B4=EC=9D=B4=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ImageUploadFolderForm.tsx | 88 +++++++++---------- 1 file changed, 42 insertions(+), 46 deletions(-) diff --git a/frontend/src/components/ImageUploadFolderModal/ImageUploadFolderForm.tsx b/frontend/src/components/ImageUploadFolderModal/ImageUploadFolderForm.tsx index aaaae3a..be704f9 100644 --- a/frontend/src/components/ImageUploadFolderModal/ImageUploadFolderForm.tsx +++ b/frontend/src/components/ImageUploadFolderModal/ImageUploadFolderForm.tsx @@ -20,6 +20,7 @@ export default function ImageUploadFolderForm({ const memberId = profile?.id || 0; const [files, setFiles] = useState([]); + const [inputKey, setInputKey] = useState(0); const [isDragging, setIsDragging] = useState(false); const [isUploading, setIsUploading] = useState(false); const [isUploaded, setIsUploaded] = useState(false); @@ -44,8 +45,6 @@ export default function ImageUploadFolderForm({ if (newFiles) { setFiles((prevFiles) => [...prevFiles, ...Array.from(newFiles)]); } - - event.target.value = ''; }; const handleDragOver = (event: React.DragEvent) => { @@ -62,8 +61,9 @@ export default function ImageUploadFolderForm({ setIsDragging(false); }; - const handleRemoveFile = (index: number) => { - setFiles(files.filter((_, i) => i != index)); + const handleRemoveFile = () => { + setFiles([]); + setInputKey((prevKey) => prevKey + 1); }; const handleUpload = async () => { @@ -101,6 +101,7 @@ export default function ImageUploadFolderForm({ )} > )} {files.length > 0 && ( -
    - {files.map((file, index) => ( -
  • - {file.webkitRelativePath || file.name} - {isUploading ? ( -
    - {isUploaded ? ( - - ) : isFailed ? ( - - ) : ( - - )} -
    +
    + + {files[0].webkitRelativePath.substring(0, files[0].webkitRelativePath.indexOf('/'))} {} + + {isUploading ? ( +
    + {isUploaded ? ( + + ) : isFailed ? ( + ) : ( - + )} -
  • - ))} -
+ + ) : ( + + )} + )} {isUploading ? ( + )} + + )} + {isUploading ? ( + + ) : ( + + )} + + ); +} diff --git a/frontend/src/components/ImageUploadFolderFileModal/index.tsx b/frontend/src/components/ImageUploadFolderFileModal/index.tsx new file mode 100644 index 0000000..73992b9 --- /dev/null +++ b/frontend/src/components/ImageUploadFolderFileModal/index.tsx @@ -0,0 +1,35 @@ +import React from 'react'; +import { Dialog, DialogContent, DialogHeader, DialogTrigger } from '../ui/dialogCustom'; +import { Plus } from 'lucide-react'; +import ImageUploadFolderFileForm from './ImageUploadFolderFileForm'; + +export default function ImageUploadFolderFileModal({ projectId, folderId }: { projectId: number; folderId: number }) { + const [isOpen, setIsOpen] = React.useState(false); + + const handleOpen = () => setIsOpen(true); + const handleClose = () => setIsOpen(false); + + return ( + + + + + + + + + + ); +} diff --git a/frontend/src/components/ImageUploadFolderModal/index.tsx b/frontend/src/components/ImageUploadFolderModal/index.tsx index 2bfbd72..d07494d 100644 --- a/frontend/src/components/ImageUploadFolderModal/index.tsx +++ b/frontend/src/components/ImageUploadFolderModal/index.tsx @@ -23,7 +23,7 @@ export default function ImageUploadFolderModal({ projectId, folderId }: { projec - + (false); const [fileCount, setFileCount] = React.useState(0); + const [isOpenUploadFolderFile, setIsOpenUploadFolderFile] = React.useState(false); const [isOpenUploadFolder, setIsOpenUploadFolder] = React.useState(false); const [isOpenUploadZip, setIsOpenUploadZip] = React.useState(false); @@ -32,6 +34,12 @@ export default function WorkspaceDropdownMenu({ setIsOpenUploadFile(false); }; + const handleOpenUploadFolderFile = () => setIsOpenUploadFolderFile(true); + + const handleCloseUploadFolderFile = () => { + setIsOpenUploadFolderFile(false); + }; + const handleOpenUploadFolder = () => setIsOpenUploadFolder(true); const handleCloseUploadFolder = () => { @@ -67,7 +75,8 @@ export default function WorkspaceDropdownMenu({ 파일 업로드 - 폴더 업로드 (임시) + 폴더 업로드 (파일 업로드 API 이용) + 폴더 업로드 (백엔드 구현 필요) 폴더 압축파일 업로드 @@ -89,13 +98,29 @@ export default function WorkspaceDropdownMenu({ + + + + + + + + - + void; + }) => uploadImageFolderFile(memberId, projectId, folderId, files, progressCallback), + }); +}