diff --git a/src/components/HistoryChart/HistoryChart.tsx b/src/components/HistoryChart/HistoryChart.tsx index bef5e23..4488676 100644 --- a/src/components/HistoryChart/HistoryChart.tsx +++ b/src/components/HistoryChart/HistoryChart.tsx @@ -8,11 +8,12 @@ type DecoratedPeriod = ReportPeriod & { label: string; }; -const TAB_TO_KEY: Record = { +const TAB_TO_KEY: Record = { Weekly: "weekly", Monthly: "monthly", Yearly: "yearly", - FYLY: "fyly" + 'Financial Year': "fyly", + 'All Time': "full" }; function getAmount(p: ReportPeriod, mode: "expense" | "income") { @@ -39,7 +40,7 @@ function mergeMetric(a: any, b: any) { function mergeBuckets( buckets: any[], - key: "weekly" | "monthly" | "yearly" | "fyly" + key: "weekly" | "monthly" | "yearly" | "fyly" | "full" ): DecoratedPeriod[] { const map = new Map(); @@ -72,7 +73,7 @@ function mergeBuckets( function attachComparison( points: ChartDataPoint[], - key: "weekly" | "monthly" | "yearly" | "fyly" + key: "weekly" | "monthly" | "yearly" | "fyly" | "full" ): ChartDataPoint[] { const getCompareIndex = (i: number) => { if (key === "weekly") return i - 4; @@ -101,7 +102,7 @@ function attachComparison( function buildChartData( reportData: HistoryChartProps["reportData"], - key: "weekly" | "monthly" | "yearly" | "fyly", + key: "weekly" | "monthly" | "yearly" | "fyly" | "full", mode: "expense" | "income", comparison: boolean ): ChartDataPoint[] { @@ -157,7 +158,8 @@ export default function HistoryChart(props: HistoryChartProps) { weekly: 6, monthly: 4, yearly: 4, - fyly: 4 + fyly: 4, + full: 4, }; const visibleCount = visibleCountMap[activeDataKey] ?? 4; diff --git a/src/features/report/report.models.ts b/src/features/report/report.models.ts index 43f5184..d905aa5 100644 --- a/src/features/report/report.models.ts +++ b/src/features/report/report.models.ts @@ -67,6 +67,7 @@ export interface ReportBucket { monthly?: ReportPeriod[]; yearly?: ReportPeriod[]; fyly?: ReportPeriod[]; + full?: ReportPeriod[]; }; } @@ -75,7 +76,7 @@ export interface ReportBucket { // ----------------------------- export interface ReportData { - periods: ("weekly" | "monthly" | "yearly" | "fyly")[]; + periods: ("weekly" | "monthly" | "yearly" | "fyly" | "full")[]; rolling: boolean; report_date?: string;