import { Activity, ArrowUpRight, BarChart3, Calendar, Edit, Eye, FileText, Plus, Users, } from "lucide-react"; import Link from "next/link"; import { AnimatedStatsCard } from "~/app/dashboard/_components/animated-stats-card"; import { InvoiceStatusChart, MonthlyMetricsChart, RevenueChart, } from "~/app/dashboard/_components/charts-client"; import { DashboardPageHeader } from "~/components/layout/page-header"; import { DashboardCardTitle, DashboardGrid, DashboardPage as DashboardPageLayout, dashboardGridClass, } from "~/components/layout/dashboard-page"; import { Badge } from "~/components/ui/badge"; import { Button } from "~/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "~/components/ui/card"; import { getOptionalServerSessionFromHeaders } from "~/lib/auth-server"; import { cn } from "~/lib/utils"; import { api } from "~/trpc/server"; import type { DashboardStats, RecentInvoice } from "./types"; function DashboardStats({ stats }: { stats: DashboardStats }) { const formatTrend = (value: number, isCount = false) => { if (isCount) { return value > 0 ? `+${value}` : value.toString(); } return value > 0 ? `+${value.toFixed(1)}%` : `${value.toFixed(1)}%`; }; const statCards = [ { title: "Total Revenue", value: `$${stats.totalRevenue.toLocaleString("en-US", { minimumFractionDigits: 2 })}`, numericValue: stats.totalRevenue, isCurrency: true, change: formatTrend(stats.revenueChange), trend: stats.revenueChange >= 0 ? ("up" as const) : ("down" as const), iconName: "DollarSign" as const, description: "Collected to date", }, { title: "Pending", value: `$${stats.pendingAmount.toLocaleString("en-US", { minimumFractionDigits: 2 })}`, numericValue: stats.pendingAmount, isCurrency: true, change: "0%", trend: "neutral" as const, iconName: "Clock" as const, description: "Awaiting payment", }, { title: "Clients", value: stats.totalClients.toString(), numericValue: stats.totalClients, isCurrency: false, change: "0", trend: "neutral" as const, iconName: "Users" as const, description: "Active clients", }, { title: "Overdue", value: stats.overdueCount.toString(), numericValue: stats.overdueCount, isCurrency: false, change: "0", trend: "neutral" as const, iconName: "TrendingDown" as const, description: "Past due date", }, ]; return (
{action.title}
{action.description}
No draft in progress
#{currentDraft.invoiceNumber}
{currentDraft.client?.name}
${currentDraft.totalAmount.toFixed(2)}
{totalHours.toFixed(1)} hours logged
No invoices yet
#{invoice.invoiceNumber}
${invoice.totalAmount.toFixed(2)}{invoice.client?.name}