## Title Stripe-style UI overhaul + Expenses feed with month grouping ## Summary Rework the khata-ui frontend to a Stripe-grade design system and add a rich, monthly-grouped Expenses experience driven by react-openapi's shared, spec-configured field renderers. ## Highlights ### Design overhaul - New design system: single indigo (#635BFF), 6px radius, Inter type scale, streamlined surfaces/inputs/feedback tokens - Sticky app bar with brand-left header + inline footer, route titles - Split-panel auth pages, Stripe-style Home hero + feature cards - Toast provider + shared PageHeader/EmptyState UI primitives - Admin polish: right-aligned numerics, row-hover actions, skeletons, richer empty states, breadcrumbed fetch-request flows ### Expenses page - Monthly grouped feed with stat cards (total spent / this month / income) - Month cards as single-open accordions with red-spent / green-income totals - Flat transaction rows: logo, name/date, account, amount (no accordion) - Floating month–year selector pill (scroll-spy) that expands + scrolls to the selected month - Strict DD-MM-YYYY date parsing (day-first), no format guessing ### Shared react-openapi fields - New `CurrencyField` + `formatCurrency` (cached Intl, sign-colored, sign-less amounts; form editing reuses NumberField) - `resourceConfig.fieldTypes` override mechanism (amount → currency) - Expenses page rendered via ListCellRenderer / DetailFieldRenderer / applyDisplayFormat — zero custom field renderers - `resolveMediaUrl` resolves relative `/uploads/...` against the API base for every image field (Admin + Expenses logos) ### Fixes - Perf: memoized rows, formatter caches, single-open accordions — cuts slow-click INP and DOM-nesting warnings - Removed unused @mui/x-data-grid@7, which hoisted @mui/system@7 and crashed Box/createTheme at runtime (v5/v7 mix) ## Commits (10) -9808a1fdesign overhaul + expenses page -d6856a5fix expenses list performance + dom nesting -3dd833ashared currency field + expenses rendered from react-openapi fields -e8c585bfix expenses grouping to parse occurred_at as DD-MM-YYYY strictly -cc940eeexpense list: split month totals, sticky headers + month pill -47d799fexpense list: clickable month pill + fix scroll-to-month -537aef9resolve relative media URLs against the API base in react-openapi -8e9a13dexpense list: replace accordion with flat Stripe-style rows -62dd06cexpense list: month accordions + month-year selector; drop unused x-data-grid -806bd42dropped amount sign from CurrencyField.tsx Reviewed-on: #15 Co-authored-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com> Co-committed-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com>
114 lines
3.0 KiB
TypeScript
114 lines
3.0 KiB
TypeScript
import { alpha, Theme, Components } from '@mui/material/styles';
|
|
import { gray } from '../themePrimitives';
|
|
|
|
/* eslint-disable import/prefer-default-export */
|
|
export const surfacesCustomizations: Components<Theme> = {
|
|
MuiAccordion: {
|
|
defaultProps: {
|
|
elevation: 0,
|
|
disableGutters: true,
|
|
},
|
|
styleOverrides: {
|
|
root: ({ theme }) => ({
|
|
padding: 4,
|
|
overflow: 'clip',
|
|
backgroundColor: (theme.vars || theme).palette.background.default,
|
|
border: '1px solid',
|
|
borderColor: (theme.vars || theme).palette.divider,
|
|
':before': {
|
|
backgroundColor: 'transparent',
|
|
},
|
|
'&:not(:last-of-type)': {
|
|
borderBottom: 'none',
|
|
},
|
|
'&:first-of-type': {
|
|
borderTopLeftRadius: (theme.vars || theme).shape.borderRadius,
|
|
borderTopRightRadius: (theme.vars || theme).shape.borderRadius,
|
|
},
|
|
'&:last-of-type': {
|
|
borderBottomLeftRadius: (theme.vars || theme).shape.borderRadius,
|
|
borderBottomRightRadius: (theme.vars || theme).shape.borderRadius,
|
|
},
|
|
}),
|
|
},
|
|
},
|
|
MuiAccordionSummary: {
|
|
styleOverrides: {
|
|
root: ({ theme }) => ({
|
|
border: 'none',
|
|
borderRadius: (theme.vars || theme).shape.borderRadius,
|
|
'&:hover': { backgroundColor: gray[50] },
|
|
'&:focus-visible': { backgroundColor: 'transparent' },
|
|
...theme.applyStyles('dark', {
|
|
'&:hover': { backgroundColor: alpha(theme.palette.common.white, 0.06) },
|
|
}),
|
|
}),
|
|
},
|
|
},
|
|
MuiAccordionDetails: {
|
|
styleOverrides: {
|
|
root: { mb: 20, border: 'none' },
|
|
},
|
|
},
|
|
MuiPaper: {
|
|
defaultProps: {
|
|
elevation: 0,
|
|
},
|
|
},
|
|
MuiCard: {
|
|
styleOverrides: {
|
|
root: ({ theme }) => {
|
|
return {
|
|
padding: 16,
|
|
gap: 16,
|
|
transition: 'all 100ms ease',
|
|
backgroundColor: gray[50],
|
|
borderRadius: (theme.vars || theme).shape.borderRadius,
|
|
border: `1px solid ${(theme.vars || theme).palette.divider}`,
|
|
boxShadow: 'none',
|
|
...theme.applyStyles('dark', {
|
|
backgroundColor: (theme.vars || theme).palette.background.paper,
|
|
}),
|
|
variants: [
|
|
{
|
|
props: {
|
|
variant: 'outlined',
|
|
},
|
|
style: {
|
|
border: `1px solid ${(theme.vars || theme).palette.divider}`,
|
|
boxShadow: 'none',
|
|
background: 'hsl(0, 0%, 100%)',
|
|
...theme.applyStyles('dark', {
|
|
background: alpha((theme.vars || theme).palette.background.paper, 0.6),
|
|
}),
|
|
},
|
|
},
|
|
],
|
|
};
|
|
},
|
|
},
|
|
},
|
|
MuiCardContent: {
|
|
styleOverrides: {
|
|
root: {
|
|
padding: 0,
|
|
'&:last-child': { paddingBottom: 0 },
|
|
},
|
|
},
|
|
},
|
|
MuiCardHeader: {
|
|
styleOverrides: {
|
|
root: {
|
|
padding: 0,
|
|
},
|
|
},
|
|
},
|
|
MuiCardActions: {
|
|
styleOverrides: {
|
|
root: {
|
|
padding: 0,
|
|
},
|
|
},
|
|
},
|
|
};
|