From 2acf5f8966a40c1c9a97680c8dc263ee3f1ad3d1 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Wed, 2 Jul 2025 00:45:49 +0000 Subject: (대표님/최겸) 20250702 변경사항 업데이트 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/dashboard/dashboard-client.tsx | 115 +++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 lib/dashboard/dashboard-client.tsx (limited to 'lib/dashboard/dashboard-client.tsx') diff --git a/lib/dashboard/dashboard-client.tsx b/lib/dashboard/dashboard-client.tsx new file mode 100644 index 00000000..37dc1901 --- /dev/null +++ b/lib/dashboard/dashboard-client.tsx @@ -0,0 +1,115 @@ +"use client"; + +import { useState } from "react"; +import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; +import { Button } from "@/components/ui/button"; +import { RefreshCw } from "lucide-react"; +import { DashboardStatsCard } from "./dashboard-stats-card"; +import { DashboardOverviewChart } from "./dashboard-overview-chart"; +import { DashboardSummaryCards } from "./dashboard-summary-cards"; +import { toast } from "sonner"; +import { DashboardData } from "./service"; + +interface DashboardClientProps { + initialData: DashboardData; + onRefresh: () => Promise; +} + +export function DashboardClient({ initialData, onRefresh }: DashboardClientProps) { + const [data, setData] = useState(initialData); + const [isRefreshing, setIsRefreshing] = useState(false); + + + const handleRefresh = async () => { + try { + setIsRefreshing(true); + const newData = await onRefresh(); + setData(newData); + toast.success("대시보드 데이터가 새로고침되었습니다."); + } catch (error) { + toast.error("데이터 새로고침에 실패했습니다."); + console.error("Dashboard refresh error:", error); + } finally { + setIsRefreshing(false); + } + }; + + const getDomainDisplayName = (domain: string) => { + const domainNames: Record = { + 'procurement': '구매 관리', + 'sales': '영업 관리', + "partners": 'Partners', + 'engineering': '엔지니어링' + }; + return domainNames[domain] || domain; + }; + + return ( +
+ {/* 헤더 */} +
+
+

+ {getDomainDisplayName(data.domain)} Dashboard +

+

+ {data.domain ==="partners"? "회사와 개인에게 할당된 일들을 보여줍니다.":"팀과 개인에게 할당된 일들을 보여줍니다."} +

+
+ +
+ + {/* 요약 카드 */} + + + {/* 차트 */} + + + {/* 탭 */} + + + {data.domain ==="partners"? "회사 업무 현황":"팀 업무 현황"} + 내 업무 현황 + + + +
+ {data.teamStats.map((stats) => ( + + ))} +
+
+ + +
+ {data.userStats.map((stats) => ( + + ))} +
+
+
+
+ ); +} \ No newline at end of file -- cgit v1.2.3