Merge branch 'fe/refactor/improve-design' into 'fe/develop'

Refactor: 업로드 관련 디자인 개선 및 리팩토링

See merge request s11-s-project/S11P21S002!288
This commit is contained in:
정현조 2024-10-04 14:40:07 +09:00
commit dcb016d41b
4 changed files with 62 additions and 40 deletions

View File

@ -6,7 +6,7 @@ import ImageUploadPresingedForm from '@/components/ImageUploadPresignedModal/Ima
export default function ImageUploadPresignedModal({ projectId, folderId }: { projectId: number; folderId: number }) { export default function ImageUploadPresignedModal({ projectId, folderId }: { projectId: number; folderId: number }) {
const [isOpen, setIsOpen] = React.useState(false); const [isOpen, setIsOpen] = React.useState(false);
const [fileCount, setFileCount] = React.useState<number>(0); const [fileCount, setFileCount] = React.useState<number>(0);
const handleOpen = () => setIsOpen(true); const handleOpen = () => setIsOpen(true);
const handleClose = () => setIsOpen(false); const handleClose = () => setIsOpen(false);
const handleFileCount = (fileCount: number) => { const handleFileCount = (fileCount: number) => {
@ -27,7 +27,7 @@ export default function ImageUploadPresignedModal({ projectId, folderId }: { pro
</button> </button>
</DialogTrigger> </DialogTrigger>
<DialogContent className="max-w-2xl"> <DialogContent className="max-w-2xl">
<DialogHeader title={fileCount > 0 ? `파일 업로드 (${fileCount}) PreSigned` : '파일 업로드 PreSigned'} /> <DialogHeader title={fileCount > 0 ? `파일 업로드 PreSigned (${fileCount})` : '파일 업로드 PreSigned'} />
<ImageUploadPresingedForm <ImageUploadPresingedForm
onClose={handleClose} onClose={handleClose}
onFileCount={handleFileCount} onFileCount={handleFileCount}

View File

@ -169,9 +169,19 @@ export default function ProjectCreateForm({ onSubmit }: { onSubmit: (data: Proje
<div className="mb-1 flex w-full flex-col gap-2"> <div className="mb-1 flex w-full flex-col gap-2">
<div className="body-strong"></div> <div className="body-strong"></div>
<Tabs defaultValue="manual"> <Tabs defaultValue="manual">
<TabsList className="mb-4"> <TabsList className="mb-4 rounded-none border-transparent bg-transparent shadow-none">
<TabsTrigger value="manual"> </TabsTrigger> <TabsTrigger
<TabsTrigger value="file"> </TabsTrigger> value="manual"
className="rounded-none border-b-2 border-transparent bg-transparent shadow-none data-[state=active]:border-blue-500 data-[state=active]:shadow-none"
>
</TabsTrigger>
<TabsTrigger
value="file"
className="rounded-none border-b-2 border-transparent bg-transparent shadow-none data-[state=active]:border-blue-500 data-[state=active]:shadow-none"
>
</TabsTrigger>
</TabsList> </TabsList>
<TabsContent value="manual"> <TabsContent value="manual">
<div className="mt-2 flex gap-2"> <div className="mt-2 flex gap-2">
@ -192,7 +202,7 @@ export default function ProjectCreateForm({ onSubmit }: { onSubmit: (data: Proje
<TabsContent value="file"> <TabsContent value="file">
<div <div
className={cn( className={cn(
'mt-2 flex w-full items-center justify-center rounded-lg border-2 border-dashed p-5 text-center transition-colors', 'mt-2 flex h-40 w-full items-center justify-center rounded-lg border-2 border-dashed p-5 text-center transition-colors',
isDragging ? 'border-blue-500 bg-blue-100' : 'border-gray-300 bg-gray-100' isDragging ? 'border-blue-500 bg-blue-100' : 'border-gray-300 bg-gray-100'
)} )}
onDragOver={handleDragOver} onDragOver={handleDragOver}
@ -200,9 +210,15 @@ export default function ProjectCreateForm({ onSubmit }: { onSubmit: (data: Proje
onDrop={(event) => handleDrop(event, field.onChange)} onDrop={(event) => handleDrop(event, field.onChange)}
onClick={() => fileInputRef.current?.click()} onClick={() => fileInputRef.current?.click()}
> >
<p className="text-gray-500"> {isDragging ? (
. <p className="text-primary"> </p>
</p> ) : (
<p className="text-gray-500">
<br />
.
</p>
)}
<input <input
type="file" type="file"
ref={fileInputRef} ref={fileInputRef}

View File

@ -30,7 +30,6 @@ export default function WorkspaceBrowseLayout() {
}; };
const workspaces = workspacesResponse?.workspaceResponses ?? []; const workspaces = workspacesResponse?.workspaceResponses ?? [];
console.log(workspaces);
return ( return (
<> <>

View File

@ -12,7 +12,7 @@ import ImageUploadFileForm from '../ImageUploadFileModal/ImageUploadFileForm';
import ImageUploadFolderFileForm from '../ImageUploadFolderFileModal/ImageUploadFolderFileForm'; import ImageUploadFolderFileForm from '../ImageUploadFolderFileModal/ImageUploadFolderFileForm';
import ImageUploadFolderForm from '../ImageUploadFolderModal/ImageUploadFolderForm'; import ImageUploadFolderForm from '../ImageUploadFolderModal/ImageUploadFolderForm';
import ImageUploadZipForm from '../ImageUploadZipModal/ImageUploadZipForm'; import ImageUploadZipForm from '../ImageUploadZipModal/ImageUploadZipForm';
import ImageUploadPresignedForm from '../ImageUploadPresignedModal/ImageUploadPresignedForm.tsx' import ImageUploadPresignedForm from '../ImageUploadPresignedModal/ImageUploadPresignedForm.tsx';
export default function WorkspaceDropdownMenu({ export default function WorkspaceDropdownMenu({
projectId, projectId,
@ -25,9 +25,10 @@ export default function WorkspaceDropdownMenu({
}) { }) {
const [isOpenUploadFile, setIsOpenUploadFile] = React.useState<boolean>(false); const [isOpenUploadFile, setIsOpenUploadFile] = React.useState<boolean>(false);
const [fileCount, setFileCount] = React.useState<number>(0); const [fileCount, setFileCount] = React.useState<number>(0);
const [isOpenUploadPresigned, setIsOpenUploadPresigned] = React.useState<boolean>(false);
const [presignedCount, setPresignedCount] = React.useState<number>(0);
const [isOpenUploadFolderFile, setIsOpenUploadFolderFile] = React.useState<boolean>(false); const [isOpenUploadFolderFile, setIsOpenUploadFolderFile] = React.useState<boolean>(false);
const [isOpenUploadFolder, setIsOpenUploadFolder] = React.useState<boolean>(false); const [isOpenUploadFolder, setIsOpenUploadFolder] = React.useState<boolean>(false);
const [isOpenUploadPresigned, setIsOpenUploadPresigned] = React.useState<boolean>(false);
const [isOpenUploadZip, setIsOpenUploadZip] = React.useState<boolean>(false); const [isOpenUploadZip, setIsOpenUploadZip] = React.useState<boolean>(false);
const handleOpenUploadFile = () => setIsOpenUploadFile(true); const handleOpenUploadFile = () => setIsOpenUploadFile(true);
@ -36,6 +37,20 @@ export default function WorkspaceDropdownMenu({
setIsOpenUploadFile(false); setIsOpenUploadFile(false);
}; };
const handleFileCount = (fileCount: number) => {
setFileCount(fileCount);
};
const handleOpenUploadPresigned = () => setIsOpenUploadPresigned(true);
const handleCloseUploadPresigned = () => {
setIsOpenUploadPresigned(false);
};
const handlePresignedCount = (fileCount: number) => {
setPresignedCount(fileCount);
};
const handleOpenUploadFolderFile = () => setIsOpenUploadFolderFile(true); const handleOpenUploadFolderFile = () => setIsOpenUploadFolderFile(true);
const handleCloseUploadFolderFile = () => { const handleCloseUploadFolderFile = () => {
@ -48,22 +63,12 @@ export default function WorkspaceDropdownMenu({
setIsOpenUploadFolder(false); setIsOpenUploadFolder(false);
}; };
const handleOpenUploadPresigned = () => setIsOpenUploadPresigned(true);
const handleCloseUploadPresigned = () => {
setIsOpenUploadPresigned(false);
};
const handleOpenUploadZip = () => setIsOpenUploadZip(true); const handleOpenUploadZip = () => setIsOpenUploadZip(true);
const handleCloseUploadZip = () => { const handleCloseUploadZip = () => {
setIsOpenUploadZip(false); setIsOpenUploadZip(false);
}; };
const handleFileCount = (fileCount: number) => {
setFileCount(fileCount);
};
return ( return (
<> <>
<DropdownMenu> <DropdownMenu>
@ -83,9 +88,9 @@ export default function WorkspaceDropdownMenu({
</DropdownMenuItem> </DropdownMenuItem>
<DropdownMenuSeparator /> <DropdownMenuSeparator />
<DropdownMenuItem onClick={handleOpenUploadFile}> </DropdownMenuItem> <DropdownMenuItem onClick={handleOpenUploadFile}> </DropdownMenuItem>
<DropdownMenuItem onClick={handleOpenUploadPresigned}> (PresignedUrl )</DropdownMenuItem>
<DropdownMenuItem onClick={handleOpenUploadFolderFile}> ( API )</DropdownMenuItem> <DropdownMenuItem onClick={handleOpenUploadFolderFile}> ( API )</DropdownMenuItem>
<DropdownMenuItem onClick={handleOpenUploadFolder}> ( )</DropdownMenuItem> <DropdownMenuItem onClick={handleOpenUploadFolder}> ( )</DropdownMenuItem>
<DropdownMenuItem onClick={handleOpenUploadPresigned}> (PresignedUrl )</DropdownMenuItem>
<DropdownMenuItem onClick={handleOpenUploadZip}> </DropdownMenuItem> <DropdownMenuItem onClick={handleOpenUploadZip}> </DropdownMenuItem>
</DropdownMenuContent> </DropdownMenuContent>
</DropdownMenu> </DropdownMenu>
@ -107,6 +112,25 @@ export default function WorkspaceDropdownMenu({
</DialogContent> </DialogContent>
</Dialog> </Dialog>
<Dialog
open={isOpenUploadPresigned}
onOpenChange={setIsOpenUploadPresigned}
>
<DialogTrigger asChild></DialogTrigger>
<DialogContent className="max-w-2xl">
<DialogHeader
title={presignedCount > 0 ? `파일 업로드 PreSigned (${presignedCount})` : '파일 업로드 PreSigned'}
/>
<ImageUploadPresignedForm
onClose={handleCloseUploadPresigned}
onRefetch={onRefetch}
onFileCount={handlePresignedCount}
projectId={projectId}
folderId={folderId}
/>
</DialogContent>
</Dialog>
<Dialog <Dialog
open={isOpenUploadFolderFile} open={isOpenUploadFolderFile}
onOpenChange={setIsOpenUploadFolderFile} onOpenChange={setIsOpenUploadFolderFile}
@ -139,23 +163,6 @@ export default function WorkspaceDropdownMenu({
</DialogContent> </DialogContent>
</Dialog> </Dialog>
<Dialog
open={isOpenUploadPresigned}
onOpenChange={setIsOpenUploadPresigned}
>
<DialogTrigger asChild></DialogTrigger>
<DialogContent className="max-w-2xl">
<DialogHeader title='파일 업로드' />
<ImageUploadPresignedForm
onClose={handleCloseUploadPresigned}
onRefetch={onRefetch}
onFileCount={handleFileCount}
projectId={projectId}
folderId={folderId}
/>
</DialogContent>
</Dialog>
<Dialog <Dialog
open={isOpenUploadZip} open={isOpenUploadZip}
onOpenChange={setIsOpenUploadZip} onOpenChange={setIsOpenUploadZip}