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
2 changed files with 10 additions and 7 deletions
Showing only changes of commit 55b604f700 - Show all commits

View File

@@ -8,11 +8,12 @@ type DecoratedPeriod = ReportPeriod & {
label: string;
};
const TAB_TO_KEY: Record<string, "weekly" | "monthly" | "yearly" | "fyly"> = {
const TAB_TO_KEY: Record<string, "weekly" | "monthly" | "yearly" | "fyly" | "full"> = {
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<string, DecoratedPeriod>();
@@ -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;

View File

@@ -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;