# Dashboard State Lift + Theme System Refactor ## Summary Refactored dashboard state ownership, centralized theme semantics, and simplified component styling across the application. ## Changes ### Dashboard State Refactor * Moved dashboard state management from `Dashboard.view` into `Dashboard.tsx` * Added centralized `DashboardState` initialization in parent container * Introduced memoized dashboard state setter callbacks: * `toggleFlow` * `setFlow` * `togglePeriodType` * `toggleComparison` * `setSelectedPeriodId` * `setSelectedGroupKey` * Added `DashboardStateSetters` memoized object for prop-driven state management * Removed `onFlowChange` callback pattern * Converted dashboard component into stateless view layer * Renamed component export flow: * `Dashboard.tsx` → removed * `Dashboard.view.tsx` → primary implementation ### Dashboard Models Cleanup * Removed legacy palette configuration interfaces: * `ColorDefinition` * `ThemeAwarePalette` * Removed config-level style palette support from `DashboardConfig` * Renamed `DashboardProps` → `DashboardViewProps` * Added reusable `ColorScheme` interface * Simplified component color contract: * `primary` * `surface` * `text` ### Theme Architecture Refactor * Moved `AppTheme.tsx` into `shared-theme` * Added centralized semantic theme system * Introduced `themeConfig.ts` with semantic tokens: * surface * border * text * Added `semantic` extension to MUI theme typing * Added `flows` palette extension: * outflows * inflows * Centralized flow colors inside theme primitives * Added CSS semantic variables: * `--bg-page` * `--bg-card` * `--bg-elevated` * `--border-default` * `--border-subtle` * `--text-primary` * `--text-secondary` * `--text-muted` ### Theme Mode Improvements * Added explicit `ColorMode` type * Expanded `ColorModeContext`: * `mode` * `setMode` * `toggleColorMode` * Added `CssBaseline` * Added configurable `defaultMode` * Simplified dark theme palette handling * Standardized dark surfaces and shadows * Reduced excessive dark-mode glow/shadow intensity ### Dashboard UI Styling Improvements * Replaced hardcoded dashboard palette config with theme palette usage * Updated dashboard background gradients to use alpha-based semantic colors * Replaced `colorScheme.light` usage with `colorScheme.surface` * Standardized border usage with theme divider tokens * Removed manual dark-mode conditional styling where redundant * Simplified card and progress styling logic ### Shared Theme Customization Cleanup Updated customization layers for improved consistency: * `inputs` * `navigation` * `feedback` * `surfaces` Key improvements: * Reduced dark-mode contrast harshness * Unified divider usage * Replaced hardcoded grayscale backgrounds with semantic surfaces * Simplified hover and active state styling * Reduced shadow intensity across components * Improved dark-mode readability and layering ### Home Page Styling Cleanup * Replaced manual RGBA handling with `alpha()` utility * Improved dark-mode glassmorphism consistency * Updated CTA hover shadow to use theme primary color ### Miscellaneous Cleanup * Updated imports to new theme structure * Removed unused legacy color mode components: * `ColorModeIconDropdown.tsx` * `ColorModeSelect.tsx` * Removed dashboard config style palette definitions * Simplified flow-based color derivation logic ## Result * Cleaner separation of stateful vs presentational dashboard logic * Centralized semantic theming system * Consistent dark/light mode behavior * Reduced styling duplication * Improved maintainability and extensibility of theme architecture * Simplified dashboard component contracts * Better UI consistency across surfaces and controls Reviewed-on: #6 Co-authored-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com> Co-committed-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com>
110 lines
3.5 KiB
TypeScript
110 lines
3.5 KiB
TypeScript
import * as React from "react";
|
|
import { Box, Typography, Button, Container, Stack } from "@mui/material";
|
|
import { useTheme, alpha } from "@mui/material/styles";
|
|
import { useNavigate } from "react-router-dom";
|
|
import ArrowForwardIcon from "@mui/icons-material/ArrowForward";
|
|
|
|
export default function Home() {
|
|
const navigate = useNavigate();
|
|
const theme = useTheme();
|
|
|
|
return (
|
|
<Box
|
|
sx={{
|
|
width: "100%",
|
|
minHeight: "calc(100vh - 64px)", // accounting for header
|
|
display: "flex",
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
position: "relative",
|
|
overflow: "hidden",
|
|
"&::before": {
|
|
content: '""',
|
|
position: "absolute",
|
|
top: "-20%",
|
|
left: "-10%",
|
|
width: "50%",
|
|
height: "60%",
|
|
background: "radial-gradient(circle, rgba(99,102,241,0.15) 0%, rgba(0,0,0,0) 70%)",
|
|
zIndex: 0,
|
|
},
|
|
"&::after": {
|
|
content: '""',
|
|
position: "absolute",
|
|
bottom: "-20%",
|
|
right: "-10%",
|
|
width: "50%",
|
|
height: "60%",
|
|
background: "radial-gradient(circle, rgba(236,72,153,0.15) 0%, rgba(0,0,0,0) 70%)",
|
|
zIndex: 0,
|
|
},
|
|
}}
|
|
>
|
|
<Container maxWidth="lg" sx={{ position: "relative", zIndex: 1 }}>
|
|
<Stack
|
|
spacing={4}
|
|
alignItems="center"
|
|
textAlign="center"
|
|
sx={{
|
|
p: { xs: 4, md: 8 },
|
|
backdropFilter: "blur(20px)",
|
|
backgroundColor: (t) => alpha(t.palette.common.white, t.palette.mode === "dark" ? 0.04 : 0.6),
|
|
border: "1px solid",
|
|
borderColor: "divider",
|
|
borderRadius: 4,
|
|
boxShadow: (t) =>
|
|
t.palette.mode === "dark"
|
|
? "0 8px 32px 0 rgba(0, 0, 0, 0.5)"
|
|
: "0 8px 32px 0 rgba(31, 38, 135, 0.07)",
|
|
}}
|
|
>
|
|
<Typography
|
|
variant="h1"
|
|
sx={{
|
|
fontWeight: 800,
|
|
fontSize: { xs: "3rem", md: "5rem" },
|
|
background: "linear-gradient(45deg, #6366f1 30%, #ec4899 90%)",
|
|
WebkitBackgroundClip: "text",
|
|
WebkitTextFillColor: "transparent",
|
|
mb: 2,
|
|
}}
|
|
>
|
|
Welcome to Khata
|
|
</Typography>
|
|
|
|
<Typography
|
|
variant="h5"
|
|
color="text.secondary"
|
|
sx={{ maxWidth: "600px", lineHeight: 1.6 }}
|
|
>
|
|
Your intelligent, extensible financial ledger. Control accounts, manage transactions, and track your data dynamically with our OpenAPI-driven architecture.
|
|
</Typography>
|
|
|
|
<Box mt={4}>
|
|
<Button
|
|
variant="contained"
|
|
size="large"
|
|
endIcon={<ArrowForwardIcon />}
|
|
onClick={() => navigate("/dashboard")}
|
|
sx={{
|
|
px: 4,
|
|
py: 1.5,
|
|
borderRadius: "50px",
|
|
fontWeight: "bold",
|
|
background: "linear-gradient(45deg, #6366f1 30%, #ec4899 90%)",
|
|
transition: "transform 0.2s ease-in-out, box-shadow 0.2s",
|
|
"&:hover": {
|
|
transform: "translateY(-3px)",
|
|
boxShadow: (t) => `0 8px 20px ${alpha(t.palette.primary.main, 0.4)}`,
|
|
},
|
|
}}
|
|
>
|
|
Enter Dashboard
|
|
</Button>
|
|
</Box>
|
|
</Stack>
|
|
</Container>
|
|
</Box>
|
|
);
|
|
}
|