diff --git a/src/components/HistoryChart/HistoryChart.models.ts b/src/components/HistoryChart/HistoryChart.models.ts index 014b405..9a9de10 100644 --- a/src/components/HistoryChart/HistoryChart.models.ts +++ b/src/components/HistoryChart/HistoryChart.models.ts @@ -17,6 +17,9 @@ export interface ChartDataPoint extends _ChartDataPoint { export interface ChartData { weekly?: Record; monthly?: Record; + // yearly?: Record; + // fyly?: Record; + // full?: Record; } export interface HistoryChartProps { diff --git a/src/components/HistoryChart/HistoryChart.tsx b/src/components/HistoryChart/HistoryChart.tsx index c890da0..cd30188 100644 --- a/src/components/HistoryChart/HistoryChart.tsx +++ b/src/components/HistoryChart/HistoryChart.tsx @@ -28,6 +28,7 @@ export default function HistoryChart(props: HistoryChartProps) { : 1; const visibleCountMap = { daily: 7, weekly: 6, monthly: 4 }; + // const visibleCountMap = { daily: 7, weekly: 6, monthly: 4, yearly: 4, fyly: 4, full: 4 }; const visibleCount = visibleCountMap[activeDataKey]; const total = currentData.length; diff --git a/src/dashboard-config.ts b/src/dashboard-config.ts index aa6f02e..4da4208 100644 --- a/src/dashboard-config.ts +++ b/src/dashboard-config.ts @@ -13,6 +13,7 @@ export const configuration: DashboardConfig = { dataKey: "chartData", settings: { tabs: ["Weekly", "Monthly"], + // tabs: ["Weekly", "Monthly", "Yearly", "Financial Year", "All Time"], }, style: { size: 12, diff --git a/src/features/dashboard/dashboard.mapper.ts b/src/features/dashboard/dashboard.mapper.ts index e32db48..370dc0e 100644 --- a/src/features/dashboard/dashboard.mapper.ts +++ b/src/features/dashboard/dashboard.mapper.ts @@ -47,7 +47,7 @@ const sumBucket = (bucket: ReportBucket, flow: "expenses" | "incomes") => 0 ); -const toLabel = (start: string, end: string, type: "weekly" | "monthly") => { +const toLabel = (start: string, end: string, type: "weekly" | "monthly" | "yearly" | "fyly" | "full") => { const s = new Date(start); const e = new Date(end); @@ -68,7 +68,7 @@ const getWeekOfMonth = (date: Date) => { const findCompareBucket = ( current: ReportBucket, buckets: ReportBucket[], - type: "weekly" | "monthly" + type: "weekly" | "monthly" | "yearly" | "fyly" | "full", ): ReportBucket | undefined => { const start = new Date(current.start); @@ -105,7 +105,7 @@ const findCompareBucket = ( const toPoints = ( buckets: ReportBucket[], - type: "weekly" | "monthly", + type: "weekly" | "monthly" | "yearly" | "fyly" | "full", flow: "expenses" | "incomes" ): ChartDataPoint[] => { return buckets.map((b) => { @@ -143,6 +143,21 @@ export function mapReportToDashboard( rolling: toPoints(monthly, "monthly", flow), calendar: toPoints(monthly, "monthly", flow), }, + + // yearly: { + // rolling: toPoints(yearly, "yearly", flow), + // calendar: toPoints(yearly, "yearly", flow), + // }, + // + // fyly: { + // rolling: toPoints(fyly, "fyly", flow), + // calendar: toPoints(fyly, "fyly", flow), + // }, + // + // full: { + // rolling: toPoints(full, "full", flow), + // calendar: toPoints(full, "full", flow), + // }, }; const totalAmount = weekly.reduce(