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/project/ProjectDashboard.tsx | 103 +++++++++++++++++++++++++++++++-
1 file changed, 102 insertions(+), 1 deletion(-)
(limited to 'components/project/ProjectDashboard.tsx')
diff --git a/components/project/ProjectDashboard.tsx b/components/project/ProjectDashboard.tsx
index 5f8afb75..581b7b95 100644
--- a/components/project/ProjectDashboard.tsx
+++ b/components/project/ProjectDashboard.tsx
@@ -103,7 +103,9 @@ export function ProjectDashboard({ projectId }: ProjectDashboardProps) {
// Dialog states
const [addMemberOpen, setAddMemberOpen] = useState(false);
const [transferOwnershipOpen, setTransferOwnershipOpen] = useState(false);
+ const [deleteProjectOpen, setDeleteProjectOpen] = useState(false);
const [newOwnerId, setNewOwnerId] = useState('');
+ const [deleteConfirmText, setDeleteConfirmText] = useState('');
// User selection related states
const [availableUsers, setAvailableUsers] = useState([]);
@@ -256,6 +258,42 @@ export function ProjectDashboard({ projectId }: ProjectDashboardProps) {
}
};
+ // Delete project
+ const handleDeleteProject = async () => {
+ if (deleteConfirmText !== 'DELETE') {
+ toast({
+ title: 'Error',
+ description: 'Please type DELETE to confirm.',
+ variant: 'destructive',
+ });
+ return;
+ }
+
+ try {
+ const response = await fetch(`/api/projects/${projectId}`, {
+ method: 'DELETE',
+ });
+
+ if (!response.ok) {
+ throw new Error('Failed to delete project');
+ }
+
+ toast({
+ title: 'Success',
+ description: 'Project has been deleted.',
+ });
+
+ // 프로젝트 목록 페이지로 리다이렉트
+ window.location.href = '/evcp/data-room';
+ } catch (error) {
+ toast({
+ title: 'Error',
+ description: 'Failed to delete project.',
+ variant: 'destructive',
+ });
+ }
+ };
+
const formatBytes = (bytes: number) => {
if (bytes === 0) return '0 Bytes';
const k = 1024;
@@ -457,7 +495,10 @@ export function ProjectDashboard({ projectId }: ProjectDashboardProps) {
Permanently delete project and all files
-