major refactor of the dashboard and react-openapi integration #1

Merged
aetos merged 44 commits from period-selection into main 2026-05-07 11:00:54 +00:00
4 changed files with 23 additions and 3 deletions
Showing only changes of commit 7470da6d2d - Show all commits

View File

@@ -17,6 +17,9 @@ export interface ChartDataPoint extends _ChartDataPoint {
export interface ChartData { export interface ChartData {
weekly?: Record<string, ChartDataPoint[]>; weekly?: Record<string, ChartDataPoint[]>;
monthly?: Record<string, ChartDataPoint[]>; monthly?: Record<string, ChartDataPoint[]>;
// yearly?: Record<string, ChartDataPoint[]>;
// fyly?: Record<string, ChartDataPoint[]>;
// full?: Record<string, ChartDataPoint[]>;
} }
export interface HistoryChartProps { export interface HistoryChartProps {

View File

@@ -28,6 +28,7 @@ export default function HistoryChart(props: HistoryChartProps) {
: 1; : 1;
const visibleCountMap = { daily: 7, weekly: 6, monthly: 4 }; 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 visibleCount = visibleCountMap[activeDataKey];
const total = currentData.length; const total = currentData.length;

View File

@@ -13,6 +13,7 @@ export const configuration: DashboardConfig = {
dataKey: "chartData", dataKey: "chartData",
settings: { settings: {
tabs: ["Weekly", "Monthly"], tabs: ["Weekly", "Monthly"],
// tabs: ["Weekly", "Monthly", "Yearly", "Financial Year", "All Time"],
}, },
style: { style: {
size: 12, size: 12,

View File

@@ -47,7 +47,7 @@ const sumBucket = (bucket: ReportBucket, flow: "expenses" | "incomes") =>
0 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 s = new Date(start);
const e = new Date(end); const e = new Date(end);
@@ -68,7 +68,7 @@ const getWeekOfMonth = (date: Date) => {
const findCompareBucket = ( const findCompareBucket = (
current: ReportBucket, current: ReportBucket,
buckets: ReportBucket[], buckets: ReportBucket[],
type: "weekly" | "monthly" type: "weekly" | "monthly" | "yearly" | "fyly" | "full",
): ReportBucket | undefined => { ): ReportBucket | undefined => {
const start = new Date(current.start); const start = new Date(current.start);
@@ -105,7 +105,7 @@ const findCompareBucket = (
const toPoints = ( const toPoints = (
buckets: ReportBucket[], buckets: ReportBucket[],
type: "weekly" | "monthly", type: "weekly" | "monthly" | "yearly" | "fyly" | "full",
flow: "expenses" | "incomes" flow: "expenses" | "incomes"
): ChartDataPoint[] => { ): ChartDataPoint[] => {
return buckets.map((b) => { return buckets.map((b) => {
@@ -143,6 +143,21 @@ export function mapReportToDashboard(
rolling: toPoints(monthly, "monthly", flow), rolling: toPoints(monthly, "monthly", flow),
calendar: 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( const totalAmount = weekly.reduce(