"use client"; import { TrendingDown, TrendingUp } from "lucide-react"; import { CartesianGrid, Line, LineChart, XAxis, YAxis } from "recharts"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { type ChartConfig, ChartContainer, ChartTooltip, ChartTooltipContent, } from "@/components/ui/chart"; import { cn } from "@/lib/utils"; interface ChartGroup8Props { className?: string; } const weekdayFormatter = new Intl.DateTimeFormat("fa-IR", { weekday: "short", }); const currencyFormatter = new Intl.NumberFormat("fa-IR", { style: "currency", currency: "IRR", minimumFractionDigits: 0, maximumFractionDigits: 0, }); const numberFormatter = new Intl.NumberFormat("fa-IR", { maximumFractionDigits: 0, }); const percentFormatter = new Intl.NumberFormat("fa-IR", { maximumFractionDigits: 0, }); const percentChangeFormatter = new Intl.NumberFormat("fa-IR", { maximumFractionDigits: 1, minimumFractionDigits: 1, signDisplay: "exceptZero", }); const formatPercent = (value: number) => `${percentFormatter.format(value)}٪`; const weeklyData = [ { day: weekdayFormatter.format(new Date(2025, 0, 6)), current: 420, previous: 380, }, { day: weekdayFormatter.format(new Date(2025, 0, 7)), current: 510, previous: 450, }, { day: weekdayFormatter.format(new Date(2025, 0, 8)), current: 480, previous: 420, }, { day: weekdayFormatter.format(new Date(2025, 0, 9)), current: 620, previous: 550, }, { day: weekdayFormatter.format(new Date(2025, 0, 10)), current: 710, previous: 620, }, { day: weekdayFormatter.format(new Date(2025, 0, 11)), current: 540, previous: 480, }, { day: weekdayFormatter.format(new Date(2025, 0, 12)), current: 410, previous: 390, }, ]; const performanceData = [ { metric: "فروش", value: 87, target: 100, fill: "var(--chart-1)" }, { metric: "سرنخ‌ها", value: 65, target: 100, fill: "var(--chart-2)" }, { metric: "تبدیل", value: 42, target: 100, fill: "var(--chart-3)" }, { metric: "حفظ مشتری", value: 91, target: 100, fill: "var(--chart-4)" }, ]; const weeklyConfig = { current: { label: "این هفته", color: "var(--chart-1)" }, previous: { label: "هفته قبل", color: "var(--chart-4)" }, } satisfies ChartConfig; const monthlyGoalPercent = 73; const monthlyGoalCurrent = 36500; const monthlyGoalTarget = 50000; const quickStats = [ { label: "میانگین سفارش", value: currencyFormatter.format(142), change: 8.5, }, { label: "مشتریان جدید", value: numberFormatter.format(284), change: 12.3, }, { label: "نرخ تکرار", value: formatPercent(34), change: -2.1, }, ]; const ChartGroup8 = ({ className }: ChartGroup8Props) => { const currentTotal = weeklyData.reduce((sum, d) => sum + d.current, 0); const previousTotal = weeklyData.reduce((sum, d) => sum + d.previous, 0); const changePercent = ((currentTotal - previousTotal) / previousTotal) * 100; const isPositive = changePercent >= 0; return (
مقایسه هفتگی این هفته در برابر هفته قبل

{numberFormatter.format(currentTotal)}

{isPositive ? (
numberFormatter.format(Number(v))} /> numberFormatter.format(Number(value)) } /> } cursor={{ stroke: "var(--border)", strokeDasharray: "4 4" }} />
هدف ماهانه پیشرفت هدف درآمد
{formatPercent(monthlyGoalPercent)} از هدف

{currencyFormatter.format(monthlyGoalCurrent)} /{" "} {currencyFormatter.format(monthlyGoalTarget)}

آمار سریع نمای کلی شاخص‌های کلیدی {quickStats.map((stat, index) => (
{stat.label}
{stat.value} = 0 ? "text-green-500" : "text-red-500", )} > {percentChangeFormatter.format(stat.change)}٪
))}
شاخص‌های عملکرد پیشرفت نسبت به اهداف سه‌ماهه
{performanceData.map((item, index) => (
{item.metric} {formatPercent(item.value)}
))}
); }; export { ChartGroup8 };