Ran prettier
This commit is contained in:
@@ -5,24 +5,28 @@ A modern personal finance management application for tracking net worth, managin
|
|||||||
## Features
|
## Features
|
||||||
|
|
||||||
### Net Worth Tracking
|
### Net Worth Tracking
|
||||||
|
|
||||||
- Track assets (cash, investments, property, vehicles)
|
- Track assets (cash, investments, property, vehicles)
|
||||||
- Track liabilities (mortgages, loans, credit cards)
|
- Track liabilities (mortgages, loans, credit cards)
|
||||||
- Visualize net worth over time with charts
|
- Visualize net worth over time with charts
|
||||||
- View asset allocation breakdown
|
- View asset allocation breakdown
|
||||||
|
|
||||||
### Debt Management
|
### Debt Management
|
||||||
|
|
||||||
- Organize debts by custom categories
|
- Organize debts by custom categories
|
||||||
- Track multiple accounts per category
|
- Track multiple accounts per category
|
||||||
- Monitor paydown progress with visual indicators
|
- Monitor paydown progress with visual indicators
|
||||||
- View by category or individual account
|
- View by category or individual account
|
||||||
|
|
||||||
### Invoicing
|
### Invoicing
|
||||||
|
|
||||||
- Create and manage invoices
|
- Create and manage invoices
|
||||||
- Track invoice status (draft, sent, paid, overdue)
|
- Track invoice status (draft, sent, paid, overdue)
|
||||||
- Manage client database
|
- Manage client database
|
||||||
- View outstanding and paid totals
|
- View outstanding and paid totals
|
||||||
|
|
||||||
### Cashflow
|
### Cashflow
|
||||||
|
|
||||||
- Track income sources with various frequencies
|
- Track income sources with various frequencies
|
||||||
- Categorize expenses (essential vs discretionary)
|
- Categorize expenses (essential vs discretionary)
|
||||||
- Monitor savings rate
|
- Monitor savings rate
|
||||||
|
|||||||
@@ -1,19 +1,6 @@
|
|||||||
import {useState} from 'react';
|
import {useState} from 'react';
|
||||||
import {
|
import {Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle} from '@/components/ui/dialog';
|
||||||
Dialog,
|
import {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from '@/components/ui/select';
|
||||||
DialogContent,
|
|
||||||
DialogDescription,
|
|
||||||
DialogFooter,
|
|
||||||
DialogHeader,
|
|
||||||
DialogTitle,
|
|
||||||
} from '@/components/ui/dialog';
|
|
||||||
import {
|
|
||||||
Select,
|
|
||||||
SelectContent,
|
|
||||||
SelectItem,
|
|
||||||
SelectTrigger,
|
|
||||||
SelectValue,
|
|
||||||
} from '@/components/ui/select';
|
|
||||||
import {Button} from '@/components/ui/button';
|
import {Button} from '@/components/ui/button';
|
||||||
import {Input} from '@/components/ui/input';
|
import {Input} from '@/components/ui/input';
|
||||||
import {Label} from '@/components/ui/label';
|
import {Label} from '@/components/ui/label';
|
||||||
@@ -38,7 +25,7 @@ export default function AddAccountDialog({open, onOpenChange}: AddAccountDialogP
|
|||||||
interestRate: '',
|
interestRate: '',
|
||||||
minimumPayment: '',
|
minimumPayment: '',
|
||||||
dueDay: '',
|
dueDay: '',
|
||||||
notes: '',
|
notes: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleSubmit = (e: React.FormEvent) => {
|
const handleSubmit = (e: React.FormEvent) => {
|
||||||
@@ -58,7 +45,7 @@ export default function AddAccountDialog({open, onOpenChange}: AddAccountDialogP
|
|||||||
dueDay: parseInt(formData.dueDay) || 1,
|
dueDay: parseInt(formData.dueDay) || 1,
|
||||||
notes: formData.notes || undefined,
|
notes: formData.notes || undefined,
|
||||||
createdAt: now,
|
createdAt: now,
|
||||||
updatedAt: now,
|
updatedAt: now
|
||||||
};
|
};
|
||||||
|
|
||||||
dispatch(addAccount(account));
|
dispatch(addAccount(account));
|
||||||
@@ -73,7 +60,7 @@ export default function AddAccountDialog({open, onOpenChange}: AddAccountDialogP
|
|||||||
interestRate: '',
|
interestRate: '',
|
||||||
minimumPayment: '',
|
minimumPayment: '',
|
||||||
dueDay: '',
|
dueDay: '',
|
||||||
notes: '',
|
notes: ''
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -86,9 +73,7 @@ export default function AddAccountDialog({open, onOpenChange}: AddAccountDialogP
|
|||||||
<DialogContent className="card-elevated max-h-[90vh] overflow-y-auto sm:max-w-lg">
|
<DialogContent className="card-elevated max-h-[90vh] overflow-y-auto sm:max-w-lg">
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>Add Debt Account</DialogTitle>
|
<DialogTitle>Add Debt Account</DialogTitle>
|
||||||
<DialogDescription>
|
<DialogDescription>Add a new debt account to track your payoff progress</DialogDescription>
|
||||||
Add a new debt account to track your payoff progress
|
|
||||||
</DialogDescription>
|
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
<form onSubmit={handleSubmit}>
|
<form onSubmit={handleSubmit}>
|
||||||
<div className="grid gap-4 py-4">
|
<div className="grid gap-4 py-4">
|
||||||
@@ -106,11 +91,7 @@ export default function AddAccountDialog({open, onOpenChange}: AddAccountDialogP
|
|||||||
|
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="category">Category</Label>
|
<Label htmlFor="category">Category</Label>
|
||||||
<Select
|
<Select value={formData.categoryId} onValueChange={value => updateField('categoryId', value)} required>
|
||||||
value={formData.categoryId}
|
|
||||||
onValueChange={value => updateField('categoryId', value)}
|
|
||||||
required
|
|
||||||
>
|
|
||||||
<SelectTrigger className="input-depth">
|
<SelectTrigger className="input-depth">
|
||||||
<SelectValue placeholder="Select a category" />
|
<SelectValue placeholder="Select a category" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
@@ -236,4 +217,3 @@ export default function AddAccountDialog({open, onOpenChange}: AddAccountDialogP
|
|||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,14 +47,10 @@ export class ErrorBoundary extends Component<Props, State> {
|
|||||||
<CardTitle className="text-red-400">Something went wrong</CardTitle>
|
<CardTitle className="text-red-400">Something went wrong</CardTitle>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="space-y-4">
|
<CardContent className="space-y-4">
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">An unexpected error occurred. Please try refreshing the page.</p>
|
||||||
An unexpected error occurred. Please try refreshing the page.
|
|
||||||
</p>
|
|
||||||
{import.meta.env.DEV && this.state.error && (
|
{import.meta.env.DEV && this.state.error && (
|
||||||
<div className="p-3 bg-destructive/10 rounded-md">
|
<div className="p-3 bg-destructive/10 rounded-md">
|
||||||
<p className="text-xs font-mono text-destructive break-all">
|
<p className="text-xs font-mono text-destructive break-all">{this.state.error.message}</p>
|
||||||
{this.state.error.message}
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const navItems = [
|
|||||||
{to: '/cashflow', label: 'Cashflow', icon: ArrowLeftRight},
|
{to: '/cashflow', label: 'Cashflow', icon: ArrowLeftRight},
|
||||||
{to: '/debts', label: 'Debts', icon: CreditCard},
|
{to: '/debts', label: 'Debts', icon: CreditCard},
|
||||||
{to: '/invoices', label: 'Invoices', icon: FileText},
|
{to: '/invoices', label: 'Invoices', icon: FileText},
|
||||||
{to: '/clients', label: 'Clients', icon: Users},
|
{to: '/clients', label: 'Clients', icon: Users}
|
||||||
];
|
];
|
||||||
|
|
||||||
export default function Layout() {
|
export default function Layout() {
|
||||||
@@ -27,16 +27,11 @@ export default function Layout() {
|
|||||||
to={item.to}
|
to={item.to}
|
||||||
className={({isActive}) =>
|
className={({isActive}) =>
|
||||||
`flex h-9 items-center gap-3 rounded-lg px-2.5 transition-colors ${
|
`flex h-9 items-center gap-3 rounded-lg px-2.5 transition-colors ${
|
||||||
isActive
|
isActive ? 'bg-accent text-foreground' : 'text-muted-foreground hover:bg-accent/50 hover:text-foreground'
|
||||||
? 'bg-accent text-foreground'
|
|
||||||
: 'text-muted-foreground hover:bg-accent/50 hover:text-foreground'
|
|
||||||
}`
|
}`
|
||||||
}
|
}>
|
||||||
>
|
|
||||||
<item.icon className="h-[18px] w-[18px] shrink-0" />
|
<item.icon className="h-[18px] w-[18px] shrink-0" />
|
||||||
<span className="text-sm opacity-0 group-hover:opacity-100 transition-opacity duration-200 whitespace-nowrap">
|
<span className="text-sm opacity-0 group-hover:opacity-100 transition-opacity duration-200 whitespace-nowrap">{item.label}</span>
|
||||||
{item.label}
|
|
||||||
</span>
|
|
||||||
</NavLink>
|
</NavLink>
|
||||||
))}
|
))}
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
@@ -45,13 +45,15 @@ export default function AddAssetDialog({open, onOpenChange}: Props) {
|
|||||||
const valueNum = validatePositiveNumber(form.value);
|
const valueNum = validatePositiveNumber(form.value);
|
||||||
if (valueNum === null) return;
|
if (valueNum === null) return;
|
||||||
|
|
||||||
dispatch(addAsset({
|
dispatch(
|
||||||
id: crypto.randomUUID(),
|
addAsset({
|
||||||
name: sanitizeString(form.name),
|
id: crypto.randomUUID(),
|
||||||
type: form.type as typeof assetTypes[number],
|
name: sanitizeString(form.name),
|
||||||
value: valueNum,
|
type: form.type as (typeof assetTypes)[number],
|
||||||
updatedAt: new Date().toISOString(),
|
value: valueNum,
|
||||||
}));
|
updatedAt: new Date().toISOString()
|
||||||
|
})
|
||||||
|
);
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
setForm({name: '', type: '', value: ''});
|
setForm({name: '', type: '', value: ''});
|
||||||
setErrors({name: '', value: ''});
|
setErrors({name: '', value: ''});
|
||||||
@@ -68,31 +70,57 @@ export default function AddAssetDialog({open, onOpenChange}: Props) {
|
|||||||
<div className="grid gap-4 py-4">
|
<div className="grid gap-4 py-4">
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="name">Name</Label>
|
<Label htmlFor="name">Name</Label>
|
||||||
<Input id="name" placeholder="e.g., Chase Savings" value={form.name} onChange={e => setForm({...form, name: e.target.value})} className="input-depth" required />
|
<Input
|
||||||
|
id="name"
|
||||||
|
placeholder="e.g., Chase Savings"
|
||||||
|
value={form.name}
|
||||||
|
onChange={e => setForm({...form, name: e.target.value})}
|
||||||
|
className="input-depth"
|
||||||
|
required
|
||||||
|
/>
|
||||||
{errors.name && <p className="text-xs text-red-400">{errors.name}</p>}
|
{errors.name && <p className="text-xs text-red-400">{errors.name}</p>}
|
||||||
</div>
|
</div>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label>Type</Label>
|
<Label>Type</Label>
|
||||||
<Select value={form.type} onValueChange={v => setForm({...form, type: v})} required>
|
<Select value={form.type} onValueChange={v => setForm({...form, type: v})} required>
|
||||||
<SelectTrigger className="input-depth"><SelectValue placeholder="Select type" /></SelectTrigger>
|
<SelectTrigger className="input-depth">
|
||||||
|
<SelectValue placeholder="Select type" />
|
||||||
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{assetTypes.map(t => <SelectItem key={t} value={t} className="capitalize">{t}</SelectItem>)}
|
{assetTypes.map(t => (
|
||||||
|
<SelectItem key={t} value={t} className="capitalize">
|
||||||
|
{t}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="value">Value</Label>
|
<Label htmlFor="value">Value</Label>
|
||||||
<Input id="value" type="number" step="0.01" min="0" placeholder="0.00" value={form.value} onChange={e => setForm({...form, value: e.target.value})} className="input-depth" required />
|
<Input
|
||||||
|
id="value"
|
||||||
|
type="number"
|
||||||
|
step="0.01"
|
||||||
|
min="0"
|
||||||
|
placeholder="0.00"
|
||||||
|
value={form.value}
|
||||||
|
onChange={e => setForm({...form, value: e.target.value})}
|
||||||
|
className="input-depth"
|
||||||
|
required
|
||||||
|
/>
|
||||||
{errors.value && <p className="text-xs text-red-400">{errors.value}</p>}
|
{errors.value && <p className="text-xs text-red-400">{errors.value}</p>}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<Button type="button" variant="secondary" onClick={() => onOpenChange(false)}>Cancel</Button>
|
<Button type="button" variant="secondary" onClick={() => onOpenChange(false)}>
|
||||||
<Button type="submit" disabled={!form.name || !form.type || !form.value}>Add Asset</Button>
|
Cancel
|
||||||
|
</Button>
|
||||||
|
<Button type="submit" disabled={!form.name || !form.type || !form.value}>
|
||||||
|
Add Asset
|
||||||
|
</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
</form>
|
</form>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,15 +16,17 @@ export default function AddClientDialog({open, onOpenChange}: Props) {
|
|||||||
|
|
||||||
const handleSubmit = (e: React.FormEvent) => {
|
const handleSubmit = (e: React.FormEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
dispatch(addClient({
|
dispatch(
|
||||||
id: crypto.randomUUID(),
|
addClient({
|
||||||
name: form.name,
|
id: crypto.randomUUID(),
|
||||||
email: form.email,
|
name: form.name,
|
||||||
phone: form.phone || undefined,
|
email: form.email,
|
||||||
company: form.company || undefined,
|
phone: form.phone || undefined,
|
||||||
address: form.address || undefined,
|
company: form.company || undefined,
|
||||||
createdAt: new Date().toISOString(),
|
address: form.address || undefined,
|
||||||
}));
|
createdAt: new Date().toISOString()
|
||||||
|
})
|
||||||
|
);
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
setForm({name: '', email: '', phone: '', company: '', address: ''});
|
setForm({name: '', email: '', phone: '', company: '', address: ''});
|
||||||
};
|
};
|
||||||
@@ -40,15 +42,36 @@ export default function AddClientDialog({open, onOpenChange}: Props) {
|
|||||||
<div className="grid gap-4 py-4">
|
<div className="grid gap-4 py-4">
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="name">Name *</Label>
|
<Label htmlFor="name">Name *</Label>
|
||||||
<Input id="name" placeholder="John Doe" value={form.name} onChange={e => setForm({...form, name: e.target.value})} className="input-depth" required />
|
<Input
|
||||||
|
id="name"
|
||||||
|
placeholder="John Doe"
|
||||||
|
value={form.name}
|
||||||
|
onChange={e => setForm({...form, name: e.target.value})}
|
||||||
|
className="input-depth"
|
||||||
|
required
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="email">Email *</Label>
|
<Label htmlFor="email">Email *</Label>
|
||||||
<Input id="email" type="email" placeholder="john@example.com" value={form.email} onChange={e => setForm({...form, email: e.target.value})} className="input-depth" required />
|
<Input
|
||||||
|
id="email"
|
||||||
|
type="email"
|
||||||
|
placeholder="john@example.com"
|
||||||
|
value={form.email}
|
||||||
|
onChange={e => setForm({...form, email: e.target.value})}
|
||||||
|
className="input-depth"
|
||||||
|
required
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="company">Company</Label>
|
<Label htmlFor="company">Company</Label>
|
||||||
<Input id="company" placeholder="Acme Inc" value={form.company} onChange={e => setForm({...form, company: e.target.value})} className="input-depth" />
|
<Input
|
||||||
|
id="company"
|
||||||
|
placeholder="Acme Inc"
|
||||||
|
value={form.company}
|
||||||
|
onChange={e => setForm({...form, company: e.target.value})}
|
||||||
|
className="input-depth"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="phone">Phone</Label>
|
<Label htmlFor="phone">Phone</Label>
|
||||||
@@ -56,16 +79,25 @@ export default function AddClientDialog({open, onOpenChange}: Props) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="address">Address</Label>
|
<Label htmlFor="address">Address</Label>
|
||||||
<Input id="address" placeholder="123 Main St" value={form.address} onChange={e => setForm({...form, address: e.target.value})} className="input-depth" />
|
<Input
|
||||||
|
id="address"
|
||||||
|
placeholder="123 Main St"
|
||||||
|
value={form.address}
|
||||||
|
onChange={e => setForm({...form, address: e.target.value})}
|
||||||
|
className="input-depth"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<Button type="button" variant="secondary" onClick={() => onOpenChange(false)}>Cancel</Button>
|
<Button type="button" variant="secondary" onClick={() => onOpenChange(false)}>
|
||||||
<Button type="submit" disabled={!form.name || !form.email}>Add Client</Button>
|
Cancel
|
||||||
|
</Button>
|
||||||
|
<Button type="submit" disabled={!form.name || !form.email}>
|
||||||
|
Add Client
|
||||||
|
</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
</form>
|
</form>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,17 +20,19 @@ export default function AddExpenseDialog({open, onOpenChange}: Props) {
|
|||||||
|
|
||||||
const handleSubmit = (e: React.FormEvent) => {
|
const handleSubmit = (e: React.FormEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
dispatch(addExpense({
|
dispatch(
|
||||||
id: crypto.randomUUID(),
|
addExpense({
|
||||||
name: form.name,
|
id: crypto.randomUUID(),
|
||||||
amount: parseFloat(form.amount) || 0,
|
name: form.name,
|
||||||
frequency: form.frequency as typeof frequencies[number],
|
amount: parseFloat(form.amount) || 0,
|
||||||
category: form.category,
|
frequency: form.frequency as (typeof frequencies)[number],
|
||||||
nextDate: new Date().toISOString().split('T')[0],
|
category: form.category,
|
||||||
isActive: true,
|
nextDate: new Date().toISOString().split('T')[0],
|
||||||
isEssential: form.isEssential,
|
isActive: true,
|
||||||
createdAt: new Date().toISOString(),
|
isEssential: form.isEssential,
|
||||||
}));
|
createdAt: new Date().toISOString()
|
||||||
|
})
|
||||||
|
);
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
setForm({name: '', amount: '', frequency: '', category: '', isEssential: false});
|
setForm({name: '', amount: '', frequency: '', category: '', isEssential: false});
|
||||||
};
|
};
|
||||||
@@ -46,19 +48,42 @@ export default function AddExpenseDialog({open, onOpenChange}: Props) {
|
|||||||
<div className="grid gap-4 py-4">
|
<div className="grid gap-4 py-4">
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="name">Name</Label>
|
<Label htmlFor="name">Name</Label>
|
||||||
<Input id="name" placeholder="e.g., Netflix" value={form.name} onChange={e => setForm({...form, name: e.target.value})} className="input-depth" required />
|
<Input
|
||||||
|
id="name"
|
||||||
|
placeholder="e.g., Netflix"
|
||||||
|
value={form.name}
|
||||||
|
onChange={e => setForm({...form, name: e.target.value})}
|
||||||
|
className="input-depth"
|
||||||
|
required
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid grid-cols-2 gap-4">
|
<div className="grid grid-cols-2 gap-4">
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="amount">Amount</Label>
|
<Label htmlFor="amount">Amount</Label>
|
||||||
<Input id="amount" type="number" step="0.01" min="0" placeholder="0.00" value={form.amount} onChange={e => setForm({...form, amount: e.target.value})} className="input-depth" required />
|
<Input
|
||||||
|
id="amount"
|
||||||
|
type="number"
|
||||||
|
step="0.01"
|
||||||
|
min="0"
|
||||||
|
placeholder="0.00"
|
||||||
|
value={form.amount}
|
||||||
|
onChange={e => setForm({...form, amount: e.target.value})}
|
||||||
|
className="input-depth"
|
||||||
|
required
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label>Frequency</Label>
|
<Label>Frequency</Label>
|
||||||
<Select value={form.frequency} onValueChange={v => setForm({...form, frequency: v})} required>
|
<Select value={form.frequency} onValueChange={v => setForm({...form, frequency: v})} required>
|
||||||
<SelectTrigger className="input-depth"><SelectValue placeholder="Select" /></SelectTrigger>
|
<SelectTrigger className="input-depth">
|
||||||
|
<SelectValue placeholder="Select" />
|
||||||
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{frequencies.map(f => <SelectItem key={f} value={f} className="capitalize">{f}</SelectItem>)}
|
{frequencies.map(f => (
|
||||||
|
<SelectItem key={f} value={f} className="capitalize">
|
||||||
|
{f}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
@@ -66,24 +91,38 @@ export default function AddExpenseDialog({open, onOpenChange}: Props) {
|
|||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label>Category</Label>
|
<Label>Category</Label>
|
||||||
<Select value={form.category} onValueChange={v => setForm({...form, category: v})} required>
|
<Select value={form.category} onValueChange={v => setForm({...form, category: v})} required>
|
||||||
<SelectTrigger className="input-depth"><SelectValue placeholder="Select category" /></SelectTrigger>
|
<SelectTrigger className="input-depth">
|
||||||
|
<SelectValue placeholder="Select category" />
|
||||||
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{categories.expense.map(c => <SelectItem key={c} value={c}>{c}</SelectItem>)}
|
{categories.expense.map(c => (
|
||||||
|
<SelectItem key={c} value={c}>
|
||||||
|
{c}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
<label className="flex items-center gap-2 cursor-pointer">
|
<label className="flex items-center gap-2 cursor-pointer">
|
||||||
<input type="checkbox" checked={form.isEssential} onChange={e => setForm({...form, isEssential: e.target.checked})} className="rounded border-border" />
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
checked={form.isEssential}
|
||||||
|
onChange={e => setForm({...form, isEssential: e.target.checked})}
|
||||||
|
className="rounded border-border"
|
||||||
|
/>
|
||||||
<span className="text-sm">Essential expense (rent, utilities, etc.)</span>
|
<span className="text-sm">Essential expense (rent, utilities, etc.)</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<Button type="button" variant="secondary" onClick={() => onOpenChange(false)}>Cancel</Button>
|
<Button type="button" variant="secondary" onClick={() => onOpenChange(false)}>
|
||||||
<Button type="submit" disabled={!form.name || !form.amount || !form.frequency || !form.category}>Add Expense</Button>
|
Cancel
|
||||||
|
</Button>
|
||||||
|
<Button type="submit" disabled={!form.name || !form.amount || !form.frequency || !form.category}>
|
||||||
|
Add Expense
|
||||||
|
</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
</form>
|
</form>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,16 +20,18 @@ export default function AddIncomeDialog({open, onOpenChange}: Props) {
|
|||||||
|
|
||||||
const handleSubmit = (e: React.FormEvent) => {
|
const handleSubmit = (e: React.FormEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
dispatch(addIncomeSource({
|
dispatch(
|
||||||
id: crypto.randomUUID(),
|
addIncomeSource({
|
||||||
name: form.name,
|
id: crypto.randomUUID(),
|
||||||
amount: parseFloat(form.amount) || 0,
|
name: form.name,
|
||||||
frequency: form.frequency as typeof frequencies[number],
|
amount: parseFloat(form.amount) || 0,
|
||||||
category: form.category,
|
frequency: form.frequency as (typeof frequencies)[number],
|
||||||
nextDate: new Date().toISOString().split('T')[0],
|
category: form.category,
|
||||||
isActive: true,
|
nextDate: new Date().toISOString().split('T')[0],
|
||||||
createdAt: new Date().toISOString(),
|
isActive: true,
|
||||||
}));
|
createdAt: new Date().toISOString()
|
||||||
|
})
|
||||||
|
);
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
setForm({name: '', amount: '', frequency: '', category: ''});
|
setForm({name: '', amount: '', frequency: '', category: ''});
|
||||||
};
|
};
|
||||||
@@ -45,19 +47,42 @@ export default function AddIncomeDialog({open, onOpenChange}: Props) {
|
|||||||
<div className="grid gap-4 py-4">
|
<div className="grid gap-4 py-4">
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="name">Name</Label>
|
<Label htmlFor="name">Name</Label>
|
||||||
<Input id="name" placeholder="e.g., Salary" value={form.name} onChange={e => setForm({...form, name: e.target.value})} className="input-depth" required />
|
<Input
|
||||||
|
id="name"
|
||||||
|
placeholder="e.g., Salary"
|
||||||
|
value={form.name}
|
||||||
|
onChange={e => setForm({...form, name: e.target.value})}
|
||||||
|
className="input-depth"
|
||||||
|
required
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid grid-cols-2 gap-4">
|
<div className="grid grid-cols-2 gap-4">
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="amount">Amount</Label>
|
<Label htmlFor="amount">Amount</Label>
|
||||||
<Input id="amount" type="number" step="0.01" min="0" placeholder="0.00" value={form.amount} onChange={e => setForm({...form, amount: e.target.value})} className="input-depth" required />
|
<Input
|
||||||
|
id="amount"
|
||||||
|
type="number"
|
||||||
|
step="0.01"
|
||||||
|
min="0"
|
||||||
|
placeholder="0.00"
|
||||||
|
value={form.amount}
|
||||||
|
onChange={e => setForm({...form, amount: e.target.value})}
|
||||||
|
className="input-depth"
|
||||||
|
required
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label>Frequency</Label>
|
<Label>Frequency</Label>
|
||||||
<Select value={form.frequency} onValueChange={v => setForm({...form, frequency: v})} required>
|
<Select value={form.frequency} onValueChange={v => setForm({...form, frequency: v})} required>
|
||||||
<SelectTrigger className="input-depth"><SelectValue placeholder="Select" /></SelectTrigger>
|
<SelectTrigger className="input-depth">
|
||||||
|
<SelectValue placeholder="Select" />
|
||||||
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{frequencies.map(f => <SelectItem key={f} value={f} className="capitalize">{f}</SelectItem>)}
|
{frequencies.map(f => (
|
||||||
|
<SelectItem key={f} value={f} className="capitalize">
|
||||||
|
{f}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
@@ -65,20 +90,29 @@ export default function AddIncomeDialog({open, onOpenChange}: Props) {
|
|||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label>Category</Label>
|
<Label>Category</Label>
|
||||||
<Select value={form.category} onValueChange={v => setForm({...form, category: v})} required>
|
<Select value={form.category} onValueChange={v => setForm({...form, category: v})} required>
|
||||||
<SelectTrigger className="input-depth"><SelectValue placeholder="Select category" /></SelectTrigger>
|
<SelectTrigger className="input-depth">
|
||||||
|
<SelectValue placeholder="Select category" />
|
||||||
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{categories.income.map(c => <SelectItem key={c} value={c}>{c}</SelectItem>)}
|
{categories.income.map(c => (
|
||||||
|
<SelectItem key={c} value={c}>
|
||||||
|
{c}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<Button type="button" variant="secondary" onClick={() => onOpenChange(false)}>Cancel</Button>
|
<Button type="button" variant="secondary" onClick={() => onOpenChange(false)}>
|
||||||
<Button type="submit" disabled={!form.name || !form.amount || !form.frequency || !form.category}>Add Income</Button>
|
Cancel
|
||||||
|
</Button>
|
||||||
|
<Button type="submit" disabled={!form.name || !form.amount || !form.frequency || !form.category}>
|
||||||
|
Add Income
|
||||||
|
</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
</form>
|
</form>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export default function AddInvoiceDialog({open, onOpenChange}: Props) {
|
|||||||
clientId: '',
|
clientId: '',
|
||||||
description: '',
|
description: '',
|
||||||
amount: '',
|
amount: '',
|
||||||
dueDate: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
|
dueDate: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000).toISOString().split('T')[0]
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleSubmit = (e: React.FormEvent) => {
|
const handleSubmit = (e: React.FormEvent) => {
|
||||||
@@ -27,26 +27,30 @@ export default function AddInvoiceDialog({open, onOpenChange}: Props) {
|
|||||||
const invoiceNumber = `INV-${new Date().getFullYear()}-${String(Math.floor(Math.random() * 1000)).padStart(3, '0')}`;
|
const invoiceNumber = `INV-${new Date().getFullYear()}-${String(Math.floor(Math.random() * 1000)).padStart(3, '0')}`;
|
||||||
const amount = parseFloat(form.amount) || 0;
|
const amount = parseFloat(form.amount) || 0;
|
||||||
|
|
||||||
dispatch(addInvoice({
|
dispatch(
|
||||||
id: crypto.randomUUID(),
|
addInvoice({
|
||||||
invoiceNumber,
|
|
||||||
clientId: form.clientId,
|
|
||||||
status: 'draft',
|
|
||||||
issueDate: now.split('T')[0],
|
|
||||||
dueDate: form.dueDate,
|
|
||||||
lineItems: [{
|
|
||||||
id: crypto.randomUUID(),
|
id: crypto.randomUUID(),
|
||||||
description: form.description,
|
invoiceNumber,
|
||||||
quantity: 1,
|
clientId: form.clientId,
|
||||||
unitPrice: amount,
|
status: 'draft',
|
||||||
|
issueDate: now.split('T')[0],
|
||||||
|
dueDate: form.dueDate,
|
||||||
|
lineItems: [
|
||||||
|
{
|
||||||
|
id: crypto.randomUUID(),
|
||||||
|
description: form.description,
|
||||||
|
quantity: 1,
|
||||||
|
unitPrice: amount,
|
||||||
|
total: amount
|
||||||
|
}
|
||||||
|
],
|
||||||
|
subtotal: amount,
|
||||||
|
tax: 0,
|
||||||
total: amount,
|
total: amount,
|
||||||
}],
|
createdAt: now,
|
||||||
subtotal: amount,
|
updatedAt: now
|
||||||
tax: 0,
|
})
|
||||||
total: amount,
|
);
|
||||||
createdAt: now,
|
|
||||||
updatedAt: now,
|
|
||||||
}));
|
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
setForm({clientId: '', description: '', amount: '', dueDate: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000).toISOString().split('T')[0]});
|
setForm({clientId: '', description: '', amount: '', dueDate: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000).toISOString().split('T')[0]});
|
||||||
};
|
};
|
||||||
@@ -63,34 +67,67 @@ export default function AddInvoiceDialog({open, onOpenChange}: Props) {
|
|||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label>Client</Label>
|
<Label>Client</Label>
|
||||||
<Select value={form.clientId} onValueChange={v => setForm({...form, clientId: v})} required>
|
<Select value={form.clientId} onValueChange={v => setForm({...form, clientId: v})} required>
|
||||||
<SelectTrigger className="input-depth"><SelectValue placeholder="Select client" /></SelectTrigger>
|
<SelectTrigger className="input-depth">
|
||||||
|
<SelectValue placeholder="Select client" />
|
||||||
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{clients.map(c => <SelectItem key={c.id} value={c.id}>{c.name}</SelectItem>)}
|
{clients.map(c => (
|
||||||
|
<SelectItem key={c.id} value={c.id}>
|
||||||
|
{c.name}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="description">Description</Label>
|
<Label htmlFor="description">Description</Label>
|
||||||
<Input id="description" placeholder="e.g., Web Development Services" value={form.description} onChange={e => setForm({...form, description: e.target.value})} className="input-depth" required />
|
<Input
|
||||||
|
id="description"
|
||||||
|
placeholder="e.g., Web Development Services"
|
||||||
|
value={form.description}
|
||||||
|
onChange={e => setForm({...form, description: e.target.value})}
|
||||||
|
className="input-depth"
|
||||||
|
required
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid grid-cols-2 gap-4">
|
<div className="grid grid-cols-2 gap-4">
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="amount">Amount</Label>
|
<Label htmlFor="amount">Amount</Label>
|
||||||
<Input id="amount" type="number" step="0.01" min="0" placeholder="0.00" value={form.amount} onChange={e => setForm({...form, amount: e.target.value})} className="input-depth" required />
|
<Input
|
||||||
|
id="amount"
|
||||||
|
type="number"
|
||||||
|
step="0.01"
|
||||||
|
min="0"
|
||||||
|
placeholder="0.00"
|
||||||
|
value={form.amount}
|
||||||
|
onChange={e => setForm({...form, amount: e.target.value})}
|
||||||
|
className="input-depth"
|
||||||
|
required
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="dueDate">Due Date</Label>
|
<Label htmlFor="dueDate">Due Date</Label>
|
||||||
<Input id="dueDate" type="date" value={form.dueDate} onChange={e => setForm({...form, dueDate: e.target.value})} className="input-depth" required />
|
<Input
|
||||||
|
id="dueDate"
|
||||||
|
type="date"
|
||||||
|
value={form.dueDate}
|
||||||
|
onChange={e => setForm({...form, dueDate: e.target.value})}
|
||||||
|
className="input-depth"
|
||||||
|
required
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<Button type="button" variant="secondary" onClick={() => onOpenChange(false)}>Cancel</Button>
|
<Button type="button" variant="secondary" onClick={() => onOpenChange(false)}>
|
||||||
<Button type="submit" disabled={!form.clientId || !form.description || !form.amount}>Create Invoice</Button>
|
Cancel
|
||||||
|
</Button>
|
||||||
|
<Button type="submit" disabled={!form.clientId || !form.description || !form.amount}>
|
||||||
|
Create Invoice
|
||||||
|
</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
</form>
|
</form>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,13 +19,15 @@ export default function AddLiabilityDialog({open, onOpenChange}: Props) {
|
|||||||
|
|
||||||
const handleSubmit = (e: React.FormEvent) => {
|
const handleSubmit = (e: React.FormEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
dispatch(addLiability({
|
dispatch(
|
||||||
id: crypto.randomUUID(),
|
addLiability({
|
||||||
name: form.name,
|
id: crypto.randomUUID(),
|
||||||
type: form.type as typeof liabilityTypes[number],
|
name: form.name,
|
||||||
balance: parseFloat(form.balance) || 0,
|
type: form.type as (typeof liabilityTypes)[number],
|
||||||
updatedAt: new Date().toISOString(),
|
balance: parseFloat(form.balance) || 0,
|
||||||
}));
|
updatedAt: new Date().toISOString()
|
||||||
|
})
|
||||||
|
);
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
setForm({name: '', type: '', balance: ''});
|
setForm({name: '', type: '', balance: ''});
|
||||||
};
|
};
|
||||||
@@ -41,29 +43,55 @@ export default function AddLiabilityDialog({open, onOpenChange}: Props) {
|
|||||||
<div className="grid gap-4 py-4">
|
<div className="grid gap-4 py-4">
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="name">Name</Label>
|
<Label htmlFor="name">Name</Label>
|
||||||
<Input id="name" placeholder="e.g., Car Loan" value={form.name} onChange={e => setForm({...form, name: e.target.value})} className="input-depth" required />
|
<Input
|
||||||
|
id="name"
|
||||||
|
placeholder="e.g., Car Loan"
|
||||||
|
value={form.name}
|
||||||
|
onChange={e => setForm({...form, name: e.target.value})}
|
||||||
|
className="input-depth"
|
||||||
|
required
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label>Type</Label>
|
<Label>Type</Label>
|
||||||
<Select value={form.type} onValueChange={v => setForm({...form, type: v})} required>
|
<Select value={form.type} onValueChange={v => setForm({...form, type: v})} required>
|
||||||
<SelectTrigger className="input-depth"><SelectValue placeholder="Select type" /></SelectTrigger>
|
<SelectTrigger className="input-depth">
|
||||||
|
<SelectValue placeholder="Select type" />
|
||||||
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{liabilityTypes.map(t => <SelectItem key={t} value={t} className="capitalize">{t.replace('_', ' ')}</SelectItem>)}
|
{liabilityTypes.map(t => (
|
||||||
|
<SelectItem key={t} value={t} className="capitalize">
|
||||||
|
{t.replace('_', ' ')}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="balance">Balance</Label>
|
<Label htmlFor="balance">Balance</Label>
|
||||||
<Input id="balance" type="number" step="0.01" min="0" placeholder="0.00" value={form.balance} onChange={e => setForm({...form, balance: e.target.value})} className="input-depth" required />
|
<Input
|
||||||
|
id="balance"
|
||||||
|
type="number"
|
||||||
|
step="0.01"
|
||||||
|
min="0"
|
||||||
|
placeholder="0.00"
|
||||||
|
value={form.balance}
|
||||||
|
onChange={e => setForm({...form, balance: e.target.value})}
|
||||||
|
className="input-depth"
|
||||||
|
required
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<Button type="button" variant="secondary" onClick={() => onOpenChange(false)}>Cancel</Button>
|
<Button type="button" variant="secondary" onClick={() => onOpenChange(false)}>
|
||||||
<Button type="submit" disabled={!form.name || !form.type || !form.balance}>Add Liability</Button>
|
Cancel
|
||||||
|
</Button>
|
||||||
|
<Button type="submit" disabled={!form.name || !form.type || !form.balance}>
|
||||||
|
Add Liability
|
||||||
|
</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
</form>
|
</form>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,14 +18,16 @@ export default function AddTransactionDialog({open, onOpenChange}: Props) {
|
|||||||
|
|
||||||
const handleSubmit = (e: React.FormEvent) => {
|
const handleSubmit = (e: React.FormEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
dispatch(addTransaction({
|
dispatch(
|
||||||
id: crypto.randomUUID(),
|
addTransaction({
|
||||||
type: form.type,
|
id: crypto.randomUUID(),
|
||||||
name: form.name,
|
type: form.type,
|
||||||
amount: parseFloat(form.amount) || 0,
|
name: form.name,
|
||||||
category: form.category,
|
amount: parseFloat(form.amount) || 0,
|
||||||
date: form.date,
|
category: form.category,
|
||||||
}));
|
date: form.date
|
||||||
|
})
|
||||||
|
);
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
setForm({type: 'expense', name: '', amount: '', category: '', date: new Date().toISOString().split('T')[0]});
|
setForm({type: 'expense', name: '', amount: '', category: '', date: new Date().toISOString().split('T')[0]});
|
||||||
};
|
};
|
||||||
@@ -44,7 +46,9 @@ export default function AddTransactionDialog({open, onOpenChange}: Props) {
|
|||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label>Type</Label>
|
<Label>Type</Label>
|
||||||
<Select value={form.type} onValueChange={v => setForm({...form, type: v as 'income' | 'expense', category: ''})}>
|
<Select value={form.type} onValueChange={v => setForm({...form, type: v as 'income' | 'expense', category: ''})}>
|
||||||
<SelectTrigger className="input-depth"><SelectValue /></SelectTrigger>
|
<SelectTrigger className="input-depth">
|
||||||
|
<SelectValue />
|
||||||
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
<SelectItem value="income">Income</SelectItem>
|
<SelectItem value="income">Income</SelectItem>
|
||||||
<SelectItem value="expense">Expense</SelectItem>
|
<SelectItem value="expense">Expense</SelectItem>
|
||||||
@@ -53,12 +57,29 @@ export default function AddTransactionDialog({open, onOpenChange}: Props) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="name">Description</Label>
|
<Label htmlFor="name">Description</Label>
|
||||||
<Input id="name" placeholder="e.g., Groceries" value={form.name} onChange={e => setForm({...form, name: e.target.value})} className="input-depth" required />
|
<Input
|
||||||
|
id="name"
|
||||||
|
placeholder="e.g., Groceries"
|
||||||
|
value={form.name}
|
||||||
|
onChange={e => setForm({...form, name: e.target.value})}
|
||||||
|
className="input-depth"
|
||||||
|
required
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid grid-cols-2 gap-4">
|
<div className="grid grid-cols-2 gap-4">
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="amount">Amount</Label>
|
<Label htmlFor="amount">Amount</Label>
|
||||||
<Input id="amount" type="number" step="0.01" min="0" placeholder="0.00" value={form.amount} onChange={e => setForm({...form, amount: e.target.value})} className="input-depth" required />
|
<Input
|
||||||
|
id="amount"
|
||||||
|
type="number"
|
||||||
|
step="0.01"
|
||||||
|
min="0"
|
||||||
|
placeholder="0.00"
|
||||||
|
value={form.amount}
|
||||||
|
onChange={e => setForm({...form, amount: e.target.value})}
|
||||||
|
className="input-depth"
|
||||||
|
required
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="date">Date</Label>
|
<Label htmlFor="date">Date</Label>
|
||||||
@@ -68,20 +89,29 @@ export default function AddTransactionDialog({open, onOpenChange}: Props) {
|
|||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label>Category</Label>
|
<Label>Category</Label>
|
||||||
<Select value={form.category} onValueChange={v => setForm({...form, category: v})} required>
|
<Select value={form.category} onValueChange={v => setForm({...form, category: v})} required>
|
||||||
<SelectTrigger className="input-depth"><SelectValue placeholder="Select category" /></SelectTrigger>
|
<SelectTrigger className="input-depth">
|
||||||
|
<SelectValue placeholder="Select category" />
|
||||||
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{categoryList.map(c => <SelectItem key={c} value={c}>{c}</SelectItem>)}
|
{categoryList.map(c => (
|
||||||
|
<SelectItem key={c} value={c}>
|
||||||
|
{c}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<Button type="button" variant="secondary" onClick={() => onOpenChange(false)}>Cancel</Button>
|
<Button type="button" variant="secondary" onClick={() => onOpenChange(false)}>
|
||||||
<Button type="submit" disabled={!form.name || !form.amount || !form.category}>Add Transaction</Button>
|
Cancel
|
||||||
|
</Button>
|
||||||
|
<Button type="submit" disabled={!form.name || !form.amount || !form.category}>
|
||||||
|
Add Transaction
|
||||||
|
</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
</form>
|
</form>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export default function EditAssetDialog({open, onOpenChange, asset}: Props) {
|
|||||||
setForm({
|
setForm({
|
||||||
name: asset.name,
|
name: asset.name,
|
||||||
type: asset.type,
|
type: asset.type,
|
||||||
value: asset.value.toString(),
|
value: asset.value.toString()
|
||||||
});
|
});
|
||||||
setErrors({name: '', value: ''});
|
setErrors({name: '', value: ''});
|
||||||
}
|
}
|
||||||
@@ -57,13 +57,15 @@ export default function EditAssetDialog({open, onOpenChange, asset}: Props) {
|
|||||||
const valueNum = validatePositiveNumber(form.value);
|
const valueNum = validatePositiveNumber(form.value);
|
||||||
if (valueNum === null) return;
|
if (valueNum === null) return;
|
||||||
|
|
||||||
dispatch(updateAsset({
|
dispatch(
|
||||||
id: asset.id,
|
updateAsset({
|
||||||
name: form.name.trim(),
|
id: asset.id,
|
||||||
type: form.type as typeof assetTypes[number],
|
name: form.name.trim(),
|
||||||
value: valueNum,
|
type: form.type as (typeof assetTypes)[number],
|
||||||
updatedAt: new Date().toISOString(),
|
value: valueNum,
|
||||||
}));
|
updatedAt: new Date().toISOString()
|
||||||
|
})
|
||||||
|
);
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -101,9 +103,15 @@ export default function EditAssetDialog({open, onOpenChange, asset}: Props) {
|
|||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label>Type</Label>
|
<Label>Type</Label>
|
||||||
<Select value={form.type} onValueChange={v => setForm({...form, type: v})} required>
|
<Select value={form.type} onValueChange={v => setForm({...form, type: v})} required>
|
||||||
<SelectTrigger className="input-depth"><SelectValue placeholder="Select type" /></SelectTrigger>
|
<SelectTrigger className="input-depth">
|
||||||
|
<SelectValue placeholder="Select type" />
|
||||||
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{assetTypes.map(t => <SelectItem key={t} value={t} className="capitalize">{t}</SelectItem>)}
|
{assetTypes.map(t => (
|
||||||
|
<SelectItem key={t} value={t} className="capitalize">
|
||||||
|
{t}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
@@ -128,7 +136,9 @@ export default function EditAssetDialog({open, onOpenChange, asset}: Props) {
|
|||||||
Delete
|
Delete
|
||||||
</Button>
|
</Button>
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
<Button type="button" variant="secondary" onClick={() => onOpenChange(false)}>Cancel</Button>
|
<Button type="button" variant="secondary" onClick={() => onOpenChange(false)}>
|
||||||
|
Cancel
|
||||||
|
</Button>
|
||||||
<Button type="submit">Save Changes</Button>
|
<Button type="submit">Save Changes</Button>
|
||||||
</div>
|
</div>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export default function EditClientDialog({open, onOpenChange, client}: Props) {
|
|||||||
phone: '',
|
phone: '',
|
||||||
company: '',
|
company: '',
|
||||||
address: '',
|
address: '',
|
||||||
notes: '',
|
notes: ''
|
||||||
});
|
});
|
||||||
const [errors, setErrors] = useState({name: '', email: '', phone: ''});
|
const [errors, setErrors] = useState({name: '', email: '', phone: ''});
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ export default function EditClientDialog({open, onOpenChange, client}: Props) {
|
|||||||
phone: client.phone || '',
|
phone: client.phone || '',
|
||||||
company: client.company || '',
|
company: client.company || '',
|
||||||
address: client.address || '',
|
address: client.address || '',
|
||||||
notes: client.notes || '',
|
notes: client.notes || ''
|
||||||
});
|
});
|
||||||
setErrors({name: '', email: '', phone: ''});
|
setErrors({name: '', email: '', phone: ''});
|
||||||
}
|
}
|
||||||
@@ -65,16 +65,18 @@ export default function EditClientDialog({open, onOpenChange, client}: Props) {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (!client || !validate()) return;
|
if (!client || !validate()) return;
|
||||||
|
|
||||||
dispatch(updateClient({
|
dispatch(
|
||||||
id: client.id,
|
updateClient({
|
||||||
name: sanitizeString(form.name),
|
id: client.id,
|
||||||
email: sanitizeString(form.email),
|
name: sanitizeString(form.name),
|
||||||
phone: form.phone ? sanitizeString(form.phone) : undefined,
|
email: sanitizeString(form.email),
|
||||||
company: form.company ? sanitizeString(form.company) : undefined,
|
phone: form.phone ? sanitizeString(form.phone) : undefined,
|
||||||
address: form.address ? sanitizeString(form.address) : undefined,
|
company: form.company ? sanitizeString(form.company) : undefined,
|
||||||
notes: form.notes ? sanitizeString(form.notes) : undefined,
|
address: form.address ? sanitizeString(form.address) : undefined,
|
||||||
createdAt: client.createdAt,
|
notes: form.notes ? sanitizeString(form.notes) : undefined,
|
||||||
}));
|
createdAt: client.createdAt
|
||||||
|
})
|
||||||
|
);
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -99,13 +101,7 @@ export default function EditClientDialog({open, onOpenChange, client}: Props) {
|
|||||||
<div className="grid gap-4 py-4 max-h-[60vh] overflow-y-auto">
|
<div className="grid gap-4 py-4 max-h-[60vh] overflow-y-auto">
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="edit-name">Name *</Label>
|
<Label htmlFor="edit-name">Name *</Label>
|
||||||
<Input
|
<Input id="edit-name" value={form.name} onChange={e => setForm({...form, name: e.target.value})} className="input-depth" required />
|
||||||
id="edit-name"
|
|
||||||
value={form.name}
|
|
||||||
onChange={e => setForm({...form, name: e.target.value})}
|
|
||||||
className="input-depth"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
{errors.name && <p className="text-xs text-red-400">{errors.name}</p>}
|
{errors.name && <p className="text-xs text-red-400">{errors.name}</p>}
|
||||||
</div>
|
</div>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
@@ -122,41 +118,20 @@ export default function EditClientDialog({open, onOpenChange, client}: Props) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="edit-phone">Phone</Label>
|
<Label htmlFor="edit-phone">Phone</Label>
|
||||||
<Input
|
<Input id="edit-phone" type="tel" value={form.phone} onChange={e => setForm({...form, phone: e.target.value})} className="input-depth" />
|
||||||
id="edit-phone"
|
|
||||||
type="tel"
|
|
||||||
value={form.phone}
|
|
||||||
onChange={e => setForm({...form, phone: e.target.value})}
|
|
||||||
className="input-depth"
|
|
||||||
/>
|
|
||||||
{errors.phone && <p className="text-xs text-red-400">{errors.phone}</p>}
|
{errors.phone && <p className="text-xs text-red-400">{errors.phone}</p>}
|
||||||
</div>
|
</div>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="edit-company">Company</Label>
|
<Label htmlFor="edit-company">Company</Label>
|
||||||
<Input
|
<Input id="edit-company" value={form.company} onChange={e => setForm({...form, company: e.target.value})} className="input-depth" />
|
||||||
id="edit-company"
|
|
||||||
value={form.company}
|
|
||||||
onChange={e => setForm({...form, company: e.target.value})}
|
|
||||||
className="input-depth"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="edit-address">Address</Label>
|
<Label htmlFor="edit-address">Address</Label>
|
||||||
<Input
|
<Input id="edit-address" value={form.address} onChange={e => setForm({...form, address: e.target.value})} className="input-depth" />
|
||||||
id="edit-address"
|
|
||||||
value={form.address}
|
|
||||||
onChange={e => setForm({...form, address: e.target.value})}
|
|
||||||
className="input-depth"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label htmlFor="edit-notes">Notes</Label>
|
<Label htmlFor="edit-notes">Notes</Label>
|
||||||
<Input
|
<Input id="edit-notes" value={form.notes} onChange={e => setForm({...form, notes: e.target.value})} className="input-depth" />
|
||||||
id="edit-notes"
|
|
||||||
value={form.notes}
|
|
||||||
onChange={e => setForm({...form, notes: e.target.value})}
|
|
||||||
className="input-depth"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<DialogFooter className="flex justify-between sm:justify-between">
|
<DialogFooter className="flex justify-between sm:justify-between">
|
||||||
@@ -164,7 +139,9 @@ export default function EditClientDialog({open, onOpenChange, client}: Props) {
|
|||||||
Delete
|
Delete
|
||||||
</Button>
|
</Button>
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
<Button type="button" variant="secondary" onClick={() => onOpenChange(false)}>Cancel</Button>
|
<Button type="button" variant="secondary" onClick={() => onOpenChange(false)}>
|
||||||
|
Cancel
|
||||||
|
</Button>
|
||||||
<Button type="submit">Save Changes</Button>
|
<Button type="submit">Save Changes</Button>
|
||||||
</div>
|
</div>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export default function EditLiabilityDialog({open, onOpenChange, liability}: Pro
|
|||||||
setForm({
|
setForm({
|
||||||
name: liability.name,
|
name: liability.name,
|
||||||
type: liability.type,
|
type: liability.type,
|
||||||
balance: liability.balance.toString(),
|
balance: liability.balance.toString()
|
||||||
});
|
});
|
||||||
setErrors({name: '', balance: ''});
|
setErrors({name: '', balance: ''});
|
||||||
}
|
}
|
||||||
@@ -57,13 +57,15 @@ export default function EditLiabilityDialog({open, onOpenChange, liability}: Pro
|
|||||||
const balanceNum = validatePositiveNumber(form.balance);
|
const balanceNum = validatePositiveNumber(form.balance);
|
||||||
if (balanceNum === null) return;
|
if (balanceNum === null) return;
|
||||||
|
|
||||||
dispatch(updateLiability({
|
dispatch(
|
||||||
id: liability.id,
|
updateLiability({
|
||||||
name: form.name.trim(),
|
id: liability.id,
|
||||||
type: form.type as typeof liabilityTypes[number],
|
name: form.name.trim(),
|
||||||
balance: balanceNum,
|
type: form.type as (typeof liabilityTypes)[number],
|
||||||
updatedAt: new Date().toISOString(),
|
balance: balanceNum,
|
||||||
}));
|
updatedAt: new Date().toISOString()
|
||||||
|
})
|
||||||
|
);
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -101,7 +103,9 @@ export default function EditLiabilityDialog({open, onOpenChange, liability}: Pro
|
|||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label>Type</Label>
|
<Label>Type</Label>
|
||||||
<Select value={form.type} onValueChange={v => setForm({...form, type: v})} required>
|
<Select value={form.type} onValueChange={v => setForm({...form, type: v})} required>
|
||||||
<SelectTrigger className="input-depth"><SelectValue placeholder="Select type" /></SelectTrigger>
|
<SelectTrigger className="input-depth">
|
||||||
|
<SelectValue placeholder="Select type" />
|
||||||
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{liabilityTypes.map(t => (
|
{liabilityTypes.map(t => (
|
||||||
<SelectItem key={t} value={t} className="capitalize">
|
<SelectItem key={t} value={t} className="capitalize">
|
||||||
@@ -132,7 +136,9 @@ export default function EditLiabilityDialog({open, onOpenChange, liability}: Pro
|
|||||||
Delete
|
Delete
|
||||||
</Button>
|
</Button>
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
<Button type="button" variant="secondary" onClick={() => onOpenChange(false)}>Cancel</Button>
|
<Button type="button" variant="secondary" onClick={() => onOpenChange(false)}>
|
||||||
|
Cancel
|
||||||
|
</Button>
|
||||||
<Button type="submit">Save Changes</Button>
|
<Button type="submit">Save Changes</Button>
|
||||||
</div>
|
</div>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const statusColors: Record<Invoice['status'], string> = {
|
|||||||
sent: 'text-blue-400',
|
sent: 'text-blue-400',
|
||||||
paid: 'text-green-400',
|
paid: 'text-green-400',
|
||||||
overdue: 'text-red-400',
|
overdue: 'text-red-400',
|
||||||
cancelled: 'text-gray-500',
|
cancelled: 'text-gray-500'
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function InvoiceDetailsDialog({open, onOpenChange, invoice, clients}: Props) {
|
export default function InvoiceDetailsDialog({open, onOpenChange, invoice, clients}: Props) {
|
||||||
@@ -57,9 +57,7 @@ export default function InvoiceDetailsDialog({open, onOpenChange, invoice, clien
|
|||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle className="flex items-center justify-between">
|
<DialogTitle className="flex items-center justify-between">
|
||||||
<span>Invoice {invoice.invoiceNumber}</span>
|
<span>Invoice {invoice.invoiceNumber}</span>
|
||||||
<span className={`text-sm font-normal capitalize ${statusColors[invoice.status]}`}>
|
<span className={`text-sm font-normal capitalize ${statusColors[invoice.status]}`}>{invoice.status}</span>
|
||||||
{invoice.status}
|
|
||||||
</span>
|
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
<DialogDescription>View invoice details and update status</DialogDescription>
|
<DialogDescription>View invoice details and update status</DialogDescription>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
@@ -124,7 +122,7 @@ export default function InvoiceDetailsDialog({open, onOpenChange, invoice, clien
|
|||||||
{/* Status Update */}
|
{/* Status Update */}
|
||||||
<div>
|
<div>
|
||||||
<p className="text-xs text-muted-foreground mb-2">Update Status</p>
|
<p className="text-xs text-muted-foreground mb-2">Update Status</p>
|
||||||
<Select value={selectedStatus} onValueChange={(v) => setSelectedStatus(v as Invoice['status'])}>
|
<Select value={selectedStatus} onValueChange={v => setSelectedStatus(v as Invoice['status'])}>
|
||||||
<SelectTrigger className="input-depth">
|
<SelectTrigger className="input-depth">
|
||||||
<SelectValue />
|
<SelectValue />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
@@ -147,11 +145,7 @@ export default function InvoiceDetailsDialog({open, onOpenChange, invoice, clien
|
|||||||
<Button type="button" variant="secondary" onClick={() => onOpenChange(false)}>
|
<Button type="button" variant="secondary" onClick={() => onOpenChange(false)}>
|
||||||
Close
|
Close
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button type="button" onClick={handleStatusChange} disabled={selectedStatus === invoice.status}>
|
||||||
type="button"
|
|
||||||
onClick={handleStatusChange}
|
|
||||||
disabled={selectedStatus === invoice.status}
|
|
||||||
>
|
|
||||||
Update Status
|
Update Status
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,40 +1,37 @@
|
|||||||
import * as React from "react"
|
import * as React from 'react';
|
||||||
import { Slot } from "@radix-ui/react-slot"
|
import {Slot} from '@radix-ui/react-slot';
|
||||||
import { cva, type VariantProps } from "class-variance-authority"
|
import {cva, type VariantProps} from 'class-variance-authority';
|
||||||
|
|
||||||
import { cn } from "@/lib/utils"
|
import {cn} from '@/lib/utils';
|
||||||
|
|
||||||
const buttonVariants = cva(
|
const buttonVariants = cva(
|
||||||
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
||||||
{
|
{
|
||||||
variants: {
|
variants: {
|
||||||
variant: {
|
variant: {
|
||||||
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
default: 'bg-primary text-primary-foreground hover:bg-primary/90',
|
||||||
destructive:
|
destructive:
|
||||||
"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
'bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',
|
||||||
outline:
|
outline: 'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',
|
||||||
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
||||||
secondary:
|
ghost: 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',
|
||||||
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
link: 'text-primary underline-offset-4 hover:underline'
|
||||||
ghost:
|
|
||||||
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
||||||
link: "text-primary underline-offset-4 hover:underline",
|
|
||||||
},
|
},
|
||||||
size: {
|
size: {
|
||||||
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
default: 'h-9 px-4 py-2 has-[>svg]:px-3',
|
||||||
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
sm: 'h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5',
|
||||||
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
lg: 'h-10 rounded-md px-6 has-[>svg]:px-4',
|
||||||
icon: "size-9",
|
icon: 'size-9',
|
||||||
"icon-sm": "size-8",
|
'icon-sm': 'size-8',
|
||||||
"icon-lg": "size-10",
|
'icon-lg': 'size-10'
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
defaultVariants: {
|
defaultVariants: {
|
||||||
variant: "default",
|
variant: 'default',
|
||||||
size: "default",
|
size: 'default'
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
|
|
||||||
function Button({
|
function Button({
|
||||||
className,
|
className,
|
||||||
@@ -42,19 +39,13 @@ function Button({
|
|||||||
size,
|
size,
|
||||||
asChild = false,
|
asChild = false,
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<"button"> &
|
}: React.ComponentProps<'button'> &
|
||||||
VariantProps<typeof buttonVariants> & {
|
VariantProps<typeof buttonVariants> & {
|
||||||
asChild?: boolean
|
asChild?: boolean;
|
||||||
}) {
|
}) {
|
||||||
const Comp = asChild ? Slot : "button"
|
const Comp = asChild ? Slot : 'button';
|
||||||
|
|
||||||
return (
|
return <Comp data-slot="button" className={cn(buttonVariants({variant, size, className}))} {...props} />;
|
||||||
<Comp
|
|
||||||
data-slot="button"
|
|
||||||
className={cn(buttonVariants({ variant, size, className }))}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Button, buttonVariants }
|
export {Button, buttonVariants};
|
||||||
|
|||||||
@@ -1,92 +1,42 @@
|
|||||||
import * as React from "react"
|
import * as React from 'react';
|
||||||
|
|
||||||
import { cn } from "@/lib/utils"
|
import {cn} from '@/lib/utils';
|
||||||
|
|
||||||
function Card({ className, ...props }: React.ComponentProps<"div">) {
|
function Card({className, ...props}: React.ComponentProps<'div'>) {
|
||||||
return (
|
return <div data-slot="card" className={cn('bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm', className)} {...props} />;
|
||||||
<div
|
|
||||||
data-slot="card"
|
|
||||||
className={cn(
|
|
||||||
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
|
||||||
className
|
|
||||||
)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
function CardHeader({className, ...props}: React.ComponentProps<'div'>) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-slot="card-header"
|
data-slot="card-header"
|
||||||
className={cn(
|
className={cn(
|
||||||
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
'@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6',
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
function CardTitle({className, ...props}: React.ComponentProps<'div'>) {
|
||||||
return (
|
return <div data-slot="card-title" className={cn('leading-none font-semibold', className)} {...props} />;
|
||||||
<div
|
|
||||||
data-slot="card-title"
|
|
||||||
className={cn("leading-none font-semibold", className)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
function CardDescription({className, ...props}: React.ComponentProps<'div'>) {
|
||||||
return (
|
return <div data-slot="card-description" className={cn('text-muted-foreground text-sm', className)} {...props} />;
|
||||||
<div
|
|
||||||
data-slot="card-description"
|
|
||||||
className={cn("text-muted-foreground text-sm", className)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
function CardAction({className, ...props}: React.ComponentProps<'div'>) {
|
||||||
return (
|
return <div data-slot="card-action" className={cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', className)} {...props} />;
|
||||||
<div
|
|
||||||
data-slot="card-action"
|
|
||||||
className={cn(
|
|
||||||
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
||||||
className
|
|
||||||
)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
function CardContent({className, ...props}: React.ComponentProps<'div'>) {
|
||||||
return (
|
return <div data-slot="card-content" className={cn('px-6', className)} {...props} />;
|
||||||
<div
|
|
||||||
data-slot="card-content"
|
|
||||||
className={cn("px-6", className)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
function CardFooter({className, ...props}: React.ComponentProps<'div'>) {
|
||||||
return (
|
return <div data-slot="card-footer" className={cn('flex items-center px-6 [.border-t]:pt-6', className)} {...props} />;
|
||||||
<div
|
|
||||||
data-slot="card-footer"
|
|
||||||
className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent};
|
||||||
Card,
|
|
||||||
CardHeader,
|
|
||||||
CardFooter,
|
|
||||||
CardTitle,
|
|
||||||
CardAction,
|
|
||||||
CardDescription,
|
|
||||||
CardContent,
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,47 +1,36 @@
|
|||||||
import * as React from "react"
|
import * as React from 'react';
|
||||||
import * as DialogPrimitive from "@radix-ui/react-dialog"
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
||||||
import { XIcon } from "lucide-react"
|
import {XIcon} from 'lucide-react';
|
||||||
|
|
||||||
import { cn } from "@/lib/utils"
|
import {cn} from '@/lib/utils';
|
||||||
|
|
||||||
function Dialog({
|
function Dialog({...props}: React.ComponentProps<typeof DialogPrimitive.Root>) {
|
||||||
...props
|
return <DialogPrimitive.Root data-slot="dialog" {...props} />;
|
||||||
}: React.ComponentProps<typeof DialogPrimitive.Root>) {
|
|
||||||
return <DialogPrimitive.Root data-slot="dialog" {...props} />
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function DialogTrigger({
|
function DialogTrigger({...props}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
|
||||||
...props
|
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
|
||||||
}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
|
|
||||||
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function DialogPortal({
|
function DialogPortal({...props}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
|
||||||
...props
|
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
|
||||||
}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
|
|
||||||
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function DialogClose({
|
function DialogClose({...props}: React.ComponentProps<typeof DialogPrimitive.Close>) {
|
||||||
...props
|
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
|
||||||
}: React.ComponentProps<typeof DialogPrimitive.Close>) {
|
|
||||||
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function DialogOverlay({
|
function DialogOverlay({className, ...props}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
|
||||||
className,
|
|
||||||
...props
|
|
||||||
}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
|
|
||||||
return (
|
return (
|
||||||
<DialogPrimitive.Overlay
|
<DialogPrimitive.Overlay
|
||||||
data-slot="dialog-overlay"
|
data-slot="dialog-overlay"
|
||||||
className={cn(
|
className={cn(
|
||||||
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function DialogContent({
|
function DialogContent({
|
||||||
@@ -50,7 +39,7 @@ function DialogContent({
|
|||||||
showCloseButton = true,
|
showCloseButton = true,
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
||||||
showCloseButton?: boolean
|
showCloseButton?: boolean;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<DialogPortal data-slot="dialog-portal">
|
<DialogPortal data-slot="dialog-portal">
|
||||||
@@ -58,84 +47,38 @@ function DialogContent({
|
|||||||
<DialogPrimitive.Content
|
<DialogPrimitive.Content
|
||||||
data-slot="dialog-content"
|
data-slot="dialog-content"
|
||||||
className={cn(
|
className={cn(
|
||||||
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
|
'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg',
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}>
|
||||||
>
|
|
||||||
{children}
|
{children}
|
||||||
{showCloseButton && (
|
{showCloseButton && (
|
||||||
<DialogPrimitive.Close
|
<DialogPrimitive.Close
|
||||||
data-slot="dialog-close"
|
data-slot="dialog-close"
|
||||||
className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
|
className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4">
|
||||||
>
|
|
||||||
<XIcon />
|
<XIcon />
|
||||||
<span className="sr-only">Close</span>
|
<span className="sr-only">Close</span>
|
||||||
</DialogPrimitive.Close>
|
</DialogPrimitive.Close>
|
||||||
)}
|
)}
|
||||||
</DialogPrimitive.Content>
|
</DialogPrimitive.Content>
|
||||||
</DialogPortal>
|
</DialogPortal>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
|
function DialogHeader({className, ...props}: React.ComponentProps<'div'>) {
|
||||||
return (
|
return <div data-slot="dialog-header" className={cn('flex flex-col gap-2 text-center sm:text-left', className)} {...props} />;
|
||||||
<div
|
|
||||||
data-slot="dialog-header"
|
|
||||||
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
|
function DialogFooter({className, ...props}: React.ComponentProps<'div'>) {
|
||||||
return (
|
return <div data-slot="dialog-footer" className={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className)} {...props} />;
|
||||||
<div
|
|
||||||
data-slot="dialog-footer"
|
|
||||||
className={cn(
|
|
||||||
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
||||||
className
|
|
||||||
)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function DialogTitle({
|
function DialogTitle({className, ...props}: React.ComponentProps<typeof DialogPrimitive.Title>) {
|
||||||
className,
|
return <DialogPrimitive.Title data-slot="dialog-title" className={cn('text-lg leading-none font-semibold', className)} {...props} />;
|
||||||
...props
|
|
||||||
}: React.ComponentProps<typeof DialogPrimitive.Title>) {
|
|
||||||
return (
|
|
||||||
<DialogPrimitive.Title
|
|
||||||
data-slot="dialog-title"
|
|
||||||
className={cn("text-lg leading-none font-semibold", className)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function DialogDescription({
|
function DialogDescription({className, ...props}: React.ComponentProps<typeof DialogPrimitive.Description>) {
|
||||||
className,
|
return <DialogPrimitive.Description data-slot="dialog-description" className={cn('text-muted-foreground text-sm', className)} {...props} />;
|
||||||
...props
|
|
||||||
}: React.ComponentProps<typeof DialogPrimitive.Description>) {
|
|
||||||
return (
|
|
||||||
<DialogPrimitive.Description
|
|
||||||
data-slot="dialog-description"
|
|
||||||
className={cn("text-muted-foreground text-sm", className)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger};
|
||||||
Dialog,
|
|
||||||
DialogClose,
|
|
||||||
DialogContent,
|
|
||||||
DialogDescription,
|
|
||||||
DialogFooter,
|
|
||||||
DialogHeader,
|
|
||||||
DialogOverlay,
|
|
||||||
DialogPortal,
|
|
||||||
DialogTitle,
|
|
||||||
DialogTrigger,
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
import * as React from "react"
|
import * as React from 'react';
|
||||||
|
|
||||||
import { cn } from "@/lib/utils"
|
import {cn} from '@/lib/utils';
|
||||||
|
|
||||||
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
function Input({className, type, ...props}: React.ComponentProps<'input'>) {
|
||||||
return (
|
return (
|
||||||
<input
|
<input
|
||||||
type={type}
|
type={type}
|
||||||
data-slot="input"
|
data-slot="input"
|
||||||
className={cn(
|
className={cn(
|
||||||
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
'file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
|
||||||
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]',
|
||||||
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Input }
|
export {Input};
|
||||||
|
|||||||
@@ -1,22 +1,19 @@
|
|||||||
import * as React from "react"
|
import * as React from 'react';
|
||||||
import * as LabelPrimitive from "@radix-ui/react-label"
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
||||||
|
|
||||||
import { cn } from "@/lib/utils"
|
import {cn} from '@/lib/utils';
|
||||||
|
|
||||||
function Label({
|
function Label({className, ...props}: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
||||||
className,
|
|
||||||
...props
|
|
||||||
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
|
||||||
return (
|
return (
|
||||||
<LabelPrimitive.Root
|
<LabelPrimitive.Root
|
||||||
data-slot="label"
|
data-slot="label"
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
'flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Label }
|
export {Label};
|
||||||
|
|||||||
@@ -1,36 +1,30 @@
|
|||||||
"use client"
|
'use client';
|
||||||
|
|
||||||
import * as React from "react"
|
import * as React from 'react';
|
||||||
import * as SelectPrimitive from "@radix-ui/react-select"
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
||||||
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react"
|
import {CheckIcon, ChevronDownIcon, ChevronUpIcon} from 'lucide-react';
|
||||||
|
|
||||||
import { cn } from "@/lib/utils"
|
import {cn} from '@/lib/utils';
|
||||||
|
|
||||||
function Select({
|
function Select({...props}: React.ComponentProps<typeof SelectPrimitive.Root>) {
|
||||||
...props
|
return <SelectPrimitive.Root data-slot="select" {...props} />;
|
||||||
}: React.ComponentProps<typeof SelectPrimitive.Root>) {
|
|
||||||
return <SelectPrimitive.Root data-slot="select" {...props} />
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function SelectGroup({
|
function SelectGroup({...props}: React.ComponentProps<typeof SelectPrimitive.Group>) {
|
||||||
...props
|
return <SelectPrimitive.Group data-slot="select-group" {...props} />;
|
||||||
}: React.ComponentProps<typeof SelectPrimitive.Group>) {
|
|
||||||
return <SelectPrimitive.Group data-slot="select-group" {...props} />
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function SelectValue({
|
function SelectValue({...props}: React.ComponentProps<typeof SelectPrimitive.Value>) {
|
||||||
...props
|
return <SelectPrimitive.Value data-slot="select-value" {...props} />;
|
||||||
}: React.ComponentProps<typeof SelectPrimitive.Value>) {
|
|
||||||
return <SelectPrimitive.Value data-slot="select-value" {...props} />
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function SelectTrigger({
|
function SelectTrigger({
|
||||||
className,
|
className,
|
||||||
size = "default",
|
size = 'default',
|
||||||
children,
|
children,
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
||||||
size?: "sm" | "default"
|
size?: 'sm' | 'default';
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<SelectPrimitive.Trigger
|
<SelectPrimitive.Trigger
|
||||||
@@ -40,71 +34,45 @@ function SelectTrigger({
|
|||||||
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}>
|
||||||
>
|
|
||||||
{children}
|
{children}
|
||||||
<SelectPrimitive.Icon asChild>
|
<SelectPrimitive.Icon asChild>
|
||||||
<ChevronDownIcon className="size-4 opacity-50" />
|
<ChevronDownIcon className="size-4 opacity-50" />
|
||||||
</SelectPrimitive.Icon>
|
</SelectPrimitive.Icon>
|
||||||
</SelectPrimitive.Trigger>
|
</SelectPrimitive.Trigger>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function SelectContent({
|
function SelectContent({className, children, position = 'popper', align = 'center', ...props}: React.ComponentProps<typeof SelectPrimitive.Content>) {
|
||||||
className,
|
|
||||||
children,
|
|
||||||
position = "popper",
|
|
||||||
align = "center",
|
|
||||||
...props
|
|
||||||
}: React.ComponentProps<typeof SelectPrimitive.Content>) {
|
|
||||||
return (
|
return (
|
||||||
<SelectPrimitive.Portal>
|
<SelectPrimitive.Portal>
|
||||||
<SelectPrimitive.Content
|
<SelectPrimitive.Content
|
||||||
data-slot="select-content"
|
data-slot="select-content"
|
||||||
className={cn(
|
className={cn(
|
||||||
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
|
'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md',
|
||||||
position === "popper" &&
|
position === 'popper' &&
|
||||||
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
position={position}
|
position={position}
|
||||||
align={align}
|
align={align}
|
||||||
{...props}
|
{...props}>
|
||||||
>
|
|
||||||
<SelectScrollUpButton />
|
<SelectScrollUpButton />
|
||||||
<SelectPrimitive.Viewport
|
<SelectPrimitive.Viewport
|
||||||
className={cn(
|
className={cn('p-1', position === 'popper' && 'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1')}>
|
||||||
"p-1",
|
|
||||||
position === "popper" &&
|
|
||||||
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{children}
|
{children}
|
||||||
</SelectPrimitive.Viewport>
|
</SelectPrimitive.Viewport>
|
||||||
<SelectScrollDownButton />
|
<SelectScrollDownButton />
|
||||||
</SelectPrimitive.Content>
|
</SelectPrimitive.Content>
|
||||||
</SelectPrimitive.Portal>
|
</SelectPrimitive.Portal>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function SelectLabel({
|
function SelectLabel({className, ...props}: React.ComponentProps<typeof SelectPrimitive.Label>) {
|
||||||
className,
|
return <SelectPrimitive.Label data-slot="select-label" className={cn('text-muted-foreground px-2 py-1.5 text-xs', className)} {...props} />;
|
||||||
...props
|
|
||||||
}: React.ComponentProps<typeof SelectPrimitive.Label>) {
|
|
||||||
return (
|
|
||||||
<SelectPrimitive.Label
|
|
||||||
data-slot="select-label"
|
|
||||||
className={cn("text-muted-foreground px-2 py-1.5 text-xs", className)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function SelectItem({
|
function SelectItem({className, children, ...props}: React.ComponentProps<typeof SelectPrimitive.Item>) {
|
||||||
className,
|
|
||||||
children,
|
|
||||||
...props
|
|
||||||
}: React.ComponentProps<typeof SelectPrimitive.Item>) {
|
|
||||||
return (
|
return (
|
||||||
<SelectPrimitive.Item
|
<SelectPrimitive.Item
|
||||||
data-slot="select-item"
|
data-slot="select-item"
|
||||||
@@ -112,8 +80,7 @@ function SelectItem({
|
|||||||
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}>
|
||||||
>
|
|
||||||
<span className="absolute right-2 flex size-3.5 items-center justify-center">
|
<span className="absolute right-2 flex size-3.5 items-center justify-center">
|
||||||
<SelectPrimitive.ItemIndicator>
|
<SelectPrimitive.ItemIndicator>
|
||||||
<CheckIcon className="size-4" />
|
<CheckIcon className="size-4" />
|
||||||
@@ -121,67 +88,33 @@ function SelectItem({
|
|||||||
</span>
|
</span>
|
||||||
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
||||||
</SelectPrimitive.Item>
|
</SelectPrimitive.Item>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function SelectSeparator({
|
function SelectSeparator({className, ...props}: React.ComponentProps<typeof SelectPrimitive.Separator>) {
|
||||||
className,
|
return <SelectPrimitive.Separator data-slot="select-separator" className={cn('bg-border pointer-events-none -mx-1 my-1 h-px', className)} {...props} />;
|
||||||
...props
|
|
||||||
}: React.ComponentProps<typeof SelectPrimitive.Separator>) {
|
|
||||||
return (
|
|
||||||
<SelectPrimitive.Separator
|
|
||||||
data-slot="select-separator"
|
|
||||||
className={cn("bg-border pointer-events-none -mx-1 my-1 h-px", className)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function SelectScrollUpButton({
|
function SelectScrollUpButton({className, ...props}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
|
||||||
className,
|
|
||||||
...props
|
|
||||||
}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
|
|
||||||
return (
|
return (
|
||||||
<SelectPrimitive.ScrollUpButton
|
<SelectPrimitive.ScrollUpButton
|
||||||
data-slot="select-scroll-up-button"
|
data-slot="select-scroll-up-button"
|
||||||
className={cn(
|
className={cn('flex cursor-default items-center justify-center py-1', className)}
|
||||||
"flex cursor-default items-center justify-center py-1",
|
{...props}>
|
||||||
className
|
|
||||||
)}
|
|
||||||
{...props}
|
|
||||||
>
|
|
||||||
<ChevronUpIcon className="size-4" />
|
<ChevronUpIcon className="size-4" />
|
||||||
</SelectPrimitive.ScrollUpButton>
|
</SelectPrimitive.ScrollUpButton>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function SelectScrollDownButton({
|
function SelectScrollDownButton({className, ...props}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
|
||||||
className,
|
|
||||||
...props
|
|
||||||
}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
|
|
||||||
return (
|
return (
|
||||||
<SelectPrimitive.ScrollDownButton
|
<SelectPrimitive.ScrollDownButton
|
||||||
data-slot="select-scroll-down-button"
|
data-slot="select-scroll-down-button"
|
||||||
className={cn(
|
className={cn('flex cursor-default items-center justify-center py-1', className)}
|
||||||
"flex cursor-default items-center justify-center py-1",
|
{...props}>
|
||||||
className
|
|
||||||
)}
|
|
||||||
{...props}
|
|
||||||
>
|
|
||||||
<ChevronDownIcon className="size-4" />
|
<ChevronDownIcon className="size-4" />
|
||||||
</SelectPrimitive.ScrollDownButton>
|
</SelectPrimitive.ScrollDownButton>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue};
|
||||||
Select,
|
|
||||||
SelectContent,
|
|
||||||
SelectGroup,
|
|
||||||
SelectItem,
|
|
||||||
SelectLabel,
|
|
||||||
SelectScrollDownButton,
|
|
||||||
SelectScrollUpButton,
|
|
||||||
SelectSeparator,
|
|
||||||
SelectTrigger,
|
|
||||||
SelectValue,
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,26 +1,21 @@
|
|||||||
import * as React from "react"
|
import * as React from 'react';
|
||||||
import * as SeparatorPrimitive from "@radix-ui/react-separator"
|
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
||||||
|
|
||||||
import { cn } from "@/lib/utils"
|
import {cn} from '@/lib/utils';
|
||||||
|
|
||||||
function Separator({
|
function Separator({className, orientation = 'horizontal', decorative = true, ...props}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
||||||
className,
|
|
||||||
orientation = "horizontal",
|
|
||||||
decorative = true,
|
|
||||||
...props
|
|
||||||
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
|
||||||
return (
|
return (
|
||||||
<SeparatorPrimitive.Root
|
<SeparatorPrimitive.Root
|
||||||
data-slot="separator"
|
data-slot="separator"
|
||||||
decorative={decorative}
|
decorative={decorative}
|
||||||
orientation={orientation}
|
orientation={orientation}
|
||||||
className={cn(
|
className={cn(
|
||||||
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
'bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px',
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Separator }
|
export {Separator};
|
||||||
|
|||||||
@@ -1,61 +1,42 @@
|
|||||||
"use client"
|
'use client';
|
||||||
|
|
||||||
import * as React from "react"
|
import * as React from 'react';
|
||||||
import * as TooltipPrimitive from "@radix-ui/react-tooltip"
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
||||||
|
|
||||||
import { cn } from "@/lib/utils"
|
import {cn} from '@/lib/utils';
|
||||||
|
|
||||||
function TooltipProvider({
|
function TooltipProvider({delayDuration = 0, ...props}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
|
||||||
delayDuration = 0,
|
return <TooltipPrimitive.Provider data-slot="tooltip-provider" delayDuration={delayDuration} {...props} />;
|
||||||
...props
|
|
||||||
}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
|
|
||||||
return (
|
|
||||||
<TooltipPrimitive.Provider
|
|
||||||
data-slot="tooltip-provider"
|
|
||||||
delayDuration={delayDuration}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Tooltip({
|
function Tooltip({...props}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
|
||||||
...props
|
|
||||||
}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
|
|
||||||
return (
|
return (
|
||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<TooltipPrimitive.Root data-slot="tooltip" {...props} />
|
<TooltipPrimitive.Root data-slot="tooltip" {...props} />
|
||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function TooltipTrigger({
|
function TooltipTrigger({...props}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
|
||||||
...props
|
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
|
||||||
}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
|
|
||||||
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function TooltipContent({
|
function TooltipContent({className, sideOffset = 0, children, ...props}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
|
||||||
className,
|
|
||||||
sideOffset = 0,
|
|
||||||
children,
|
|
||||||
...props
|
|
||||||
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
|
|
||||||
return (
|
return (
|
||||||
<TooltipPrimitive.Portal>
|
<TooltipPrimitive.Portal>
|
||||||
<TooltipPrimitive.Content
|
<TooltipPrimitive.Content
|
||||||
data-slot="tooltip-content"
|
data-slot="tooltip-content"
|
||||||
sideOffset={sideOffset}
|
sideOffset={sideOffset}
|
||||||
className={cn(
|
className={cn(
|
||||||
"bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
|
'bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance',
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}>
|
||||||
>
|
|
||||||
{children}
|
{children}
|
||||||
<TooltipPrimitive.Arrow className="bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" />
|
<TooltipPrimitive.Arrow className="bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" />
|
||||||
</TooltipPrimitive.Content>
|
</TooltipPrimitive.Content>
|
||||||
</TooltipPrimitive.Portal>
|
</TooltipPrimitive.Portal>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
|
export {Tooltip, TooltipTrigger, TooltipContent, TooltipProvider};
|
||||||
|
|||||||
1
frontend-web/src/fonts.d.ts
vendored
1
frontend-web/src/fonts.d.ts
vendored
@@ -2,4 +2,3 @@ declare module '@fontsource-variable/geist';
|
|||||||
declare module '@fontsource-variable/oxanium';
|
declare module '@fontsource-variable/oxanium';
|
||||||
declare module '@fontsource-variable/funnel-sans';
|
declare module '@fontsource-variable/funnel-sans';
|
||||||
declare module '@fontsource-variable/inter';
|
declare module '@fontsource-variable/inter';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
@import 'tailwindcss';
|
@import 'tailwindcss';
|
||||||
@import "tw-animate-css";
|
@import 'tw-animate-css';
|
||||||
|
|
||||||
@custom-variant dark (&:is(.dark *));
|
@custom-variant dark (&:is(.dark *));
|
||||||
|
|
||||||
@@ -124,7 +124,12 @@
|
|||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
letter-spacing: -0.01em;
|
letter-spacing: -0.01em;
|
||||||
}
|
}
|
||||||
h1, h2, h3, h4, h5, h6 {
|
h1,
|
||||||
|
h2,
|
||||||
|
h3,
|
||||||
|
h4,
|
||||||
|
h5,
|
||||||
|
h6 {
|
||||||
font-family: 'Funnel Sans Variable', system-ui, sans-serif;
|
font-family: 'Funnel Sans Variable', system-ui, sans-serif;
|
||||||
letter-spacing: -0.02em;
|
letter-spacing: -0.02em;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export const formatCurrency = (value: number, options?: {maximumFractionDigits?:
|
|||||||
return new Intl.NumberFormat('en-US', {
|
return new Intl.NumberFormat('en-US', {
|
||||||
style: 'currency',
|
style: 'currency',
|
||||||
currency: 'USD',
|
currency: 'USD',
|
||||||
maximumFractionDigits: options?.maximumFractionDigits ?? 0,
|
maximumFractionDigits: options?.maximumFractionDigits ?? 0
|
||||||
}).format(value);
|
}).format(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { clsx, type ClassValue } from "clsx"
|
import {clsx, type ClassValue} from 'clsx';
|
||||||
import { twMerge } from "tailwind-merge"
|
import {twMerge} from 'tailwind-merge';
|
||||||
|
|
||||||
export function cn(...inputs: ClassValue[]) {
|
export function cn(...inputs: ClassValue[]) {
|
||||||
return twMerge(clsx(inputs))
|
return twMerge(clsx(inputs));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,12 +14,18 @@ export default function CashflowPage() {
|
|||||||
|
|
||||||
const getMonthlyAmount = (amount: number, frequency: string) => {
|
const getMonthlyAmount = (amount: number, frequency: string) => {
|
||||||
switch (frequency) {
|
switch (frequency) {
|
||||||
case 'weekly': return amount * 4.33;
|
case 'weekly':
|
||||||
case 'biweekly': return amount * 2.17;
|
return amount * 4.33;
|
||||||
case 'monthly': return amount;
|
case 'biweekly':
|
||||||
case 'quarterly': return amount / 3;
|
return amount * 2.17;
|
||||||
case 'yearly': return amount / 12;
|
case 'monthly':
|
||||||
default: return 0;
|
return amount;
|
||||||
|
case 'quarterly':
|
||||||
|
return amount / 3;
|
||||||
|
case 'yearly':
|
||||||
|
return amount / 12;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -30,11 +36,16 @@ export default function CashflowPage() {
|
|||||||
|
|
||||||
const fmt = (value: number) => new Intl.NumberFormat('en-US', {style: 'currency', currency: 'USD', maximumFractionDigits: 0}).format(value);
|
const fmt = (value: number) => new Intl.NumberFormat('en-US', {style: 'currency', currency: 'USD', maximumFractionDigits: 0}).format(value);
|
||||||
|
|
||||||
const expensesByCategory = expenses.filter(e => e.isActive).reduce((acc, e) => {
|
const expensesByCategory = expenses
|
||||||
const monthly = getMonthlyAmount(e.amount, e.frequency);
|
.filter(e => e.isActive)
|
||||||
acc[e.category] = (acc[e.category] || 0) + monthly;
|
.reduce(
|
||||||
return acc;
|
(acc, e) => {
|
||||||
}, {} as Record<string, number>);
|
const monthly = getMonthlyAmount(e.amount, e.frequency);
|
||||||
|
acc[e.category] = (acc[e.category] || 0) + monthly;
|
||||||
|
return acc;
|
||||||
|
},
|
||||||
|
{} as Record<string, number>
|
||||||
|
);
|
||||||
|
|
||||||
const sortedCategories = Object.entries(expensesByCategory).sort((a, b) => b[1] - a[1]);
|
const sortedCategories = Object.entries(expensesByCategory).sort((a, b) => b[1] - a[1]);
|
||||||
const topExpenses = expenses.filter(e => e.isActive).sort((a, b) => getMonthlyAmount(b.amount, b.frequency) - getMonthlyAmount(a.amount, a.frequency));
|
const topExpenses = expenses.filter(e => e.isActive).sort((a, b) => getMonthlyAmount(b.amount, b.frequency) - getMonthlyAmount(a.amount, a.frequency));
|
||||||
@@ -46,15 +57,29 @@ export default function CashflowPage() {
|
|||||||
<div className="flex items-center gap-6">
|
<div className="flex items-center gap-6">
|
||||||
<h1 className="text-lg font-semibold">Cashflow</h1>
|
<h1 className="text-lg font-semibold">Cashflow</h1>
|
||||||
<div className="flex gap-4 text-sm">
|
<div className="flex gap-4 text-sm">
|
||||||
<div><span className="text-muted-foreground">Income</span> <span className="font-medium text-green-400">{fmt(monthlyIncome)}</span></div>
|
<div>
|
||||||
<div><span className="text-muted-foreground">Expenses</span> <span className="font-medium">{fmt(monthlyExpenses)}</span></div>
|
<span className="text-muted-foreground">Income</span> <span className="font-medium text-green-400">{fmt(monthlyIncome)}</span>
|
||||||
<div><span className="text-muted-foreground">Net</span> <span className={`font-semibold ${monthlySavings >= 0 ? 'text-green-400' : 'text-red-400'}`}>{fmt(monthlySavings)}</span></div>
|
</div>
|
||||||
<div><span className="text-muted-foreground">Savings</span> <span className={`font-medium ${savingsRate >= 20 ? 'text-green-400' : ''}`}>{savingsRate.toFixed(0)}%</span></div>
|
<div>
|
||||||
|
<span className="text-muted-foreground">Expenses</span> <span className="font-medium">{fmt(monthlyExpenses)}</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span className="text-muted-foreground">Net</span>{' '}
|
||||||
|
<span className={`font-semibold ${monthlySavings >= 0 ? 'text-green-400' : 'text-red-400'}`}>{fmt(monthlySavings)}</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span className="text-muted-foreground">Savings</span>{' '}
|
||||||
|
<span className={`font-medium ${savingsRate >= 20 ? 'text-green-400' : ''}`}>{savingsRate.toFixed(0)}%</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
<Button variant="secondary" size="sm" onClick={() => setIncomeDialogOpen(true)}>Add Income</Button>
|
<Button variant="secondary" size="sm" onClick={() => setIncomeDialogOpen(true)}>
|
||||||
<Button size="sm" onClick={() => setExpenseDialogOpen(true)}>Add Expense</Button>
|
Add Income
|
||||||
|
</Button>
|
||||||
|
<Button size="sm" onClick={() => setExpenseDialogOpen(true)}>
|
||||||
|
Add Expense
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -66,15 +91,17 @@ export default function CashflowPage() {
|
|||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="p-3 pt-0">
|
<CardContent className="p-3 pt-0">
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
{incomeSources.filter(i => i.isActive).map(income => (
|
{incomeSources
|
||||||
<div key={income.id} className="flex justify-between items-baseline">
|
.filter(i => i.isActive)
|
||||||
<div>
|
.map(income => (
|
||||||
<p className="text-sm font-medium">{income.name}</p>
|
<div key={income.id} className="flex justify-between items-baseline">
|
||||||
<p className="text-xs text-muted-foreground">{income.frequency}</p>
|
<div>
|
||||||
|
<p className="text-sm font-medium">{income.name}</p>
|
||||||
|
<p className="text-xs text-muted-foreground">{income.frequency}</p>
|
||||||
|
</div>
|
||||||
|
<p className="text-sm font-medium tabular-nums">{fmt(income.amount)}</p>
|
||||||
</div>
|
</div>
|
||||||
<p className="text-sm font-medium tabular-nums">{fmt(income.amount)}</p>
|
))}
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
@@ -106,7 +133,9 @@ export default function CashflowPage() {
|
|||||||
<Card className="card-elevated col-span-4">
|
<Card className="card-elevated col-span-4">
|
||||||
<CardHeader className="flex flex-row items-center justify-between p-3 pb-2">
|
<CardHeader className="flex flex-row items-center justify-between p-3 pb-2">
|
||||||
<CardTitle className="text-xs font-medium text-muted-foreground uppercase tracking-wide">Recent Activity</CardTitle>
|
<CardTitle className="text-xs font-medium text-muted-foreground uppercase tracking-wide">Recent Activity</CardTitle>
|
||||||
<Button variant="ghost" size="sm" className="h-5 px-2 text-xs" onClick={() => setTransactionDialogOpen(true)}>+</Button>
|
<Button variant="ghost" size="sm" className="h-5 px-2 text-xs" onClick={() => setTransactionDialogOpen(true)}>
|
||||||
|
+
|
||||||
|
</Button>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="p-3 pt-0">
|
<CardContent className="p-3 pt-0">
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
@@ -117,7 +146,8 @@ export default function CashflowPage() {
|
|||||||
<p className="text-xs text-muted-foreground">{tx.date}</p>
|
<p className="text-xs text-muted-foreground">{tx.date}</p>
|
||||||
</div>
|
</div>
|
||||||
<span className={`text-sm font-medium tabular-nums ${tx.type === 'income' ? 'text-green-400' : ''}`}>
|
<span className={`text-sm font-medium tabular-nums ${tx.type === 'income' ? 'text-green-400' : ''}`}>
|
||||||
{tx.type === 'income' ? '+' : '−'}{fmt(tx.amount)}
|
{tx.type === 'income' ? '+' : '−'}
|
||||||
|
{fmt(tx.amount)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
@@ -168,7 +198,10 @@ export default function CashflowPage() {
|
|||||||
<span className={`font-medium ${savingsRate >= 20 ? 'text-green-400' : ''}`}>{savingsRate.toFixed(1)}%</span>
|
<span className={`font-medium ${savingsRate >= 20 ? 'text-green-400' : ''}`}>{savingsRate.toFixed(1)}%</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="h-2 rounded-full bg-foreground/10 overflow-hidden">
|
<div className="h-2 rounded-full bg-foreground/10 overflow-hidden">
|
||||||
<div className={`h-full rounded-full ${savingsRate >= 20 ? 'bg-green-400/50' : 'bg-foreground/30'}`} style={{width: `${Math.min(savingsRate, 100)}%`}} />
|
<div
|
||||||
|
className={`h-full rounded-full ${savingsRate >= 20 ? 'bg-green-400/50' : 'bg-foreground/30'}`}
|
||||||
|
style={{width: `${Math.min(savingsRate, 100)}%`}}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
|
|||||||
@@ -34,12 +34,20 @@ export default function ClientsPage() {
|
|||||||
<div className="flex items-center gap-6">
|
<div className="flex items-center gap-6">
|
||||||
<h1 className="text-lg font-semibold">Clients</h1>
|
<h1 className="text-lg font-semibold">Clients</h1>
|
||||||
<div className="flex gap-4 text-sm">
|
<div className="flex gap-4 text-sm">
|
||||||
<div><span className="text-muted-foreground">Total Clients</span> <span className="font-medium">{clients.length}</span></div>
|
<div>
|
||||||
<div><span className="text-muted-foreground">Total Billed</span> <span className="font-medium">{formatCurrency(totalBilled)}</span></div>
|
<span className="text-muted-foreground">Total Clients</span> <span className="font-medium">{clients.length}</span>
|
||||||
<div><span className="text-muted-foreground">Outstanding</span> <span className="font-medium">{formatCurrency(totalOutstanding)}</span></div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<span className="text-muted-foreground">Total Billed</span> <span className="font-medium">{formatCurrency(totalBilled)}</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span className="text-muted-foreground">Outstanding</span> <span className="font-medium">{formatCurrency(totalOutstanding)}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Button size="sm" onClick={() => setDialogOpen(true)}>Add Client</Button>
|
<Button size="sm" onClick={() => setDialogOpen(true)}>
|
||||||
|
Add Client
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Clients Grid */}
|
{/* Clients Grid */}
|
||||||
@@ -47,20 +55,14 @@ export default function ClientsPage() {
|
|||||||
{clients.map(client => {
|
{clients.map(client => {
|
||||||
const stats = getClientStats(client.id);
|
const stats = getClientStats(client.id);
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card key={client.id} className="card-elevated cursor-pointer hover:bg-accent/30 transition-colors" onClick={() => handleEditClient(client)}>
|
||||||
key={client.id}
|
|
||||||
className="card-elevated cursor-pointer hover:bg-accent/30 transition-colors"
|
|
||||||
onClick={() => handleEditClient(client)}
|
|
||||||
>
|
|
||||||
<CardContent className="p-4">
|
<CardContent className="p-4">
|
||||||
<div className="flex justify-between items-start mb-2">
|
<div className="flex justify-between items-start mb-2">
|
||||||
<div>
|
<div>
|
||||||
<p className="font-medium">{client.name}</p>
|
<p className="font-medium">{client.name}</p>
|
||||||
<p className="text-xs text-muted-foreground">{client.company || client.email}</p>
|
<p className="text-xs text-muted-foreground">{client.company || client.email}</p>
|
||||||
</div>
|
</div>
|
||||||
{stats.outstanding > 0 && (
|
{stats.outstanding > 0 && <span className="text-xs text-yellow-400">{formatCurrency(stats.outstanding)} due</span>}
|
||||||
<span className="text-xs text-yellow-400">{formatCurrency(stats.outstanding)} due</span>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<div className="flex gap-4 text-sm">
|
<div className="flex gap-4 text-sm">
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ export default function DebtsPage() {
|
|||||||
const getCategoryById = (id: string) => categories.find(c => c.id === id);
|
const getCategoryById = (id: string) => categories.find(c => c.id === id);
|
||||||
const getAccountsByCategory = (categoryId: string) => accounts.filter(a => a.categoryId === categoryId);
|
const getAccountsByCategory = (categoryId: string) => accounts.filter(a => a.categoryId === categoryId);
|
||||||
const getCategoryTotal = (categoryId: string) => getAccountsByCategory(categoryId).reduce((sum, a) => sum + a.currentBalance, 0);
|
const getCategoryTotal = (categoryId: string) => getAccountsByCategory(categoryId).reduce((sum, a) => sum + a.currentBalance, 0);
|
||||||
const getProgress = (account: DebtAccount) => account.originalBalance > 0 ? ((account.originalBalance - account.currentBalance) / account.originalBalance) * 100 : 0;
|
const getProgress = (account: DebtAccount) =>
|
||||||
|
account.originalBalance > 0 ? ((account.originalBalance - account.currentBalance) / account.originalBalance) * 100 : 0;
|
||||||
|
|
||||||
const categoriesWithDebt = categories.filter(c => getCategoryTotal(c.id) > 0);
|
const categoriesWithDebt = categories.filter(c => getCategoryTotal(c.id) > 0);
|
||||||
|
|
||||||
@@ -33,9 +34,15 @@ export default function DebtsPage() {
|
|||||||
<div className="flex items-center gap-6">
|
<div className="flex items-center gap-6">
|
||||||
<h1 className="text-lg font-semibold">Debts</h1>
|
<h1 className="text-lg font-semibold">Debts</h1>
|
||||||
<div className="flex gap-4 text-sm">
|
<div className="flex gap-4 text-sm">
|
||||||
<div><span className="text-muted-foreground">Total</span> <span className="font-medium">{fmt(totalDebt)}</span></div>
|
<div>
|
||||||
<div><span className="text-muted-foreground">Paid</span> <span className="font-medium text-green-400">{fmt(totalPaidDown)}</span></div>
|
<span className="text-muted-foreground">Total</span> <span className="font-medium">{fmt(totalDebt)}</span>
|
||||||
<div><span className="text-muted-foreground">Monthly</span> <span className="font-medium">{fmt(totalMinPayment)}</span></div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<span className="text-muted-foreground">Paid</span> <span className="font-medium text-green-400">{fmt(totalPaidDown)}</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span className="text-muted-foreground">Monthly</span> <span className="font-medium">{fmt(totalMinPayment)}</span>
|
||||||
|
</div>
|
||||||
<div className="flex items-center gap-1.5">
|
<div className="flex items-center gap-1.5">
|
||||||
<div className="h-1.5 w-16 rounded-full bg-secondary overflow-hidden">
|
<div className="h-1.5 w-16 rounded-full bg-secondary overflow-hidden">
|
||||||
<div className="h-full bg-green-400/60" style={{width: `${overallProgress}%`}} />
|
<div className="h-full bg-green-400/60" style={{width: `${overallProgress}%`}} />
|
||||||
@@ -46,10 +53,16 @@ export default function DebtsPage() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
<div className="flex gap-0.5 rounded bg-secondary p-0.5">
|
<div className="flex gap-0.5 rounded bg-secondary p-0.5">
|
||||||
<button onClick={() => setViewMode('category')} className={`px-2 py-1 text-xs rounded ${viewMode === 'category' ? 'bg-background' : ''}`}>Category</button>
|
<button onClick={() => setViewMode('category')} className={`px-2 py-1 text-xs rounded ${viewMode === 'category' ? 'bg-background' : ''}`}>
|
||||||
<button onClick={() => setViewMode('account')} className={`px-2 py-1 text-xs rounded ${viewMode === 'account' ? 'bg-background' : ''}`}>Account</button>
|
Category
|
||||||
|
</button>
|
||||||
|
<button onClick={() => setViewMode('account')} className={`px-2 py-1 text-xs rounded ${viewMode === 'account' ? 'bg-background' : ''}`}>
|
||||||
|
Account
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<Button size="sm" onClick={() => setAddDialogOpen(true)}>Add Account</Button>
|
<Button size="sm" onClick={() => setAddDialogOpen(true)}>
|
||||||
|
Add Account
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -107,7 +120,9 @@ export default function DebtsPage() {
|
|||||||
<div className="flex justify-between items-start mb-2">
|
<div className="flex justify-between items-start mb-2">
|
||||||
<div>
|
<div>
|
||||||
<p className="font-medium">{account.name}</p>
|
<p className="font-medium">{account.name}</p>
|
||||||
<p className="text-xs text-muted-foreground">{account.institution} · {category?.name}</p>
|
<p className="text-xs text-muted-foreground">
|
||||||
|
{account.institution} · {category?.name}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<span className="text-xs text-muted-foreground">{account.interestRate}%</span>
|
<span className="text-xs text-muted-foreground">{account.interestRate}%</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export default function InvoicesPage() {
|
|||||||
overdue: invoices.filter(i => i.status === 'overdue'),
|
overdue: invoices.filter(i => i.status === 'overdue'),
|
||||||
sent: invoices.filter(i => i.status === 'sent'),
|
sent: invoices.filter(i => i.status === 'sent'),
|
||||||
draft: invoices.filter(i => i.status === 'draft'),
|
draft: invoices.filter(i => i.status === 'draft'),
|
||||||
paid: invoices.filter(i => i.status === 'paid').slice(0, 5),
|
paid: invoices.filter(i => i.status === 'paid').slice(0, 5)
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleViewInvoice = (invoice: Invoice) => {
|
const handleViewInvoice = (invoice: Invoice) => {
|
||||||
@@ -40,14 +40,26 @@ export default function InvoicesPage() {
|
|||||||
<div className="flex items-center gap-6">
|
<div className="flex items-center gap-6">
|
||||||
<h1 className="text-lg font-semibold">Invoices</h1>
|
<h1 className="text-lg font-semibold">Invoices</h1>
|
||||||
<div className="flex gap-4 text-sm">
|
<div className="flex gap-4 text-sm">
|
||||||
<div><span className="text-muted-foreground">Outstanding</span> <span className="font-medium">{formatCurrency(totalOutstanding)}</span></div>
|
<div>
|
||||||
<div><span className="text-muted-foreground">Paid</span> <span className="font-medium text-green-400">{formatCurrency(totalPaid)}</span></div>
|
<span className="text-muted-foreground">Outstanding</span> <span className="font-medium">{formatCurrency(totalOutstanding)}</span>
|
||||||
{overdueCount > 0 && <div><span className="text-red-400 font-medium">{overdueCount} overdue</span></div>}
|
</div>
|
||||||
|
<div>
|
||||||
|
<span className="text-muted-foreground">Paid</span> <span className="font-medium text-green-400">{formatCurrency(totalPaid)}</span>
|
||||||
|
</div>
|
||||||
|
{overdueCount > 0 && (
|
||||||
|
<div>
|
||||||
|
<span className="text-red-400 font-medium">{overdueCount} overdue</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
<Button variant="secondary" size="sm" onClick={() => setClientDialogOpen(true)}>Add Client</Button>
|
<Button variant="secondary" size="sm" onClick={() => setClientDialogOpen(true)}>
|
||||||
<Button size="sm" onClick={() => setInvoiceDialogOpen(true)}>New Invoice</Button>
|
Add Client
|
||||||
|
</Button>
|
||||||
|
<Button size="sm" onClick={() => setInvoiceDialogOpen(true)}>
|
||||||
|
New Invoice
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -66,8 +78,7 @@ export default function InvoicesPage() {
|
|||||||
<div
|
<div
|
||||||
key={inv.id}
|
key={inv.id}
|
||||||
className="text-sm py-1 border-b border-border last:border-0 cursor-pointer hover:bg-accent/30 px-1 rounded transition-colors"
|
className="text-sm py-1 border-b border-border last:border-0 cursor-pointer hover:bg-accent/30 px-1 rounded transition-colors"
|
||||||
onClick={() => handleViewInvoice(inv)}
|
onClick={() => handleViewInvoice(inv)}>
|
||||||
>
|
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
<span className="font-medium">{inv.invoiceNumber}</span>
|
<span className="font-medium">{inv.invoiceNumber}</span>
|
||||||
<span className="font-medium">{formatCurrency(inv.total)}</span>
|
<span className="font-medium">{formatCurrency(inv.total)}</span>
|
||||||
@@ -94,8 +105,7 @@ export default function InvoicesPage() {
|
|||||||
<div
|
<div
|
||||||
key={inv.id}
|
key={inv.id}
|
||||||
className="text-sm py-1 border-b border-border last:border-0 cursor-pointer hover:bg-accent/30 px-1 rounded transition-colors"
|
className="text-sm py-1 border-b border-border last:border-0 cursor-pointer hover:bg-accent/30 px-1 rounded transition-colors"
|
||||||
onClick={() => handleViewInvoice(inv)}
|
onClick={() => handleViewInvoice(inv)}>
|
||||||
>
|
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
<span className="font-medium">{inv.invoiceNumber}</span>
|
<span className="font-medium">{inv.invoiceNumber}</span>
|
||||||
<span className="font-medium">{formatCurrency(inv.total)}</span>
|
<span className="font-medium">{formatCurrency(inv.total)}</span>
|
||||||
@@ -125,8 +135,7 @@ export default function InvoicesPage() {
|
|||||||
<div
|
<div
|
||||||
key={inv.id}
|
key={inv.id}
|
||||||
className="text-sm py-1 border-b border-border last:border-0 cursor-pointer hover:bg-accent/30 px-1 rounded transition-colors"
|
className="text-sm py-1 border-b border-border last:border-0 cursor-pointer hover:bg-accent/30 px-1 rounded transition-colors"
|
||||||
onClick={() => handleViewInvoice(inv)}
|
onClick={() => handleViewInvoice(inv)}>
|
||||||
>
|
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
<span className="font-medium">{inv.invoiceNumber}</span>
|
<span className="font-medium">{inv.invoiceNumber}</span>
|
||||||
<span className="font-medium">{formatCurrency(inv.total)}</span>
|
<span className="font-medium">{formatCurrency(inv.total)}</span>
|
||||||
@@ -153,8 +162,7 @@ export default function InvoicesPage() {
|
|||||||
<div
|
<div
|
||||||
key={inv.id}
|
key={inv.id}
|
||||||
className="text-sm py-1 border-b border-border last:border-0 cursor-pointer hover:bg-accent/30 px-1 rounded transition-colors"
|
className="text-sm py-1 border-b border-border last:border-0 cursor-pointer hover:bg-accent/30 px-1 rounded transition-colors"
|
||||||
onClick={() => handleViewInvoice(inv)}
|
onClick={() => handleViewInvoice(inv)}>
|
||||||
>
|
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
<span className="font-medium">{inv.invoiceNumber}</span>
|
<span className="font-medium">{inv.invoiceNumber}</span>
|
||||||
<span className="font-medium">{formatCurrency(inv.total)}</span>
|
<span className="font-medium">{formatCurrency(inv.total)}</span>
|
||||||
@@ -170,12 +178,7 @@ export default function InvoicesPage() {
|
|||||||
|
|
||||||
<AddClientDialog open={clientDialogOpen} onOpenChange={setClientDialogOpen} />
|
<AddClientDialog open={clientDialogOpen} onOpenChange={setClientDialogOpen} />
|
||||||
<AddInvoiceDialog open={invoiceDialogOpen} onOpenChange={setInvoiceDialogOpen} />
|
<AddInvoiceDialog open={invoiceDialogOpen} onOpenChange={setInvoiceDialogOpen} />
|
||||||
<InvoiceDetailsDialog
|
<InvoiceDetailsDialog open={detailsDialogOpen} onOpenChange={setDetailsDialogOpen} invoice={selectedInvoice} clients={clients} />
|
||||||
open={detailsDialogOpen}
|
|
||||||
onOpenChange={setDetailsDialogOpen}
|
|
||||||
invoice={selectedInvoice}
|
|
||||||
clients={clients}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export default function NetWorthPage() {
|
|||||||
|
|
||||||
const chartData = snapshots.map(s => ({
|
const chartData = snapshots.map(s => ({
|
||||||
month: format(new Date(s.date), 'MMM'),
|
month: format(new Date(s.date), 'MMM'),
|
||||||
netWorth: s.netWorth,
|
netWorth: s.netWorth
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const totalAssets = assets.reduce((sum, a) => sum + a.value, 0);
|
const totalAssets = assets.reduce((sum, a) => sum + a.value, 0);
|
||||||
@@ -39,7 +39,7 @@ export default function NetWorthPage() {
|
|||||||
date: new Date().toISOString().split('T')[0],
|
date: new Date().toISOString().split('T')[0],
|
||||||
totalAssets,
|
totalAssets,
|
||||||
totalLiabilities,
|
totalLiabilities,
|
||||||
netWorth,
|
netWorth
|
||||||
};
|
};
|
||||||
dispatch(addSnapshot(snapshot));
|
dispatch(addSnapshot(snapshot));
|
||||||
};
|
};
|
||||||
@@ -61,12 +61,20 @@ export default function NetWorthPage() {
|
|||||||
<div className="flex items-center gap-6">
|
<div className="flex items-center gap-6">
|
||||||
<h1 className="text-lg font-semibold">Net Worth</h1>
|
<h1 className="text-lg font-semibold">Net Worth</h1>
|
||||||
<div className="flex gap-4 text-sm">
|
<div className="flex gap-4 text-sm">
|
||||||
<div><span className="text-muted-foreground">Assets</span> <span className="font-medium">{formatCurrency(totalAssets)}</span></div>
|
<div>
|
||||||
<div><span className="text-muted-foreground">Liabilities</span> <span className="font-medium">{formatCurrency(totalLiabilities)}</span></div>
|
<span className="text-muted-foreground">Assets</span> <span className="font-medium">{formatCurrency(totalAssets)}</span>
|
||||||
<div><span className="text-muted-foreground">Net</span> <span className="font-semibold text-base">{formatCurrency(netWorth)}</span></div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<span className="text-muted-foreground">Liabilities</span> <span className="font-medium">{formatCurrency(totalLiabilities)}</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span className="text-muted-foreground">Net</span> <span className="font-semibold text-base">{formatCurrency(netWorth)}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Button size="sm" onClick={handleRecordSnapshot}>Record Snapshot</Button>
|
<Button size="sm" onClick={handleRecordSnapshot}>
|
||||||
|
Record Snapshot
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-3 gap-4">
|
<div className="grid grid-cols-3 gap-4">
|
||||||
@@ -83,7 +91,14 @@ export default function NetWorthPage() {
|
|||||||
</linearGradient>
|
</linearGradient>
|
||||||
</defs>
|
</defs>
|
||||||
<XAxis dataKey="month" stroke="oklch(0.5 0 0)" tick={{fill: 'oklch(0.5 0 0)', fontSize: 10}} axisLine={false} tickLine={false} />
|
<XAxis dataKey="month" stroke="oklch(0.5 0 0)" tick={{fill: 'oklch(0.5 0 0)', fontSize: 10}} axisLine={false} tickLine={false} />
|
||||||
<YAxis stroke="oklch(0.5 0 0)" tick={{fill: 'oklch(0.5 0 0)', fontSize: 10}} tickFormatter={v => `$${v / 1000}k`} axisLine={false} tickLine={false} width={45} />
|
<YAxis
|
||||||
|
stroke="oklch(0.5 0 0)"
|
||||||
|
tick={{fill: 'oklch(0.5 0 0)', fontSize: 10}}
|
||||||
|
tickFormatter={v => `$${v / 1000}k`}
|
||||||
|
axisLine={false}
|
||||||
|
tickLine={false}
|
||||||
|
width={45}
|
||||||
|
/>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
contentStyle={{background: 'oklch(0.28 0.01 260)', border: '1px solid oklch(1 0 0 / 0.1)', borderRadius: '6px', fontSize: 12}}
|
contentStyle={{background: 'oklch(0.28 0.01 260)', border: '1px solid oklch(1 0 0 / 0.1)', borderRadius: '6px', fontSize: 12}}
|
||||||
labelStyle={{color: 'oklch(0.9 0 0)'}}
|
labelStyle={{color: 'oklch(0.9 0 0)'}}
|
||||||
@@ -102,16 +117,15 @@ export default function NetWorthPage() {
|
|||||||
<CardContent className="p-3">
|
<CardContent className="p-3">
|
||||||
<p className="text-xs text-muted-foreground mb-1">Monthly Change</p>
|
<p className="text-xs text-muted-foreground mb-1">Monthly Change</p>
|
||||||
<p className={`text-lg font-semibold ${monthlyChange >= 0 ? 'text-green-400' : 'text-red-400'}`}>
|
<p className={`text-lg font-semibold ${monthlyChange >= 0 ? 'text-green-400' : 'text-red-400'}`}>
|
||||||
{monthlyChange >= 0 ? '+' : ''}{formatCurrency(monthlyChange)}
|
{monthlyChange >= 0 ? '+' : ''}
|
||||||
|
{formatCurrency(monthlyChange)}
|
||||||
</p>
|
</p>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
<Card className="card-elevated">
|
<Card className="card-elevated">
|
||||||
<CardContent className="p-3">
|
<CardContent className="p-3">
|
||||||
<p className="text-xs text-muted-foreground mb-1">YTD Growth</p>
|
<p className="text-xs text-muted-foreground mb-1">YTD Growth</p>
|
||||||
<p className={`text-lg font-semibold ${ytdGrowth >= 0 ? 'text-green-400' : 'text-red-400'}`}>
|
<p className={`text-lg font-semibold ${ytdGrowth >= 0 ? 'text-green-400' : 'text-red-400'}`}>{formatPercentage(ytdGrowth)}</p>
|
||||||
{formatPercentage(ytdGrowth)}
|
|
||||||
</p>
|
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
<Card className="card-elevated">
|
<Card className="card-elevated">
|
||||||
@@ -126,7 +140,9 @@ export default function NetWorthPage() {
|
|||||||
<Card className="card-elevated">
|
<Card className="card-elevated">
|
||||||
<CardHeader className="flex flex-row items-center justify-between p-3 pb-2">
|
<CardHeader className="flex flex-row items-center justify-between p-3 pb-2">
|
||||||
<CardTitle className="text-sm font-medium">Assets</CardTitle>
|
<CardTitle className="text-sm font-medium">Assets</CardTitle>
|
||||||
<Button variant="ghost" size="sm" className="h-6 px-2 text-xs" onClick={() => setAssetDialogOpen(true)}>+ Add</Button>
|
<Button variant="ghost" size="sm" className="h-6 px-2 text-xs" onClick={() => setAssetDialogOpen(true)}>
|
||||||
|
+ Add
|
||||||
|
</Button>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="p-3 pt-0">
|
<CardContent className="p-3 pt-0">
|
||||||
<div className="space-y-1.5 max-h-[180px] overflow-y-auto">
|
<div className="space-y-1.5 max-h-[180px] overflow-y-auto">
|
||||||
@@ -134,8 +150,7 @@ export default function NetWorthPage() {
|
|||||||
<div
|
<div
|
||||||
key={asset.id}
|
key={asset.id}
|
||||||
className="flex justify-between text-sm py-1 border-b border-border last:border-0 cursor-pointer hover:bg-accent/30 px-1 rounded transition-colors"
|
className="flex justify-between text-sm py-1 border-b border-border last:border-0 cursor-pointer hover:bg-accent/30 px-1 rounded transition-colors"
|
||||||
onClick={() => handleEditAsset(asset)}
|
onClick={() => handleEditAsset(asset)}>
|
||||||
>
|
|
||||||
<div>
|
<div>
|
||||||
<span>{asset.name}</span>
|
<span>{asset.name}</span>
|
||||||
<span className="ml-1.5 text-xs text-muted-foreground capitalize">{asset.type}</span>
|
<span className="ml-1.5 text-xs text-muted-foreground capitalize">{asset.type}</span>
|
||||||
@@ -151,7 +166,9 @@ export default function NetWorthPage() {
|
|||||||
<Card className="card-elevated">
|
<Card className="card-elevated">
|
||||||
<CardHeader className="flex flex-row items-center justify-between p-3 pb-2">
|
<CardHeader className="flex flex-row items-center justify-between p-3 pb-2">
|
||||||
<CardTitle className="text-sm font-medium">Liabilities</CardTitle>
|
<CardTitle className="text-sm font-medium">Liabilities</CardTitle>
|
||||||
<Button variant="ghost" size="sm" className="h-6 px-2 text-xs" onClick={() => setLiabilityDialogOpen(true)}>+ Add</Button>
|
<Button variant="ghost" size="sm" className="h-6 px-2 text-xs" onClick={() => setLiabilityDialogOpen(true)}>
|
||||||
|
+ Add
|
||||||
|
</Button>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="p-3 pt-0">
|
<CardContent className="p-3 pt-0">
|
||||||
<div className="space-y-1.5 max-h-[180px] overflow-y-auto">
|
<div className="space-y-1.5 max-h-[180px] overflow-y-auto">
|
||||||
@@ -159,8 +176,7 @@ export default function NetWorthPage() {
|
|||||||
<div
|
<div
|
||||||
key={liability.id}
|
key={liability.id}
|
||||||
className="flex justify-between text-sm py-1 border-b border-border last:border-0 cursor-pointer hover:bg-accent/30 px-1 rounded transition-colors"
|
className="flex justify-between text-sm py-1 border-b border-border last:border-0 cursor-pointer hover:bg-accent/30 px-1 rounded transition-colors"
|
||||||
onClick={() => handleEditLiability(liability)}
|
onClick={() => handleEditLiability(liability)}>
|
||||||
>
|
|
||||||
<div>
|
<div>
|
||||||
<span>{liability.name}</span>
|
<span>{liability.name}</span>
|
||||||
<span className="ml-1.5 text-xs text-muted-foreground capitalize">{liability.type.replace('_', ' ')}</span>
|
<span className="ml-1.5 text-xs text-muted-foreground capitalize">{liability.type.replace('_', ' ')}</span>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export {
|
|||||||
updateLiability,
|
updateLiability,
|
||||||
removeLiability,
|
removeLiability,
|
||||||
addSnapshot,
|
addSnapshot,
|
||||||
setSnapshots,
|
setSnapshots
|
||||||
} from './slices/netWorthSlice';
|
} from './slices/netWorthSlice';
|
||||||
export type {Asset, Liability, NetWorthSnapshot, NetWorthState} from './slices/netWorthSlice';
|
export type {Asset, Liability, NetWorthSnapshot, NetWorthState} from './slices/netWorthSlice';
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ export {
|
|||||||
setAccounts,
|
setAccounts,
|
||||||
addPayment,
|
addPayment,
|
||||||
removePayment,
|
removePayment,
|
||||||
setPayments,
|
setPayments
|
||||||
} from './slices/debtsSlice';
|
} from './slices/debtsSlice';
|
||||||
export type {DebtCategory, DebtAccount, DebtPayment, DebtsState} from './slices/debtsSlice';
|
export type {DebtCategory, DebtAccount, DebtPayment, DebtsState} from './slices/debtsSlice';
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ export {
|
|||||||
updateInvoice,
|
updateInvoice,
|
||||||
removeInvoice,
|
removeInvoice,
|
||||||
setInvoices,
|
setInvoices,
|
||||||
updateInvoiceStatus,
|
updateInvoiceStatus
|
||||||
} from './slices/invoicesSlice';
|
} from './slices/invoicesSlice';
|
||||||
export type {Client, Invoice, InvoiceLineItem, InvoicesState} from './slices/invoicesSlice';
|
export type {Client, Invoice, InvoiceLineItem, InvoicesState} from './slices/invoicesSlice';
|
||||||
|
|
||||||
@@ -69,6 +69,6 @@ export {
|
|||||||
updateExpense,
|
updateExpense,
|
||||||
removeExpense,
|
removeExpense,
|
||||||
addTransaction,
|
addTransaction,
|
||||||
removeTransaction,
|
removeTransaction
|
||||||
} from './slices/cashflowSlice';
|
} from './slices/cashflowSlice';
|
||||||
export type {IncomeSource, Expense, Transaction, CashflowState} from './slices/cashflowSlice';
|
export type {IncomeSource, Expense, Transaction, CashflowState} from './slices/cashflowSlice';
|
||||||
|
|||||||
@@ -44,27 +44,145 @@ export interface CashflowState {
|
|||||||
|
|
||||||
const defaultCategories = {
|
const defaultCategories = {
|
||||||
income: ['Salary', 'Freelance', 'Investments', 'Rental', 'Side Business', 'Other'],
|
income: ['Salary', 'Freelance', 'Investments', 'Rental', 'Side Business', 'Other'],
|
||||||
expense: ['Housing', 'Utilities', 'Transportation', 'Food', 'Insurance', 'Healthcare', 'Subscriptions', 'Entertainment', 'Shopping', 'Savings', 'Other'],
|
expense: ['Housing', 'Utilities', 'Transportation', 'Food', 'Insurance', 'Healthcare', 'Subscriptions', 'Entertainment', 'Shopping', 'Savings', 'Other']
|
||||||
};
|
};
|
||||||
|
|
||||||
// Mock data
|
// Mock data
|
||||||
const mockIncomeSources: IncomeSource[] = [
|
const mockIncomeSources: IncomeSource[] = [
|
||||||
{id: 'i1', name: 'Software Engineer Salary', amount: 8500, frequency: 'monthly', category: 'Salary', nextDate: '2024-12-15', isActive: true, createdAt: '2024-01-01'},
|
{
|
||||||
|
id: 'i1',
|
||||||
|
name: 'Software Engineer Salary',
|
||||||
|
amount: 8500,
|
||||||
|
frequency: 'monthly',
|
||||||
|
category: 'Salary',
|
||||||
|
nextDate: '2024-12-15',
|
||||||
|
isActive: true,
|
||||||
|
createdAt: '2024-01-01'
|
||||||
|
},
|
||||||
{id: 'i2', name: 'Consulting', amount: 2000, frequency: 'monthly', category: 'Freelance', nextDate: '2024-12-20', isActive: true, createdAt: '2024-03-01'},
|
{id: 'i2', name: 'Consulting', amount: 2000, frequency: 'monthly', category: 'Freelance', nextDate: '2024-12-20', isActive: true, createdAt: '2024-03-01'},
|
||||||
{id: 'i3', name: 'Dividend Income', amount: 450, frequency: 'quarterly', category: 'Investments', nextDate: '2024-12-31', isActive: true, createdAt: '2024-01-01'},
|
{
|
||||||
|
id: 'i3',
|
||||||
|
name: 'Dividend Income',
|
||||||
|
amount: 450,
|
||||||
|
frequency: 'quarterly',
|
||||||
|
category: 'Investments',
|
||||||
|
nextDate: '2024-12-31',
|
||||||
|
isActive: true,
|
||||||
|
createdAt: '2024-01-01'
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
const mockExpenses: Expense[] = [
|
const mockExpenses: Expense[] = [
|
||||||
{id: 'e1', name: 'Mortgage', amount: 2200, frequency: 'monthly', category: 'Housing', nextDate: '2024-12-01', isActive: true, isEssential: true, createdAt: '2024-01-01'},
|
{
|
||||||
{id: 'e2', name: 'Car Payment', amount: 450, frequency: 'monthly', category: 'Transportation', nextDate: '2024-12-05', isActive: true, isEssential: true, createdAt: '2024-01-01'},
|
id: 'e1',
|
||||||
{id: 'e3', name: 'Car Insurance', amount: 180, frequency: 'monthly', category: 'Insurance', nextDate: '2024-12-10', isActive: true, isEssential: true, createdAt: '2024-01-01'},
|
name: 'Mortgage',
|
||||||
{id: 'e4', name: 'Utilities', amount: 250, frequency: 'monthly', category: 'Utilities', nextDate: '2024-12-15', isActive: true, isEssential: true, createdAt: '2024-01-01'},
|
amount: 2200,
|
||||||
{id: 'e5', name: 'Groceries', amount: 600, frequency: 'monthly', category: 'Food', nextDate: '2024-12-01', isActive: true, isEssential: true, createdAt: '2024-01-01'},
|
frequency: 'monthly',
|
||||||
{id: 'e6', name: 'Gym Membership', amount: 50, frequency: 'monthly', category: 'Healthcare', nextDate: '2024-12-01', isActive: true, isEssential: false, createdAt: '2024-01-01'},
|
category: 'Housing',
|
||||||
{id: 'e7', name: 'Netflix', amount: 15, frequency: 'monthly', category: 'Subscriptions', nextDate: '2024-12-08', isActive: true, isEssential: false, createdAt: '2024-01-01'},
|
nextDate: '2024-12-01',
|
||||||
{id: 'e8', name: 'Spotify', amount: 12, frequency: 'monthly', category: 'Subscriptions', nextDate: '2024-12-12', isActive: true, isEssential: false, createdAt: '2024-01-01'},
|
isActive: true,
|
||||||
{id: 'e9', name: 'Health Insurance', amount: 350, frequency: 'monthly', category: 'Insurance', nextDate: '2024-12-01', isActive: true, isEssential: true, createdAt: '2024-01-01'},
|
isEssential: true,
|
||||||
{id: 'e10', name: '401k Contribution', amount: 1500, frequency: 'monthly', category: 'Savings', nextDate: '2024-12-15', isActive: true, isEssential: true, createdAt: '2024-01-01'},
|
createdAt: '2024-01-01'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'e2',
|
||||||
|
name: 'Car Payment',
|
||||||
|
amount: 450,
|
||||||
|
frequency: 'monthly',
|
||||||
|
category: 'Transportation',
|
||||||
|
nextDate: '2024-12-05',
|
||||||
|
isActive: true,
|
||||||
|
isEssential: true,
|
||||||
|
createdAt: '2024-01-01'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'e3',
|
||||||
|
name: 'Car Insurance',
|
||||||
|
amount: 180,
|
||||||
|
frequency: 'monthly',
|
||||||
|
category: 'Insurance',
|
||||||
|
nextDate: '2024-12-10',
|
||||||
|
isActive: true,
|
||||||
|
isEssential: true,
|
||||||
|
createdAt: '2024-01-01'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'e4',
|
||||||
|
name: 'Utilities',
|
||||||
|
amount: 250,
|
||||||
|
frequency: 'monthly',
|
||||||
|
category: 'Utilities',
|
||||||
|
nextDate: '2024-12-15',
|
||||||
|
isActive: true,
|
||||||
|
isEssential: true,
|
||||||
|
createdAt: '2024-01-01'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'e5',
|
||||||
|
name: 'Groceries',
|
||||||
|
amount: 600,
|
||||||
|
frequency: 'monthly',
|
||||||
|
category: 'Food',
|
||||||
|
nextDate: '2024-12-01',
|
||||||
|
isActive: true,
|
||||||
|
isEssential: true,
|
||||||
|
createdAt: '2024-01-01'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'e6',
|
||||||
|
name: 'Gym Membership',
|
||||||
|
amount: 50,
|
||||||
|
frequency: 'monthly',
|
||||||
|
category: 'Healthcare',
|
||||||
|
nextDate: '2024-12-01',
|
||||||
|
isActive: true,
|
||||||
|
isEssential: false,
|
||||||
|
createdAt: '2024-01-01'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'e7',
|
||||||
|
name: 'Netflix',
|
||||||
|
amount: 15,
|
||||||
|
frequency: 'monthly',
|
||||||
|
category: 'Subscriptions',
|
||||||
|
nextDate: '2024-12-08',
|
||||||
|
isActive: true,
|
||||||
|
isEssential: false,
|
||||||
|
createdAt: '2024-01-01'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'e8',
|
||||||
|
name: 'Spotify',
|
||||||
|
amount: 12,
|
||||||
|
frequency: 'monthly',
|
||||||
|
category: 'Subscriptions',
|
||||||
|
nextDate: '2024-12-12',
|
||||||
|
isActive: true,
|
||||||
|
isEssential: false,
|
||||||
|
createdAt: '2024-01-01'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'e9',
|
||||||
|
name: 'Health Insurance',
|
||||||
|
amount: 350,
|
||||||
|
frequency: 'monthly',
|
||||||
|
category: 'Insurance',
|
||||||
|
nextDate: '2024-12-01',
|
||||||
|
isActive: true,
|
||||||
|
isEssential: true,
|
||||||
|
createdAt: '2024-01-01'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'e10',
|
||||||
|
name: '401k Contribution',
|
||||||
|
amount: 1500,
|
||||||
|
frequency: 'monthly',
|
||||||
|
category: 'Savings',
|
||||||
|
nextDate: '2024-12-15',
|
||||||
|
isActive: true,
|
||||||
|
isEssential: true,
|
||||||
|
createdAt: '2024-01-01'
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
const mockTransactions: Transaction[] = [
|
const mockTransactions: Transaction[] = [
|
||||||
@@ -73,7 +191,7 @@ const mockTransactions: Transaction[] = [
|
|||||||
{id: 't3', type: 'expense', name: 'Groceries', amount: 145, category: 'Food', date: '2024-11-28'},
|
{id: 't3', type: 'expense', name: 'Groceries', amount: 145, category: 'Food', date: '2024-11-28'},
|
||||||
{id: 't4', type: 'expense', name: 'Gas', amount: 55, category: 'Transportation', date: '2024-11-25'},
|
{id: 't4', type: 'expense', name: 'Gas', amount: 55, category: 'Transportation', date: '2024-11-25'},
|
||||||
{id: 't5', type: 'income', name: 'Consulting Payment', amount: 2000, category: 'Freelance', date: '2024-11-20'},
|
{id: 't5', type: 'income', name: 'Consulting Payment', amount: 2000, category: 'Freelance', date: '2024-11-20'},
|
||||||
{id: 't6', type: 'expense', name: 'Restaurant', amount: 85, category: 'Food', date: '2024-11-22'},
|
{id: 't6', type: 'expense', name: 'Restaurant', amount: 85, category: 'Food', date: '2024-11-22'}
|
||||||
];
|
];
|
||||||
|
|
||||||
const initialState: CashflowState = {
|
const initialState: CashflowState = {
|
||||||
@@ -82,7 +200,7 @@ const initialState: CashflowState = {
|
|||||||
transactions: mockTransactions,
|
transactions: mockTransactions,
|
||||||
categories: defaultCategories,
|
categories: defaultCategories,
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
error: null,
|
error: null
|
||||||
};
|
};
|
||||||
|
|
||||||
const cashflowSlice = createSlice({
|
const cashflowSlice = createSlice({
|
||||||
@@ -123,8 +241,8 @@ const cashflowSlice = createSlice({
|
|||||||
},
|
},
|
||||||
removeTransaction: (state, action: PayloadAction<string>) => {
|
removeTransaction: (state, action: PayloadAction<string>) => {
|
||||||
state.transactions = state.transactions.filter(t => t.id !== action.payload);
|
state.transactions = state.transactions.filter(t => t.id !== action.payload);
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export const {
|
export const {
|
||||||
@@ -137,8 +255,7 @@ export const {
|
|||||||
updateExpense,
|
updateExpense,
|
||||||
removeExpense,
|
removeExpense,
|
||||||
addTransaction,
|
addTransaction,
|
||||||
removeTransaction,
|
removeTransaction
|
||||||
} = cashflowSlice.actions;
|
} = cashflowSlice.actions;
|
||||||
|
|
||||||
export default cashflowSlice.reducer;
|
export default cashflowSlice.reducer;
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ const defaultCategories: DebtCategory[] = [
|
|||||||
{id: 'student-loans', name: 'Student Loans', color: '#6b7280', createdAt: new Date().toISOString()},
|
{id: 'student-loans', name: 'Student Loans', color: '#6b7280', createdAt: new Date().toISOString()},
|
||||||
{id: 'mortgage', name: 'Mortgage', color: '#6b7280', createdAt: new Date().toISOString()},
|
{id: 'mortgage', name: 'Mortgage', color: '#6b7280', createdAt: new Date().toISOString()},
|
||||||
{id: 'medical', name: 'Medical', color: '#6b7280', createdAt: new Date().toISOString()},
|
{id: 'medical', name: 'Medical', color: '#6b7280', createdAt: new Date().toISOString()},
|
||||||
{id: 'other', name: 'Other', color: '#6b7280', createdAt: new Date().toISOString()},
|
{id: 'other', name: 'Other', color: '#6b7280', createdAt: new Date().toISOString()}
|
||||||
];
|
];
|
||||||
|
|
||||||
// Mock data for development
|
// Mock data for development
|
||||||
@@ -64,7 +64,7 @@ const mockAccounts: DebtAccount[] = [
|
|||||||
minimumPayment: 95,
|
minimumPayment: 95,
|
||||||
dueDay: 15,
|
dueDay: 15,
|
||||||
createdAt: '2024-01-15',
|
createdAt: '2024-01-15',
|
||||||
updatedAt: '2024-12-01',
|
updatedAt: '2024-12-01'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'cc2',
|
id: 'cc2',
|
||||||
@@ -78,7 +78,7 @@ const mockAccounts: DebtAccount[] = [
|
|||||||
minimumPayment: 55,
|
minimumPayment: 55,
|
||||||
dueDay: 22,
|
dueDay: 22,
|
||||||
createdAt: '2024-02-10',
|
createdAt: '2024-02-10',
|
||||||
updatedAt: '2024-12-01',
|
updatedAt: '2024-12-01'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'cc3',
|
id: 'cc3',
|
||||||
@@ -92,7 +92,7 @@ const mockAccounts: DebtAccount[] = [
|
|||||||
minimumPayment: 35,
|
minimumPayment: 35,
|
||||||
dueDay: 8,
|
dueDay: 8,
|
||||||
createdAt: '2024-03-05',
|
createdAt: '2024-03-05',
|
||||||
updatedAt: '2024-12-01',
|
updatedAt: '2024-12-01'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'al1',
|
id: 'al1',
|
||||||
@@ -106,7 +106,7 @@ const mockAccounts: DebtAccount[] = [
|
|||||||
minimumPayment: 650,
|
minimumPayment: 650,
|
||||||
dueDay: 1,
|
dueDay: 1,
|
||||||
createdAt: '2021-06-15',
|
createdAt: '2021-06-15',
|
||||||
updatedAt: '2024-12-01',
|
updatedAt: '2024-12-01'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'sl1',
|
id: 'sl1',
|
||||||
@@ -119,7 +119,7 @@ const mockAccounts: DebtAccount[] = [
|
|||||||
minimumPayment: 320,
|
minimumPayment: 320,
|
||||||
dueDay: 25,
|
dueDay: 25,
|
||||||
createdAt: '2018-09-01',
|
createdAt: '2018-09-01',
|
||||||
updatedAt: '2024-12-01',
|
updatedAt: '2024-12-01'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'pl1',
|
id: 'pl1',
|
||||||
@@ -133,15 +133,15 @@ const mockAccounts: DebtAccount[] = [
|
|||||||
minimumPayment: 285,
|
minimumPayment: 285,
|
||||||
dueDay: 12,
|
dueDay: 12,
|
||||||
createdAt: '2023-08-20',
|
createdAt: '2023-08-20',
|
||||||
updatedAt: '2024-12-01',
|
updatedAt: '2024-12-01'
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
const mockPayments: DebtPayment[] = [
|
const mockPayments: DebtPayment[] = [
|
||||||
{id: 'p1', accountId: 'cc1', amount: 500, date: '2024-11-15', note: 'Extra payment'},
|
{id: 'p1', accountId: 'cc1', amount: 500, date: '2024-11-15', note: 'Extra payment'},
|
||||||
{id: 'p2', accountId: 'cc2', amount: 200, date: '2024-11-22'},
|
{id: 'p2', accountId: 'cc2', amount: 200, date: '2024-11-22'},
|
||||||
{id: 'p3', accountId: 'al1', amount: 650, date: '2024-12-01'},
|
{id: 'p3', accountId: 'al1', amount: 650, date: '2024-12-01'},
|
||||||
{id: 'p4', accountId: 'sl1', amount: 320, date: '2024-11-25'},
|
{id: 'p4', accountId: 'sl1', amount: 320, date: '2024-11-25'}
|
||||||
];
|
];
|
||||||
|
|
||||||
const initialState: DebtsState = {
|
const initialState: DebtsState = {
|
||||||
@@ -149,7 +149,7 @@ const initialState: DebtsState = {
|
|||||||
accounts: mockAccounts,
|
accounts: mockAccounts,
|
||||||
payments: mockPayments,
|
payments: mockPayments,
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
error: null,
|
error: null
|
||||||
};
|
};
|
||||||
|
|
||||||
const debtsSlice = createSlice({
|
const debtsSlice = createSlice({
|
||||||
@@ -219,8 +219,8 @@ const debtsSlice = createSlice({
|
|||||||
},
|
},
|
||||||
setPayments: (state, action: PayloadAction<DebtPayment[]>) => {
|
setPayments: (state, action: PayloadAction<DebtPayment[]>) => {
|
||||||
state.payments = action.payload;
|
state.payments = action.payload;
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export const {
|
export const {
|
||||||
@@ -236,7 +236,7 @@ export const {
|
|||||||
setAccounts,
|
setAccounts,
|
||||||
addPayment,
|
addPayment,
|
||||||
removePayment,
|
removePayment,
|
||||||
setPayments,
|
setPayments
|
||||||
} = debtsSlice.actions;
|
} = debtsSlice.actions;
|
||||||
|
|
||||||
export default debtsSlice.reducer;
|
export default debtsSlice.reducer;
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ const mockClients: Client[] = [
|
|||||||
phone: '555-0100',
|
phone: '555-0100',
|
||||||
company: 'Acme Corporation',
|
company: 'Acme Corporation',
|
||||||
address: '123 Business Ave, Suite 400, San Francisco, CA 94102',
|
address: '123 Business Ave, Suite 400, San Francisco, CA 94102',
|
||||||
createdAt: '2024-01-10',
|
createdAt: '2024-01-10'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'c2',
|
id: 'c2',
|
||||||
@@ -60,14 +60,14 @@ const mockClients: Client[] = [
|
|||||||
phone: '555-0200',
|
phone: '555-0200',
|
||||||
company: 'TechStart Inc',
|
company: 'TechStart Inc',
|
||||||
address: '456 Innovation Blvd, Austin, TX 78701',
|
address: '456 Innovation Blvd, Austin, TX 78701',
|
||||||
createdAt: '2024-02-15',
|
createdAt: '2024-02-15'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'c3',
|
id: 'c3',
|
||||||
name: 'Sarah Mitchell',
|
name: 'Sarah Mitchell',
|
||||||
email: 'sarah@mitchell.design',
|
email: 'sarah@mitchell.design',
|
||||||
company: 'Mitchell Design Studio',
|
company: 'Mitchell Design Studio',
|
||||||
createdAt: '2024-03-22',
|
createdAt: '2024-03-22'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'c4',
|
id: 'c4',
|
||||||
@@ -76,8 +76,8 @@ const mockClients: Client[] = [
|
|||||||
phone: '555-0400',
|
phone: '555-0400',
|
||||||
company: 'Global Media LLC',
|
company: 'Global Media LLC',
|
||||||
address: '789 Media Row, New York, NY 10001',
|
address: '789 Media Row, New York, NY 10001',
|
||||||
createdAt: '2024-04-08',
|
createdAt: '2024-04-08'
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
const mockInvoices: Invoice[] = [
|
const mockInvoices: Invoice[] = [
|
||||||
@@ -90,13 +90,13 @@ const mockInvoices: Invoice[] = [
|
|||||||
dueDate: '2024-10-31',
|
dueDate: '2024-10-31',
|
||||||
lineItems: [
|
lineItems: [
|
||||||
{id: 'li1', description: 'Web Development - October', quantity: 80, unitPrice: 150, total: 12000},
|
{id: 'li1', description: 'Web Development - October', quantity: 80, unitPrice: 150, total: 12000},
|
||||||
{id: 'li2', description: 'Hosting & Maintenance', quantity: 1, unitPrice: 500, total: 500},
|
{id: 'li2', description: 'Hosting & Maintenance', quantity: 1, unitPrice: 500, total: 500}
|
||||||
],
|
],
|
||||||
subtotal: 12500,
|
subtotal: 12500,
|
||||||
tax: 0,
|
tax: 0,
|
||||||
total: 12500,
|
total: 12500,
|
||||||
createdAt: '2024-10-01',
|
createdAt: '2024-10-01',
|
||||||
updatedAt: '2024-10-15',
|
updatedAt: '2024-10-15'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'inv2',
|
id: 'inv2',
|
||||||
@@ -105,14 +105,12 @@ const mockInvoices: Invoice[] = [
|
|||||||
status: 'paid',
|
status: 'paid',
|
||||||
issueDate: '2024-10-15',
|
issueDate: '2024-10-15',
|
||||||
dueDate: '2024-11-14',
|
dueDate: '2024-11-14',
|
||||||
lineItems: [
|
lineItems: [{id: 'li3', description: 'Mobile App Development', quantity: 120, unitPrice: 175, total: 21000}],
|
||||||
{id: 'li3', description: 'Mobile App Development', quantity: 120, unitPrice: 175, total: 21000},
|
|
||||||
],
|
|
||||||
subtotal: 21000,
|
subtotal: 21000,
|
||||||
tax: 0,
|
tax: 0,
|
||||||
total: 21000,
|
total: 21000,
|
||||||
createdAt: '2024-10-15',
|
createdAt: '2024-10-15',
|
||||||
updatedAt: '2024-11-10',
|
updatedAt: '2024-11-10'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'inv3',
|
id: 'inv3',
|
||||||
@@ -123,13 +121,13 @@ const mockInvoices: Invoice[] = [
|
|||||||
dueDate: '2024-12-01',
|
dueDate: '2024-12-01',
|
||||||
lineItems: [
|
lineItems: [
|
||||||
{id: 'li4', description: 'Web Development - November', quantity: 60, unitPrice: 150, total: 9000},
|
{id: 'li4', description: 'Web Development - November', quantity: 60, unitPrice: 150, total: 9000},
|
||||||
{id: 'li5', description: 'API Integration', quantity: 20, unitPrice: 175, total: 3500},
|
{id: 'li5', description: 'API Integration', quantity: 20, unitPrice: 175, total: 3500}
|
||||||
],
|
],
|
||||||
subtotal: 12500,
|
subtotal: 12500,
|
||||||
tax: 0,
|
tax: 0,
|
||||||
total: 12500,
|
total: 12500,
|
||||||
createdAt: '2024-11-01',
|
createdAt: '2024-11-01',
|
||||||
updatedAt: '2024-11-01',
|
updatedAt: '2024-11-01'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'inv4',
|
id: 'inv4',
|
||||||
@@ -138,14 +136,12 @@ const mockInvoices: Invoice[] = [
|
|||||||
status: 'overdue',
|
status: 'overdue',
|
||||||
issueDate: '2024-10-20',
|
issueDate: '2024-10-20',
|
||||||
dueDate: '2024-11-20',
|
dueDate: '2024-11-20',
|
||||||
lineItems: [
|
lineItems: [{id: 'li6', description: 'Brand Identity Design', quantity: 1, unitPrice: 4500, total: 4500}],
|
||||||
{id: 'li6', description: 'Brand Identity Design', quantity: 1, unitPrice: 4500, total: 4500},
|
|
||||||
],
|
|
||||||
subtotal: 4500,
|
subtotal: 4500,
|
||||||
tax: 0,
|
tax: 0,
|
||||||
total: 4500,
|
total: 4500,
|
||||||
createdAt: '2024-10-20',
|
createdAt: '2024-10-20',
|
||||||
updatedAt: '2024-10-20',
|
updatedAt: '2024-10-20'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'inv5',
|
id: 'inv5',
|
||||||
@@ -156,21 +152,21 @@ const mockInvoices: Invoice[] = [
|
|||||||
dueDate: '2024-12-31',
|
dueDate: '2024-12-31',
|
||||||
lineItems: [
|
lineItems: [
|
||||||
{id: 'li7', description: 'Video Production', quantity: 5, unitPrice: 2000, total: 10000},
|
{id: 'li7', description: 'Video Production', quantity: 5, unitPrice: 2000, total: 10000},
|
||||||
{id: 'li8', description: 'Motion Graphics', quantity: 10, unitPrice: 500, total: 5000},
|
{id: 'li8', description: 'Motion Graphics', quantity: 10, unitPrice: 500, total: 5000}
|
||||||
],
|
],
|
||||||
subtotal: 15000,
|
subtotal: 15000,
|
||||||
tax: 0,
|
tax: 0,
|
||||||
total: 15000,
|
total: 15000,
|
||||||
createdAt: '2024-12-01',
|
createdAt: '2024-12-01',
|
||||||
updatedAt: '2024-12-01',
|
updatedAt: '2024-12-01'
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
const initialState: InvoicesState = {
|
const initialState: InvoicesState = {
|
||||||
clients: mockClients,
|
clients: mockClients,
|
||||||
invoices: mockInvoices,
|
invoices: mockInvoices,
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
error: null,
|
error: null
|
||||||
};
|
};
|
||||||
|
|
||||||
const invoicesSlice = createSlice({
|
const invoicesSlice = createSlice({
|
||||||
@@ -211,17 +207,14 @@ const invoicesSlice = createSlice({
|
|||||||
setInvoices: (state, action: PayloadAction<Invoice[]>) => {
|
setInvoices: (state, action: PayloadAction<Invoice[]>) => {
|
||||||
state.invoices = action.payload;
|
state.invoices = action.payload;
|
||||||
},
|
},
|
||||||
updateInvoiceStatus: (
|
updateInvoiceStatus: (state, action: PayloadAction<{id: string; status: Invoice['status']}>) => {
|
||||||
state,
|
|
||||||
action: PayloadAction<{id: string; status: Invoice['status']}>
|
|
||||||
) => {
|
|
||||||
const invoice = state.invoices.find(i => i.id === action.payload.id);
|
const invoice = state.invoices.find(i => i.id === action.payload.id);
|
||||||
if (invoice) {
|
if (invoice) {
|
||||||
invoice.status = action.payload.status;
|
invoice.status = action.payload.status;
|
||||||
invoice.updatedAt = new Date().toISOString();
|
invoice.updatedAt = new Date().toISOString();
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export const {
|
export const {
|
||||||
@@ -235,8 +228,7 @@ export const {
|
|||||||
updateInvoice,
|
updateInvoice,
|
||||||
removeInvoice,
|
removeInvoice,
|
||||||
setInvoices,
|
setInvoices,
|
||||||
updateInvoiceStatus,
|
updateInvoiceStatus
|
||||||
} = invoicesSlice.actions;
|
} = invoicesSlice.actions;
|
||||||
|
|
||||||
export default invoicesSlice.reducer;
|
export default invoicesSlice.reducer;
|
||||||
|
|
||||||
|
|||||||
@@ -39,13 +39,13 @@ const mockAssets: Asset[] = [
|
|||||||
{id: 'a3', name: 'Fidelity 401k', type: 'investment', value: 145000, updatedAt: '2024-12-01'},
|
{id: 'a3', name: 'Fidelity 401k', type: 'investment', value: 145000, updatedAt: '2024-12-01'},
|
||||||
{id: 'a4', name: 'Vanguard Brokerage', type: 'investment', value: 52000, updatedAt: '2024-12-01'},
|
{id: 'a4', name: 'Vanguard Brokerage', type: 'investment', value: 52000, updatedAt: '2024-12-01'},
|
||||||
{id: 'a5', name: 'Primary Residence', type: 'property', value: 425000, updatedAt: '2024-12-01'},
|
{id: 'a5', name: 'Primary Residence', type: 'property', value: 425000, updatedAt: '2024-12-01'},
|
||||||
{id: 'a6', name: '2021 Tesla Model 3', type: 'vehicle', value: 28000, updatedAt: '2024-12-01'},
|
{id: 'a6', name: '2021 Tesla Model 3', type: 'vehicle', value: 28000, updatedAt: '2024-12-01'}
|
||||||
];
|
];
|
||||||
|
|
||||||
const mockLiabilities: Liability[] = [
|
const mockLiabilities: Liability[] = [
|
||||||
{id: 'l1', name: 'Mortgage', type: 'mortgage', balance: 320000, updatedAt: '2024-12-01'},
|
{id: 'l1', name: 'Mortgage', type: 'mortgage', balance: 320000, updatedAt: '2024-12-01'},
|
||||||
{id: 'l2', name: 'Auto Loan', type: 'loan', balance: 15000, updatedAt: '2024-12-01'},
|
{id: 'l2', name: 'Auto Loan', type: 'loan', balance: 15000, updatedAt: '2024-12-01'},
|
||||||
{id: 'l3', name: 'Student Loans', type: 'loan', balance: 28000, updatedAt: '2024-12-01'},
|
{id: 'l3', name: 'Student Loans', type: 'loan', balance: 28000, updatedAt: '2024-12-01'}
|
||||||
];
|
];
|
||||||
|
|
||||||
const mockSnapshots: NetWorthSnapshot[] = [
|
const mockSnapshots: NetWorthSnapshot[] = [
|
||||||
@@ -54,7 +54,7 @@ const mockSnapshots: NetWorthSnapshot[] = [
|
|||||||
{id: 's3', date: '2024-09-01', totalAssets: 680000, totalLiabilities: 370000, netWorth: 310000},
|
{id: 's3', date: '2024-09-01', totalAssets: 680000, totalLiabilities: 370000, netWorth: 310000},
|
||||||
{id: 's4', date: '2024-10-01', totalAssets: 685000, totalLiabilities: 368000, netWorth: 317000},
|
{id: 's4', date: '2024-10-01', totalAssets: 685000, totalLiabilities: 368000, netWorth: 317000},
|
||||||
{id: 's5', date: '2024-11-01', totalAssets: 692000, totalLiabilities: 365000, netWorth: 327000},
|
{id: 's5', date: '2024-11-01', totalAssets: 692000, totalLiabilities: 365000, netWorth: 327000},
|
||||||
{id: 's6', date: '2024-12-01', totalAssets: 697500, totalLiabilities: 363000, netWorth: 334500},
|
{id: 's6', date: '2024-12-01', totalAssets: 697500, totalLiabilities: 363000, netWorth: 334500}
|
||||||
];
|
];
|
||||||
|
|
||||||
const initialState: NetWorthState = {
|
const initialState: NetWorthState = {
|
||||||
@@ -62,7 +62,7 @@ const initialState: NetWorthState = {
|
|||||||
liabilities: mockLiabilities,
|
liabilities: mockLiabilities,
|
||||||
snapshots: mockSnapshots,
|
snapshots: mockSnapshots,
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
error: null,
|
error: null
|
||||||
};
|
};
|
||||||
|
|
||||||
const netWorthSlice = createSlice({
|
const netWorthSlice = createSlice({
|
||||||
@@ -100,22 +100,11 @@ const netWorthSlice = createSlice({
|
|||||||
},
|
},
|
||||||
setSnapshots: (state, action: PayloadAction<NetWorthSnapshot[]>) => {
|
setSnapshots: (state, action: PayloadAction<NetWorthSnapshot[]>) => {
|
||||||
state.snapshots = action.payload;
|
state.snapshots = action.payload;
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export const {
|
export const {setLoading, setError, addAsset, updateAsset, removeAsset, addLiability, updateLiability, removeLiability, addSnapshot, setSnapshots} =
|
||||||
setLoading,
|
netWorthSlice.actions;
|
||||||
setError,
|
|
||||||
addAsset,
|
|
||||||
updateAsset,
|
|
||||||
removeAsset,
|
|
||||||
addLiability,
|
|
||||||
updateLiability,
|
|
||||||
removeLiability,
|
|
||||||
addSnapshot,
|
|
||||||
setSnapshots,
|
|
||||||
} = netWorthSlice.actions;
|
|
||||||
|
|
||||||
export default netWorthSlice.reducer;
|
export default netWorthSlice.reducer;
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ export const store = configureStore({
|
|||||||
netWorth: netWorthReducer,
|
netWorth: netWorthReducer,
|
||||||
debts: debtsReducer,
|
debts: debtsReducer,
|
||||||
invoices: invoicesReducer,
|
invoices: invoicesReducer,
|
||||||
cashflow: cashflowReducer,
|
cashflow: cashflowReducer
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export type RootState = ReturnType<typeof store.getState>;
|
export type RootState = ReturnType<typeof store.getState>;
|
||||||
|
|||||||
Reference in New Issue
Block a user