mirror of
https://github.com/escalante29/WealthySmart.git
synced 2026-07-17 15:28:47 +02:00
Drop legacy pages, contexts, and dashboard widgets
Removes Dashboard / Transactions / Transfers pages, the section configuration UI, the legacy useSettings hook, and the standalone PrivacyContext/ThemeContext modules. Privacy/theme contexts now live under src/contexts/ and the API helper / push-notifications module move under src/lib/. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,76 +0,0 @@
|
||||
import { Settings } from 'lucide-react';
|
||||
import type { SectionSettings } from '../api';
|
||||
import { formatAmount } from '@/lib/format';
|
||||
import { Card } from '@/components/ui/card';
|
||||
import {
|
||||
Accordion,
|
||||
AccordionItem,
|
||||
AccordionTrigger,
|
||||
AccordionContent,
|
||||
} from '@/components/ui/accordion';
|
||||
import { getColorClasses } from '@/lib/colors';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
interface Props {
|
||||
sectionId: string;
|
||||
settings: SectionSettings;
|
||||
total?: number;
|
||||
totalCurrency?: string;
|
||||
onToggleExpanded: (expanded: boolean) => void;
|
||||
onOpenConfig: () => void;
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export default function DashboardSection({
|
||||
sectionId,
|
||||
settings,
|
||||
total,
|
||||
totalCurrency,
|
||||
onToggleExpanded,
|
||||
onOpenConfig,
|
||||
children,
|
||||
}: Props) {
|
||||
const colors = getColorClasses(settings.color);
|
||||
|
||||
return (
|
||||
<Card className={cn('relative overflow-hidden border-l-4', colors.borderLeft)}>
|
||||
{/* Settings icon — outside accordion trigger to avoid button-in-button */}
|
||||
<button
|
||||
onClick={onOpenConfig}
|
||||
className="absolute top-2.5 right-3 z-10 p-1 rounded text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors cursor-pointer"
|
||||
title="Section settings"
|
||||
aria-label="Section settings"
|
||||
>
|
||||
<Settings className="w-3.5 h-3.5" />
|
||||
</button>
|
||||
|
||||
<Accordion
|
||||
value={settings.expanded ? [sectionId] : []}
|
||||
onValueChange={(value: string[]) => onToggleExpanded(value.includes(sectionId))}
|
||||
>
|
||||
<AccordionItem value={sectionId} className="border-none">
|
||||
<AccordionTrigger
|
||||
className="px-4 py-3 hover:no-underline cursor-pointer"
|
||||
aria-label={`Expand ${settings.label}`}
|
||||
>
|
||||
<div className="flex items-center justify-between w-full pr-8">
|
||||
<span className="text-sm font-semibold text-foreground">
|
||||
{settings.label}
|
||||
</span>
|
||||
{total != null && totalCurrency && (
|
||||
<span data-sensitive className="text-sm font-bold font-mono text-foreground">
|
||||
{formatAmount(total, totalCurrency)}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</AccordionTrigger>
|
||||
<AccordionContent>
|
||||
<div className="divide-y divide-border mx-4 mb-4 rounded-lg overflow-hidden">
|
||||
{children}
|
||||
</div>
|
||||
</AccordionContent>
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
import { useState } from 'react';
|
||||
import type { SectionSettings } from '../api';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogFooter,
|
||||
} from '@/components/ui/dialog';
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from '@/components/ui/select';
|
||||
import { COLOR_OPTIONS, getColorClasses } from '@/lib/colors';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
interface Props {
|
||||
sectionId: string;
|
||||
settings: SectionSettings;
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
onSave: (sectionId: string, updated: Partial<SectionSettings>) => void;
|
||||
}
|
||||
|
||||
function ColorSwatch({ color }: { color: string }) {
|
||||
const classes = getColorClasses(color);
|
||||
return (
|
||||
<span className="flex items-center gap-2">
|
||||
<span className={cn('w-3 h-3 rounded-full', classes.bg, classes.ring, 'ring-1')} />
|
||||
{color}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
export default function SectionConfigDialog({ sectionId, settings, open, onOpenChange, onSave }: Props) {
|
||||
const [label, setLabel] = useState(settings.label);
|
||||
const [color, setColor] = useState(settings.color);
|
||||
const [cardColor, setCardColor] = useState(settings.cardColor);
|
||||
const [visible, setVisible] = useState(settings.visible);
|
||||
const [order, setOrder] = useState(String(settings.order));
|
||||
|
||||
const handleSave = () => {
|
||||
onSave(sectionId, {
|
||||
label,
|
||||
color,
|
||||
cardColor,
|
||||
visible,
|
||||
order: parseInt(order) || 0,
|
||||
});
|
||||
onOpenChange(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className="sm:max-w-md">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Configure Section</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<Label>Label</Label>
|
||||
<Input value={label} onChange={(e) => setLabel(e.target.value)} />
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label>Section Color</Label>
|
||||
<Select value={color} onValueChange={setColor}>
|
||||
<SelectTrigger className="w-full">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{COLOR_OPTIONS.map((c) => (
|
||||
<SelectItem key={c} value={c}>
|
||||
<ColorSwatch color={c} />
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label>Card Color</Label>
|
||||
<Select value={cardColor} onValueChange={setCardColor}>
|
||||
<SelectTrigger className="w-full">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{COLOR_OPTIONS.map((c) => (
|
||||
<SelectItem key={c} value={c}>
|
||||
<ColorSwatch color={c} />
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-3">
|
||||
<Label htmlFor={`visible-${sectionId}`}>Visible</Label>
|
||||
<input
|
||||
id={`visible-${sectionId}`}
|
||||
type="checkbox"
|
||||
checked={visible}
|
||||
onChange={(e) => setVisible(e.target.checked)}
|
||||
className="h-4 w-4 rounded border-input accent-primary cursor-pointer"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label>Order</Label>
|
||||
<Input
|
||||
type="number"
|
||||
min="0"
|
||||
max="10"
|
||||
value={order}
|
||||
onChange={(e) => setOrder(e.target.value)}
|
||||
className="w-20"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<DialogFooter>
|
||||
<Button variant="outline" onClick={() => onOpenChange(false)}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button onClick={handleSave}>Save</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user