diff --git a/src/Dashboard.tsx b/src/Dashboard.tsx index 740b691..3dc2116 100644 --- a/src/Dashboard.tsx +++ b/src/Dashboard.tsx @@ -29,6 +29,20 @@ export default function Dashboard() { expense: [], income: [] }); + const palette = { + expense: { + primary: "#d32f2f", + light: "#fdecea", + dark: "#9a0007", + text: "#b71c1c" + }, + income: { + primary: "#2e7d32", + light: "#e8f5e9", + dark: "#1b5e20", + text: "#1b5e20" + } + }; const [aggregated, setAggregated] = React.useState<{ expense: AggregatedDashboardData | null; @@ -45,6 +59,7 @@ export default function Dashboard() { const [loading, setLoading] = React.useState(true); const [error, setError] = React.useState(null); + const colors = palette[mode]; // -------- LOAD ONCE -------- React.useEffect(() => { async function loadData() { @@ -112,13 +127,35 @@ export default function Dashboard() { } return ( - + {/* -------- TOGGLE -------- */} val && setMode(val)} + sx={{ + borderRadius: 3, + overflow: "hidden", + "& .MuiToggleButton-root": { + px: 3, + textTransform: "none", + color: "text.secondary" + }, + "&.Mui-selected": { + bgcolor: colors.primary, + color: "white", + borderColor: colors.primary + }, + }} > Expenses Income @@ -137,6 +174,7 @@ export default function Dashboard() { onPeriodChange={setPeriod} comparison={comparison} setComparison={setComparison} + colorScheme={colors} /> @@ -145,6 +183,7 @@ export default function Dashboard() { title={`Recent ${mode === "expense" ? "Expenses" : "Income"}`} items={currentLatest} onViewAll={() => {}} + accentColor={colors.primary} /> diff --git a/src/components/HistoryChart.tsx b/src/components/HistoryChart.tsx index 5540d9e..97a5c9a 100644 --- a/src/components/HistoryChart.tsx +++ b/src/components/HistoryChart.tsx @@ -72,6 +72,7 @@ export default function HistoryChart({ onPeriodChange, comparison, setComparison, + colorScheme, }: HistoryChartProps) { const [activeTab, setActiveTab] = React.useState(tabs[0] || ""); @@ -141,10 +142,11 @@ export default function HistoryChart({ width: "100%", boxShadow: "none", border: "1px solid", - borderColor: "divider" + borderColor: "divider", + bgcolor: colorScheme.light, }} > - + {header} @@ -296,7 +298,7 @@ export default function HistoryChart({ sx={{ width: 6, height: `${compareHeight}%`, - bgcolor: "grey.400", + bgcolor: `${colorScheme.primary}55`, borderRadius: 2 }} /> @@ -310,7 +312,9 @@ export default function HistoryChart({ sx={{ width: 10, height: `${currentHeight}%`, - bgcolor: point.highlighted ? "error.main" : "primary.main", + bgcolor: point.highlighted + ? colorScheme.primary + : `${colorScheme.primary}99`, borderRadius: 2 }} /> diff --git a/src/components/LatestItemsList.tsx b/src/components/LatestItemsList.tsx index b3f55e3..eae5cfe 100644 --- a/src/components/LatestItemsList.tsx +++ b/src/components/LatestItemsList.tsx @@ -24,12 +24,14 @@ export interface LatestItemsListProps { title?: string; items: LatestItem[]; onViewAll?: () => void; + accentColor: any; } export default function LatestItemsList({ title = "Recent Transactions", items, onViewAll, + accentColor, }: LatestItemsListProps) { return ( @@ -69,7 +71,7 @@ export default function LatestItemsList({ void; comparison: boolean; setComparison: (mode: boolean) => void; + colorScheme: any; }