"use client" /** * DashboardTabs — three-view dashboard switcher * * Report — full KPI + charts view (current dashboard) * Simple — Promo · Greeting · Onboarding gallery · Tasks · Insights · Recent · Learn * Mix — compact metrics + key chart + tasks & activity side-by-side */ import * as React from "react" import { Card, CardContent, CardHeader, CardDescription } from "@/components/ui/card" import { TintedIconDisc, type TintedIconDiscTone } from "@/components/tinted-icon-disc" import { Separator } from "@/components/ui/separator" import { KeyMetrics, type MetricItem, type MetricInsight } from "@/components/key-metrics" import type { ChartCardVariant } from "@/components/charts-overview" import { DashboardReportCharts } from "@/components/dashboard-report-charts" import { GettingStarted, GettingStartedProgressCard } from "@/components/onboarding/getting-started" import { TaskListPanel, type TaskListItem } from "@/components/task-list-panel" import { PageHeader } from "@/components/page-header" import { useDashboardView } from "@/contexts/dashboard-view-context" import { useChartVariant } from "@/contexts/chart-variant-context" import { useAskLeo, useAskLeoPageContext } from "@/components/ask-leo-sidebar" import { cn } from "@/lib/utils" import { DashboardSectionTitle, dashboardSectionDescriptionClassName, } from "@/components/dashboard-section-heading" import { DashboardPromoBanner } from "@/components/dashboard-promo-banner" import { CoachMark } from "@/components/ui/coach-mark" import { useCoachMark } from "@/hooks/use-coach-mark" import { formatDateFromDate } from "@/lib/date-filter" /* ── Types passed from the page ─────────────────────────────────────────── */ interface DashboardTabsProps { metrics: MetricItem[] insight: MetricInsight title?: string subtitle?: string } /* ════════════════════════════════════════════════════════════════════════════ SIMPLE TAB — widgets ════════════════════════════════════════════════════════════════════════════ */ /* ── Greeting ─────────────────────────────────────────────────────────────── */ function GreetingWidget({ compact = false }: { compact?: boolean }) { const [now, setNow] = React.useState(null) React.useEffect(() => { setNow(new Date()) }, []) const hour = now?.getHours() ?? 9 const greeting = hour < 12 ? "Good morning" : hour < 17 ? "Good afternoon" : "Good evening" return (
{!compact ? (

{now ? formatDateFromDate(now) : ""}

) : null} {compact ? (

{greeting}, Himanshu 👋

) : (

{greeting}, Himanshu 👋

)} {!compact ? (

You have 8 reviews pending and{" "} 23 requests waiting today.

) : null}
) } /* ── Tasks ────────────────────────────────────────────────────────────────── */ const TASK_ITEMS: TaskListItem[] = [ { id: 1, label: "Review pending evaluations", due: "Today", priority: "high", done: false }, { id: 2, label: "Approve site contract — City Med", due: "Today", priority: "high", done: false }, { id: 3, label: "Send onboarding docs to PT cohort", due: "Tomorrow", priority: "medium", done: false }, { id: 4, label: "Update compliance checklist", due: "03/25/2026", priority: "medium", done: false }, { id: 5, label: "Schedule supervisor training", due: "03/28/2026", priority: "low", done: true }, ] /* ── Insights ─────────────────────────────────────────────────────────────── */ const INSIGHTS: { id: number icon: string tone: TintedIconDiscTone title: string body: string }[] = [ { id: 1, icon: "fa-arrow-trend-up", tone: "chart-2", title: "Placement rate up 12%", body: "Nursing placements increased compared to last quarter. Site capacity utilisation at 94%.", }, { id: 2, icon: "fa-triangle-exclamation", tone: "chart-4", title: "Review backlog growing", body: "8 evaluations have been pending for more than 48 hrs. Clear them to unblock new requests.", }, { id: 3, icon: "fa-certificate", tone: "brand", title: "Compliance milestone", body: "Nursing program reached 98% compliance — highest in 12 months.", }, ] function InsightsWidget({ plain = false }: { plain?: boolean }) { /* Glow applied — AI surface (rule 1). See GLOW GUIDELINE in key-metrics.tsx */ const glowStyle = { background: "radial-gradient(ellipse 120% 80% at 50% 100%, oklch(from var(--brand-color) l c h / 0.14) 0%, transparent 65%)", } as const const items = INSIGHTS.map((ins, idx) => (

{ins.title}

{ins.body}

{plain && idx < INSIGHTS.length - 1 ? (
)) if (plain) { return (
Insights

AI-generated · Updated now

{items}
) } return ( Insights AI-generated · Updated now {INSIGHTS.map((ins) => (

{ins.title}

{ins.body}

))}
) } /* ── Recent Activity ──────────────────────────────────────────────────────── */ const ACTIVITY: { id: number icon: string tone: TintedIconDiscTone actor: string action: string subject: string time: string }[] = [ { id: 1, icon: "fa-user-check", tone: "chart-2", actor: "Dr. Patel", action: "approved", subject: "City Med placement", time: "2m ago" }, { id: 2, icon: "fa-file-signature", tone: "brand", actor: "Sarah Kim", action: "submitted", subject: "OT evaluation form", time: "18m ago" }, { id: 3, icon: "fa-circle-xmark", tone: "destructive", actor: "North Clinic", action: "rejected", subject: "2 pending requests", time: "1h ago" }, { id: 4, icon: "fa-envelope-open", tone: "chart-4", actor: "System", action: "sent reminder", subject: "to 5 supervisors", time: "3h ago" }, { id: 5, icon: "fa-arrow-up-right", tone: "brand", actor: "You", action: "exported", subject: "Q1 compliance report", time: "5h ago" }, { id: 6, icon: "fa-user-plus", tone: "chart-2", actor: "Admissions", action: "added", subject: "14 new nursing students", time: "Yesterday"}, ] function RecentActivityWidget({ plain = false }: { plain?: boolean }) { const rows = ACTIVITY.map((ev, idx) => (

{ev.actor}{" "} {ev.action}{" "} {ev.subject}

{ev.time}

{idx < ACTIVITY.length - 1 && (
)) if (plain) { return (
Recent Activity
{rows}
) } return ( Recent Activity {rows} ) } /* ── Learn / Guide ────────────────────────────────────────────────────────── */ const STEPS = [ { id: 1, label: "Create your organisation profile", done: true }, { id: 2, label: "Add your first placement site", done: true }, { id: 3, label: "Import student roster", done: true }, { id: 4, label: "Configure compliance requirements", done: false }, { id: 5, label: "Invite supervisors", done: false }, { id: 6, label: "Launch first placement cycle", done: false }, ] const GUIDE_ARTICLES = [ { id: "workflow", icon: "fa-sitemap", title: "How does a placement actually work?", meta: "5m read", gradientClass: "bg-gradient-to-br from-chart-3 to-chart-1", }, { id: "site", icon: "fa-circle-play", title: "Watch: Setting up your first clinical site", meta: "3m watch", gradientClass: "bg-gradient-to-br from-chart-1 to-chart-5", }, { id: "compliance", icon: "fa-shield-check", title: "Make compliance less of a headache", meta: "8m read", gradientClass: "bg-gradient-to-br from-chart-2 to-chart-4", }, { id: "reports", icon: "fa-file-chart-column", title: "Turn your data into a report in 2 minutes", meta: "4m read", gradientClass: "bg-gradient-to-br from-chart-4 to-chart-5", }, { id: "support", icon: "fa-headset", title: "Stuck? Our team is one message away", meta: "Get help", gradientClass: "bg-gradient-to-br from-chart-3 to-muted", }, ] function LearnSection({ layout = "scroll", plain = false }: { layout?: "scroll" | "stack"; plain?: boolean }) { const done = STEPS.filter((s) => s.done).length const total = STEPS.length const pct = Math.round((done / total) * 100) const nextStep = STEPS.find((s) => !s.done) const stacked = layout === "stack" const tileClass = cn( "flex flex-col rounded-lg overflow-hidden border border-border bg-card hover:bg-interactive-hover-soft transition-colors focus-visible:outline-2 focus-visible:outline-ring", stacked ? "w-full" : "shrink-0 w-[13rem]", ) const tiles = ( <>