29d7b29cfa
- 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>
25 lines
860 B
TypeScript
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"} />;
|
|
}
|