Files
butcem/src/features/dashboard/components/overview-card.tsx
T
suphicakir 29d7b29cfa feat(ui): dashboard ana grafiği ve rapor sayfaları
- dashboard: periyot seçici ve kümülatif/dönemsel görünüm, tablo; günlük plan kartı sadeleşti
- /raporlar özet ve kategori, trend, kişi/hesap, bütçe sayfaları; ay seçici ve CSV indirme

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 00:29:25 +03:00

25 lines
860 B
TypeScript

import { OVERVIEW_PERIODS, type OverviewPeriod } from "@/shared/overview";
import { getOverview } from "../service";
import { OverviewChart } from "./overview-chart";
type Search = Record<string, string | string[] | undefined>;
const periodOf = (x: unknown): OverviewPeriod =>
OVERVIEW_PERIODS.includes(x as OverviewPeriod) ? (x as OverviewPeriod) : "month";
/** Dashboard ana grafiği (sunucu): ?periyot=week|month|half|year&gorunum=kumulatif|donemsel. */
export async function OverviewCard({
userId,
householdId,
searchParams,
}: {
userId: string;
householdId: string;
searchParams: Promise<Search>;
}) {
const q = await searchParams;
const data = await getOverview(userId, householdId, periodOf(q.periyot));
if (!data) return null;
return <OverviewChart data={data} view={q.gorunum === "donemsel" ? "periodic" : "cumulative"} />;
}