// frontend/components/dashboard/DashboardClient.tsx "use client"; import { useEffect, useRef, useState } from "react"; import { Icon } from "@/components/Icon"; import type { IconName } from "@/components/icons/paths"; import { useDashboard } from "@/lib/dashboard/useDashboard"; import { useProactive } from "@/lib/hooks/useProactive"; import { acceptProactive, dismissProactive } from "@/lib/proactive/api"; import { getWeeklyReview } from "@/lib/weekly/api"; import type { WeeklyReview as WeeklyReviewT } from "@/lib/types"; import { ProactiveBanner } from "@/components/proactive/ProactiveBanner"; import { WeeklyReview } from "@/components/weekly/WeeklyReview"; import { ApprovalSummaryCard } from "./ApprovalSummaryCard"; import { DashboardSkeleton } from "./DashboardSkeleton"; import { GoalsCard } from "./GoalsCard"; import { HeroBriefing } from "./HeroBriefing"; import { InboxSummaryCard } from "./InboxSummaryCard"; import { ScheduleCard } from "./ScheduleCard"; import { TaskSummaryCard } from "./TaskSummaryCard"; export function DashboardClient() { const { data, isLoading, error, mutate } = useDashboard(); const { data: proactive, refresh: refreshProactive } = useProactive(); const [weekly, setWeekly] = useState(null); const shellRef = useRef(null); useEffect(() => { let live = true; getWeeklyReview() .then((wr) => { if (live) setWeekly(wr); }) .catch(() => {}); return () => { live = false; }; }, []); const onAccept = async (id: string) => { try { await acceptProactive(id); } finally { refreshProactive(); } }; const onDismiss = async (id: string) => { try { await dismissProactive(id); } finally { refreshProactive(); } }; useEffect(() => { const el = shellRef.current; if (!el) return; const id = requestAnimationFrame(() => el.classList.add("entered")); return () => cancelAnimationFrame(id); }, [data]); if (isLoading) return ; if (error || !data) { return (

대시보드를 불러오지 못했어요.

); } const { user, briefing, saved_today, today_routed, schedule, task_summary, goals, approvals_summary, inbox_recent, badges, } = data; return (
{briefing.today} {briefing.weather.cond}

좋은 아침이에요, {user.name}님

{weekly && }
); }