From b9a2081a76e669688d5884f20482b37cc8acca22 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Mon, 13 Oct 2025 08:56:27 +0000 Subject: (최겸, 임수민) 구매 입찰, 견적(그룹코드, tbe에러) 수정, data-room 수정 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/file-manager/FileManager.tsx | 100 ++++++++++++++++++++++--------- components/layout/Footer.tsx | 13 +++- components/project/ProjectDashboard.tsx | 103 +++++++++++++++++++++++++++++++- components/project/ProjectList.tsx | 37 ++++++++---- components/project/ProjectNav.tsx | 2 + 5 files changed, 212 insertions(+), 43 deletions(-) (limited to 'components') diff --git a/components/file-manager/FileManager.tsx b/components/file-manager/FileManager.tsx index 587beb22..fa2d8c38 100644 --- a/components/file-manager/FileManager.tsx +++ b/components/file-manager/FileManager.tsx @@ -335,7 +335,7 @@ export function FileManager({ projectId }: FileManagerProps) { const [searchQuery, setSearchQuery] = useState(''); const [loading, setLoading] = useState(false); - console.log(items,"items") + console.log(items, "items") // Upload states const [uploadDialogOpen, setUploadDialogOpen] = useState(false); @@ -754,9 +754,9 @@ export function FileManager({ projectId }: FileManagerProps) { // View file with PDFTron const viewFile = async (file: FileItem) => { try { - - + + setViewerFileUrl(file.filePath); setSelectedFile(file); setViewerDialogOpen(true); @@ -991,7 +991,16 @@ export function FileManager({ projectId }: FileManagerProps) { - @@ -744,6 +785,66 @@ export function ProjectDashboard({ projectId }: ProjectDashboardProps) { + + {/* Delete Project Dialog */} + { + setDeleteProjectOpen(open); + if (!open) setDeleteConfirmText(''); + }}> + + + Delete Project + + This action cannot be undone. This will permanently delete the project and all associated files. + + + +
+
+

Warning

+
    +
  • All files will be permanently deleted
  • +
  • All project members will lose access
  • +
  • All sharing links will be invalidated
  • +
  • This action cannot be reversed
  • +
+
+ +
+ + setDeleteConfirmText(e.target.value)} + className="font-mono" + /> +
+
+ + + + + +
+
); } \ No newline at end of file diff --git a/components/project/ProjectList.tsx b/components/project/ProjectList.tsx index 9dec7e77..e267b21c 100644 --- a/components/project/ProjectList.tsx +++ b/components/project/ProjectList.tsx @@ -98,20 +98,31 @@ export function ProjectList() { fetchProjects(); }, []); - const fetchProjects = async () => { - try { - const response = await fetch('/api/projects'); - const data = await response.json(); - setProjects(data); - } catch (error) { - toast({ - title: 'Error', - description: 'Unable to load project list.', - variant: 'destructive', - }); +// components/project/ProjectList.tsx 의 fetchProjects 함수 수정 + +const fetchProjects = async () => { + try { + const response = await fetch('/api/projects'); + const data = await response.json(); + setProjects(data); + + // 멤버인 프로젝트가 정확히 1개일 때 자동 리다이렉트 + const memberProjects = data.member || []; + const ownedProjects = data.owned || []; + const totalProjects = [...memberProjects, ...ownedProjects]; + + if (totalProjects.length === 1) { + const singleProject = totalProjects[0]; + router.push(`/evcp/data-room/${singleProject.id}/files`); } - }; - + } catch (error) { + toast({ + title: 'Error', + description: 'Unable to load project list.', + variant: 'destructive', + }); + } +}; const onSubmit = async (data: ProjectFormData) => { setIsSubmitting(true); try { diff --git a/components/project/ProjectNav.tsx b/components/project/ProjectNav.tsx index aac934ad..c62f760e 100644 --- a/components/project/ProjectNav.tsx +++ b/components/project/ProjectNav.tsx @@ -59,6 +59,7 @@ export function ProjectNav({ projectId }: ProjectNavProps) { }; console.log(pathname, projectId) + console.log(projectRole, "projectRole") const navItems = [ { @@ -66,6 +67,7 @@ export function ProjectNav({ projectId }: ProjectNavProps) { icon: Home, href: `/evcp/data-room/${projectId}`, active: pathname === `/${lng}/evcp/data-room/${projectId}`, + requireRole: ['owner', 'admin'], }, { label: 'Files', -- cgit v1.2.3