Compare commits

...

5 Commits

25 changed files with 244 additions and 152 deletions

View File

@@ -273,13 +273,9 @@
scroll-behavior: smooth; scroll-behavior: smooth;
} }
/* Amélioration des transitions globales avec easing fintech */ /* Transitions globales désactivées */
* { * {
transition-property: transition: none !important;
color, background-color, border-color, text-decoration-color, fill,
stroke, opacity, box-shadow, transform, filter;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 200ms;
} }
/* Désactiver COMPLÈTEMENT toutes les animations pour les popovers et selects - APPROCHE AGRESSIVE */ /* Désactiver COMPLÈTEMENT toutes les animations pour les popovers et selects - APPROCHE AGRESSIVE */
@@ -358,42 +354,13 @@
font-weight: 700; font-weight: 700;
} }
/* Card hover effect avec élévation */ /* Card hover effect désactivé */
.card-hover { .card-hover {
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
position: relative; position: relative;
} }
.card-hover::before { .card-hover::before {
content: ""; display: none;
position: absolute;
inset: 0;
border-radius: inherit;
padding: 1px;
background: linear-gradient(
135deg,
color-mix(in srgb, var(--primary) 30%, transparent) 0%,
color-mix(in srgb, var(--chart-2) 20%, transparent) 100%
);
-webkit-mask:
linear-gradient(#fff 0 0) content-box,
linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
opacity: 0;
transition: opacity 0.4s ease;
}
.card-hover:hover {
transform: translateY(-4px) scale(1.01);
box-shadow:
0 20px 40px -12px color-mix(in srgb, var(--primary) 20%, transparent),
0 8px 16px -8px color-mix(in srgb, var(--foreground) 10%, transparent),
inset 0 1px 0 0 color-mix(in srgb, white 30%, transparent);
}
.card-hover:hover::before {
opacity: 1;
} }
/* Background fintech moderne avec dégradés animés et formes abstraites */ /* Background fintech moderne avec dégradés animés et formes abstraites */
@@ -446,8 +413,6 @@
background-size: 200% 200%; background-size: 200% 200%;
pointer-events: none; pointer-events: none;
opacity: 1; opacity: 1;
transition: opacity 0.5s ease;
animation: gradient-shift 25s ease infinite;
} }
.dark .page-background { .dark .page-background {
@@ -505,7 +470,6 @@
0 8px 32px -8px color-mix(in srgb, var(--primary) 8%, transparent), 0 8px 32px -8px color-mix(in srgb, var(--primary) 8%, transparent),
0 2px 8px -2px color-mix(in srgb, var(--foreground) 3%, transparent), 0 2px 8px -2px color-mix(in srgb, var(--foreground) 3%, transparent),
inset 0 1px 0 0 color-mix(in srgb, white 25%, transparent); inset 0 1px 0 0 color-mix(in srgb, white 25%, transparent);
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
position: relative; position: relative;
overflow: hidden; overflow: hidden;
} }
@@ -526,15 +490,6 @@
opacity: 0.5; opacity: 0.5;
} }
.fintech-card:hover {
transform: translateY(-6px) scale(1.01);
box-shadow:
0 24px 48px -12px color-mix(in srgb, var(--primary) 25%, transparent),
0 8px 24px -8px color-mix(in srgb, var(--foreground) 8%, transparent),
inset 0 1px 0 0 color-mix(in srgb, white 40%, transparent);
border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
}
/* Gradient backgrounds for stat cards très vibrants */ /* Gradient backgrounds for stat cards très vibrants */
.stat-card-gradient-1 { .stat-card-gradient-1 {
background: linear-gradient( background: linear-gradient(
@@ -560,7 +515,6 @@
transparent 70% transparent 70%
); );
opacity: 0.3; opacity: 0.3;
animation: gradient-shift 8s ease infinite;
} }
.stat-card-gradient-2 { .stat-card-gradient-2 {
@@ -587,7 +541,6 @@
transparent 70% transparent 70%
); );
opacity: 0.3; opacity: 0.3;
animation: gradient-shift 8s ease infinite;
} }
.stat-card-gradient-3 { .stat-card-gradient-3 {
@@ -614,7 +567,6 @@
transparent 70% transparent 70%
); );
opacity: 0.3; opacity: 0.3;
animation: gradient-shift 8s ease infinite;
} }
.stat-card-gradient-4 { .stat-card-gradient-4 {
@@ -641,6 +593,31 @@
transparent 70% transparent 70%
); );
opacity: 0.3; opacity: 0.3;
animation: gradient-shift 8s ease infinite; }
.stat-card-gradient-5 {
background: linear-gradient(
135deg,
color-mix(in srgb, var(--chart-5) 12%, var(--card)) 0%,
color-mix(in srgb, var(--chart-5) 8%, var(--card)) 50%,
color-mix(in srgb, var(--chart-5) 6%, var(--card)) 100%
);
position: relative;
overflow: hidden;
}
.stat-card-gradient-5::before {
content: "";
position: absolute;
top: -50%;
right: -50%;
width: 200%;
height: 200%;
background: radial-gradient(
circle,
color-mix(in srgb, var(--chart-5) 20%, transparent) 0%,
transparent 70%
);
opacity: 0.3;
} }
} }

View File

@@ -281,6 +281,7 @@ export default function StatisticsPage() {
value: Math.round(total), value: Math.round(total),
color: category?.color || "#94a3b8", color: category?.color || "#94a3b8",
icon: category?.icon || "HelpCircle", icon: category?.icon || "HelpCircle",
categoryId: categoryId === "uncategorized" ? null : categoryId,
}; };
}) })
.sort((a, b) => b.value - a.value); .sort((a, b) => b.value - a.value);
@@ -315,6 +316,7 @@ export default function StatisticsPage() {
value: Math.round(total), value: Math.round(total),
color: category?.color || "#94a3b8", color: category?.color || "#94a3b8",
icon: category?.icon || "HelpCircle", icon: category?.icon || "HelpCircle",
categoryId: groupId === "uncategorized" ? null : groupId,
}; };
}) })
.sort((a, b) => b.value - a.value); .sort((a, b) => b.value - a.value);

View File

@@ -112,6 +112,11 @@ export default function TransactionsPage() {
const filteredTransactions = transactionsData?.transactions || []; const filteredTransactions = transactionsData?.transactions || [];
const totalTransactions = transactionsData?.total || 0; const totalTransactions = transactionsData?.total || 0;
const hasMore = transactionsData?.hasMore || false; const hasMore = transactionsData?.hasMore || false;
const uncategorizedCount = transactionsData?.uncategorizedCount || 0;
const uncategorizedPercent =
totalTransactions > 0
? Math.round((uncategorizedCount / totalTransactions) * 100)
: 0;
// For filter comboboxes, we'll use empty arrays for now // For filter comboboxes, we'll use empty arrays for now
// They can be enhanced later with separate queries if needed // They can be enhanced later with separate queries if needed
@@ -133,7 +138,11 @@ export default function TransactionsPage() {
<PageLayout> <PageLayout>
<PageHeader <PageHeader
title="Transactions" title="Transactions"
description={`${totalTransactions} transaction${totalTransactions > 1 ? "s" : ""}`} description={
totalTransactions > 0
? `${totalTransactions} transaction${totalTransactions > 1 ? "s" : ""}${uncategorizedPercent}% non catégorisées`
: `${totalTransactions} transaction${totalTransactions > 1 ? "s" : ""}`
}
actions={ actions={
<OFXImportDialog onImportComplete={invalidateAll}> <OFXImportDialog onImportComplete={invalidateAll}>
<Button className="md:h-10 md:px-5"> <Button className="md:h-10 md:px-5">

View File

@@ -82,7 +82,6 @@ export function AccountCard({
"relative group", "relative group",
isSelected && "ring-2 ring-primary shadow-lg shadow-primary/10", isSelected && "ring-2 ring-primary shadow-lg shadow-primary/10",
isDragging && "bg-muted/80 opacity-60", isDragging && "bg-muted/80 opacity-60",
"hover:scale-[1.02] transition-transform duration-200",
)} )}
> >
<CardHeader className={cn("pb-0", isMobile && "px-2 pt-2")}> <CardHeader className={cn("pb-0", isMobile && "px-2 pt-2")}>

View File

@@ -25,7 +25,7 @@ export function CategoryCard({
const isMobile = useIsMobile(); const isMobile = useIsMobile();
return ( return (
<div className="flex items-center justify-between py-1.5 px-2 rounded hover:bg-muted/50 transition-colors group"> <div className="flex items-center justify-between py-1.5 px-2 rounded group">
<div className="flex items-center gap-2 min-w-0 flex-1"> <div className="flex items-center gap-2 min-w-0 flex-1">
<div <div
className="w-4 h-4 md:w-5 md:h-5 rounded-full flex items-center justify-center shrink-0" className="w-4 h-4 md:w-5 md:h-5 rounded-full flex items-center justify-center shrink-0"
@@ -59,7 +59,7 @@ export function CategoryCard({
)} )}
</div> </div>
<div className="flex items-center shrink-0 opacity-0 group-hover:opacity-100 md:opacity-100 transition-opacity"> <div className="flex items-center shrink-0 opacity-0 group-hover:opacity-100 md:opacity-100">
<Button <Button
variant="ghost" variant="ghost"
size="icon" size="icon"

View File

@@ -57,7 +57,7 @@ export function ParentCategoryRow({
<Collapsible open={isExpanded} onOpenChange={onToggleExpanded}> <Collapsible open={isExpanded} onOpenChange={onToggleExpanded}>
<div className="flex items-center justify-between px-2 md:px-3 py-1.5 md:py-2"> <div className="flex items-center justify-between px-2 md:px-3 py-1.5 md:py-2">
<CollapsibleTrigger asChild> <CollapsibleTrigger asChild>
<button className="flex items-center gap-1.5 md:gap-2 hover:opacity-80 transition-opacity flex-1 min-w-0"> <button className="flex items-center gap-1.5 md:gap-2 hover:opacity-80 flex-1 min-w-0">
{isExpanded ? ( {isExpanded ? (
<ChevronDown className="w-3 h-3 md:w-4 md:h-4 text-muted-foreground shrink-0" /> <ChevronDown className="w-3 h-3 md:w-4 md:h-4 text-muted-foreground shrink-0" />
) : ( ) : (

View File

@@ -113,11 +113,11 @@ export function AccountsSummary({ data }: AccountsSummaryProps) {
return ( return (
<div <div
key={account.id} key={account.id}
className="space-y-2.5 p-3 rounded-xl bg-muted/30 hover:bg-muted/50 border border-border/50 hover:border-primary/20 transition-all duration-300 group" className="space-y-2.5 p-3 rounded-xl bg-muted/30 border border-border/50 group"
> >
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<div className="flex items-center gap-3"> <div className="flex items-center gap-3">
<div className="w-10 h-10 rounded-xl bg-gradient-to-br from-primary/20 to-primary/10 flex items-center justify-center group-hover:scale-110 transition-transform duration-300"> <div className="w-10 h-10 rounded-xl bg-gradient-to-br from-primary/20 to-primary/10 flex items-center justify-center">
<Building2 className="w-5 h-5 text-primary" /> <Building2 className="w-5 h-5 text-primary" />
</div> </div>
<div> <div>
@@ -225,11 +225,11 @@ export function AccountsSummary({ data }: AccountsSummaryProps) {
return ( return (
<div <div
key={account.id} key={account.id}
className="space-y-2.5 p-3 rounded-xl bg-muted/30 hover:bg-muted/50 border border-border/50 hover:border-primary/20 transition-all duration-300 group" className="space-y-2.5 p-3 rounded-xl bg-muted/30 border border-border/50 group"
> >
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<div className="flex items-center gap-3"> <div className="flex items-center gap-3">
<div className="w-10 h-10 rounded-xl bg-gradient-to-br from-primary/20 to-primary/10 flex items-center justify-center group-hover:scale-110 transition-transform duration-300"> <div className="w-10 h-10 rounded-xl bg-gradient-to-br from-primary/20 to-primary/10 flex items-center justify-center">
<Building2 className="w-5 h-5 text-primary" /> <Building2 className="w-5 h-5 text-primary" />
</div> </div>
<div> <div>

View File

@@ -1,7 +1,13 @@
"use client"; "use client";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { TrendingUp, TrendingDown, Wallet, CreditCard } from "lucide-react"; import {
TrendingUp,
TrendingDown,
Wallet,
CreditCard,
Tag,
} from "lucide-react";
import type { BankingData } from "@/lib/types"; import type { BankingData } from "@/lib/types";
import { getAccountBalance } from "@/lib/account-utils"; import { getAccountBalance } from "@/lib/account-utils";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
@@ -13,7 +19,7 @@ interface OverviewCardsProps {
export function OverviewCards({ data }: OverviewCardsProps) { export function OverviewCards({ data }: OverviewCardsProps) {
const totalBalance = data.accounts.reduce( const totalBalance = data.accounts.reduce(
(sum, acc) => sum + getAccountBalance(acc), (sum, acc) => sum + getAccountBalance(acc),
0, 0
); );
const thisMonth = new Date(); const thisMonth = new Date();
@@ -21,7 +27,7 @@ export function OverviewCards({ data }: OverviewCardsProps) {
const thisMonthStr = thisMonth.toISOString().slice(0, 7); const thisMonthStr = thisMonth.toISOString().slice(0, 7);
const monthTransactions = data.transactions.filter((t) => const monthTransactions = data.transactions.filter((t) =>
t.date.startsWith(thisMonthStr), t.date.startsWith(thisMonthStr)
); );
const income = monthTransactions const income = monthTransactions
@@ -37,6 +43,12 @@ export function OverviewCards({ data }: OverviewCardsProps) {
const reconciledPercent = const reconciledPercent =
total > 0 ? Math.round((reconciled / total) * 100) : 0; total > 0 ? Math.round((reconciled / total) * 100) : 0;
const categorized = data.transactions.filter(
(t) => t.categoryId !== null
).length;
const categorizedPercent =
total > 0 ? Math.round((categorized / total) * 100) : 0;
const formatCurrency = (amount: number) => { const formatCurrency = (amount: number) => {
return new Intl.NumberFormat("fr-FR", { return new Intl.NumberFormat("fr-FR", {
style: "currency", style: "currency",
@@ -45,14 +57,13 @@ export function OverviewCards({ data }: OverviewCardsProps) {
}; };
return ( return (
<div className="grid gap-4 sm:gap-6 grid-cols-2 lg:grid-cols-4"> <div className="grid gap-4 sm:gap-6 grid-cols-2 lg:grid-cols-5">
<Card className="stat-card-gradient-1 card-hover group relative overflow-hidden"> <Card className="stat-card-gradient-1 card-hover group relative overflow-hidden">
<div className="absolute inset-0 bg-gradient-to-br from-primary/8 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-500" />
<CardHeader className="flex flex-row items-start justify-between space-y-0 pb-4 px-6 pt-6 sm:px-7 sm:pt-7 lg:px-5 lg:pt-5 relative z-10"> <CardHeader className="flex flex-row items-start justify-between space-y-0 pb-4 px-6 pt-6 sm:px-7 sm:pt-7 lg:px-5 lg:pt-5 relative z-10">
<CardTitle className="text-xs font-bold text-muted-foreground/70 leading-tight uppercase tracking-widest"> <CardTitle className="text-xs font-bold text-muted-foreground/70 leading-tight uppercase tracking-widest">
Solde Total Solde Total
</CardTitle> </CardTitle>
<div className="rounded-2xl bg-gradient-to-br from-primary/30 via-primary/20 to-primary/10 p-3 shrink-0 group-hover:scale-110 group-hover:rotate-3 transition-all duration-300 shadow-lg shadow-primary/20"> <div className="rounded-2xl bg-gradient-to-br from-primary/30 via-primary/20 to-primary/10 p-3 shrink-0 shadow-lg shadow-primary/20">
<Wallet className="h-5 w-5 text-primary" /> <Wallet className="h-5 w-5 text-primary" />
</div> </div>
</CardHeader> </CardHeader>
@@ -62,7 +73,7 @@ export function OverviewCards({ data }: OverviewCardsProps) {
"text-2xl sm:text-3xl md:text-3xl lg:text-xl xl:text-xl font-black tracking-tight mb-4 leading-none break-words", "text-2xl sm:text-3xl md:text-3xl lg:text-xl xl:text-xl font-black tracking-tight mb-4 leading-none break-words",
totalBalance >= 0 totalBalance >= 0
? "text-emerald-600 dark:text-emerald-400" ? "text-emerald-600 dark:text-emerald-400"
: "text-red-600 dark:text-red-400", : "text-red-600 dark:text-red-400"
)} )}
> >
{formatCurrency(totalBalance)} {formatCurrency(totalBalance)}
@@ -74,12 +85,11 @@ export function OverviewCards({ data }: OverviewCardsProps) {
</Card> </Card>
<Card className="stat-card-gradient-2 card-hover group relative overflow-hidden"> <Card className="stat-card-gradient-2 card-hover group relative overflow-hidden">
<div className="absolute inset-0 bg-gradient-to-br from-success/8 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-500" />
<CardHeader className="flex flex-row items-start justify-between space-y-0 pb-4 px-6 pt-6 sm:px-7 sm:pt-7 lg:px-5 lg:pt-5 relative z-10"> <CardHeader className="flex flex-row items-start justify-between space-y-0 pb-4 px-6 pt-6 sm:px-7 sm:pt-7 lg:px-5 lg:pt-5 relative z-10">
<CardTitle className="text-xs font-bold text-muted-foreground/70 leading-tight uppercase tracking-widest"> <CardTitle className="text-xs font-bold text-muted-foreground/70 leading-tight uppercase tracking-widest">
Revenus du mois Revenus du mois
</CardTitle> </CardTitle>
<div className="rounded-2xl bg-gradient-to-br from-success/30 via-success/20 to-success/10 p-3 shrink-0 group-hover:scale-110 group-hover:rotate-3 transition-all duration-300 shadow-lg shadow-success/20"> <div className="rounded-2xl bg-gradient-to-br from-success/30 via-success/20 to-success/10 p-3 shrink-0 shadow-lg shadow-success/20">
<TrendingUp className="h-5 w-5 text-success" /> <TrendingUp className="h-5 w-5 text-success" />
</div> </div>
</CardHeader> </CardHeader>
@@ -97,12 +107,11 @@ export function OverviewCards({ data }: OverviewCardsProps) {
</Card> </Card>
<Card className="stat-card-gradient-3 card-hover group relative overflow-hidden"> <Card className="stat-card-gradient-3 card-hover group relative overflow-hidden">
<div className="absolute inset-0 bg-gradient-to-br from-destructive/8 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-500" />
<CardHeader className="flex flex-row items-start justify-between space-y-0 pb-4 px-6 pt-6 sm:px-7 sm:pt-7 lg:px-5 lg:pt-5 relative z-10"> <CardHeader className="flex flex-row items-start justify-between space-y-0 pb-4 px-6 pt-6 sm:px-7 sm:pt-7 lg:px-5 lg:pt-5 relative z-10">
<CardTitle className="text-xs font-bold text-muted-foreground/70 leading-tight uppercase tracking-widest"> <CardTitle className="text-xs font-bold text-muted-foreground/70 leading-tight uppercase tracking-widest">
Dépenses du mois Dépenses du mois
</CardTitle> </CardTitle>
<div className="rounded-2xl bg-gradient-to-br from-destructive/30 via-destructive/20 to-destructive/10 p-3 shrink-0 group-hover:scale-110 group-hover:rotate-3 transition-all duration-300 shadow-lg shadow-destructive/20"> <div className="rounded-2xl bg-gradient-to-br from-destructive/30 via-destructive/20 to-destructive/10 p-3 shrink-0 shadow-lg shadow-destructive/20">
<TrendingDown className="h-5 w-5 text-destructive" /> <TrendingDown className="h-5 w-5 text-destructive" />
</div> </div>
</CardHeader> </CardHeader>
@@ -120,12 +129,11 @@ export function OverviewCards({ data }: OverviewCardsProps) {
</Card> </Card>
<Card className="stat-card-gradient-4 card-hover group relative overflow-hidden"> <Card className="stat-card-gradient-4 card-hover group relative overflow-hidden">
<div className="absolute inset-0 bg-gradient-to-br from-chart-4/8 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-500" />
<CardHeader className="flex flex-row items-start justify-between space-y-0 pb-4 px-6 pt-6 sm:px-7 sm:pt-7 lg:px-5 lg:pt-5 relative z-10"> <CardHeader className="flex flex-row items-start justify-between space-y-0 pb-4 px-6 pt-6 sm:px-7 sm:pt-7 lg:px-5 lg:pt-5 relative z-10">
<CardTitle className="text-xs font-bold text-muted-foreground/70 leading-tight uppercase tracking-widest"> <CardTitle className="text-xs font-bold text-muted-foreground/70 leading-tight uppercase tracking-widest">
Pointage Pointage
</CardTitle> </CardTitle>
<div className="rounded-2xl bg-gradient-to-br from-chart-4/30 via-chart-4/20 to-chart-4/10 p-3 shrink-0 group-hover:scale-110 group-hover:rotate-3 transition-all duration-300 shadow-lg shadow-chart-4/20"> <div className="rounded-2xl bg-gradient-to-br from-chart-4/30 via-chart-4/20 to-chart-4/10 p-3 shrink-0 shadow-lg shadow-chart-4/20">
<CreditCard className="h-5 w-5 text-chart-4" /> <CreditCard className="h-5 w-5 text-chart-4" />
</div> </div>
</CardHeader> </CardHeader>
@@ -138,6 +146,25 @@ export function OverviewCards({ data }: OverviewCardsProps) {
</p> </p>
</CardContent> </CardContent>
</Card> </Card>
<Card className="stat-card-gradient-5 card-hover group relative overflow-hidden">
<CardHeader className="flex flex-row items-start justify-between space-y-0 pb-4 px-6 pt-6 sm:px-7 sm:pt-7 lg:px-5 lg:pt-5 relative z-10">
<CardTitle className="text-xs font-bold text-muted-foreground/70 leading-tight uppercase tracking-widest">
Catégorisation
</CardTitle>
<div className="rounded-2xl bg-gradient-to-br from-chart-5/30 via-chart-5/20 to-chart-5/10 p-3 shrink-0 shadow-lg shadow-chart-5/20">
<Tag className="h-5 w-5 text-chart-5" />
</div>
</CardHeader>
<CardContent className="px-6 pb-6 sm:px-7 sm:pb-7 lg:px-5 lg:pb-5 pt-0 relative z-10">
<div className="text-2xl sm:text-3xl md:text-3xl lg:text-xl xl:text-xl font-black tracking-tight mb-4 leading-none break-words">
{categorizedPercent}%
</div>
<p className="text-xs sm:text-sm font-semibold text-muted-foreground/60">
{categorized} / {total} opérations catégorisées
</p>
</CardContent>
</Card>
</div> </div>
); );
} }

View File

@@ -76,7 +76,7 @@ export function RecentTransactions({ data }: RecentTransactionsProps) {
return ( return (
<div <div
key={transaction.id} key={transaction.id}
className="group rounded-2xl bg-gradient-to-r from-muted/50 via-muted/30 to-muted/20 hover:from-muted/70 hover:via-muted/50 hover:to-muted/40 border-2 border-border/40 hover:border-primary/30 transition-all duration-300 overflow-hidden hover:shadow-lg hover:shadow-primary/10 hover:scale-[1.02] backdrop-blur-sm" className="group rounded-2xl bg-gradient-to-r from-muted/50 via-muted/30 to-muted/20 border-2 border-border/40 overflow-hidden backdrop-blur-sm"
> >
<div className="flex items-start gap-4 md:gap-5 p-4 md:p-5"> <div className="flex items-start gap-4 md:gap-5 p-4 md:p-5">
<div className="flex-1 min-w-0 overflow-hidden"> <div className="flex-1 min-w-0 overflow-hidden">
@@ -89,7 +89,7 @@ export function RecentTransactions({ data }: RecentTransactionsProps) {
"font-black tabular-nums text-sm md:text-base shrink-0 md:hidden", "font-black tabular-nums text-sm md:text-base shrink-0 md:hidden",
transaction.amount >= 0 transaction.amount >= 0
? "text-emerald-600 dark:text-emerald-400" ? "text-emerald-600 dark:text-emerald-400"
: "text-red-600 dark:text-red-400", : "text-red-600 dark:text-red-400"
)} )}
> >
{transaction.amount >= 0 ? "+" : ""} {transaction.amount >= 0 ? "+" : ""}
@@ -131,7 +131,7 @@ export function RecentTransactions({ data }: RecentTransactionsProps) {
"font-black tabular-nums text-base md:text-lg shrink-0 hidden md:block leading-tight", "font-black tabular-nums text-base md:text-lg shrink-0 hidden md:block leading-tight",
transaction.amount >= 0 transaction.amount >= 0
? "text-emerald-600 dark:text-emerald-400" ? "text-emerald-600 dark:text-emerald-400"
: "text-red-600 dark:text-red-400", : "text-red-600 dark:text-red-400"
)} )}
> >
{transaction.amount >= 0 ? "+" : ""} {transaction.amount >= 0 ? "+" : ""}

View File

@@ -85,8 +85,7 @@ function SidebarContent({
<Button <Button
variant={isActive ? "secondary" : "ghost"} variant={isActive ? "secondary" : "ghost"}
className={cn( className={cn(
"w-full justify-start gap-4 h-12 rounded-2xl transition-all duration-300", "w-full justify-start gap-4 h-12 rounded-2xl",
"hover:bg-muted/70 hover:scale-[1.02] hover:shadow-md",
isActive && isActive &&
"bg-gradient-to-r from-primary/15 via-primary/10 to-primary/5 border-2 border-primary/30 shadow-lg shadow-primary/10 backdrop-blur-sm", "bg-gradient-to-r from-primary/15 via-primary/10 to-primary/5 border-2 border-primary/30 shadow-lg shadow-primary/10 backdrop-blur-sm",
collapsed && "justify-center px-2 w-12 mx-auto", collapsed && "justify-center px-2 w-12 mx-auto",
@@ -94,8 +93,8 @@ function SidebarContent({
> >
<item.icon <item.icon
className={cn( className={cn(
"w-5 h-5 shrink-0 transition-all duration-300", "w-5 h-5 shrink-0",
isActive && "text-primary scale-110", isActive && "text-primary",
)} )}
/> />
{!collapsed && ( {!collapsed && (
@@ -124,7 +123,7 @@ function SidebarContent({
<Button <Button
variant="ghost" variant="ghost"
className={cn( className={cn(
"w-full justify-start gap-4 h-12 rounded-2xl transition-all duration-300 hover:bg-muted/70 hover:scale-[1.02] hover:shadow-md", "w-full justify-start gap-4 h-12 rounded-2xl",
collapsed && "justify-center px-2 w-12 mx-auto", collapsed && "justify-center px-2 w-12 mx-auto",
)} )}
> >
@@ -138,8 +137,8 @@ function SidebarContent({
variant="ghost" variant="ghost"
onClick={handleSignOut} onClick={handleSignOut}
className={cn( className={cn(
"w-full justify-start gap-4 h-12 rounded-2xl transition-all duration-300", "w-full justify-start gap-4 h-12 rounded-2xl",
"text-destructive hover:text-destructive hover:bg-destructive/15 hover:scale-[1.02] hover:shadow-md", "text-destructive",
collapsed && "justify-center px-2 w-12 mx-auto", collapsed && "justify-center px-2 w-12 mx-auto",
)} )}
> >
@@ -180,14 +179,14 @@ export function Sidebar({ open, onOpenChange }: SidebarProps) {
return ( return (
<aside <aside
className={cn( className={cn(
"hidden md:flex flex-col h-screen glass border-r border-border transition-all duration-300", "hidden md:flex flex-col h-screen glass border-r border-border",
"backdrop-blur-xl", "backdrop-blur-xl",
collapsed ? "w-16" : "w-64", collapsed ? "w-16" : "w-64",
)} )}
> >
<div <div
className={cn( className={cn(
"flex items-center border-b border-border/30 transition-all duration-300", "flex items-center border-b border-border/30",
collapsed ? "justify-center p-4" : "justify-between p-6", collapsed ? "justify-center p-4" : "justify-between p-6",
)} )}
> >
@@ -206,7 +205,7 @@ export function Sidebar({ open, onOpenChange }: SidebarProps) {
size="icon" size="icon"
onClick={() => setCollapsed(!collapsed)} onClick={() => setCollapsed(!collapsed)}
className={cn( className={cn(
"hover:bg-muted/60 rounded-xl transition-all duration-300 hover:scale-110", "rounded-xl",
collapsed ? "" : "ml-auto", collapsed ? "" : "ml-auto",
)} )}
> >

View File

@@ -57,7 +57,7 @@ export function RuleGroupCard({
<div className="border border-border rounded-lg bg-card overflow-hidden"> <div className="border border-border rounded-lg bg-card overflow-hidden">
{/* Header */} {/* Header */}
<div <div
className="flex flex-col md:flex-row md:items-center gap-2 md:gap-3 p-3 md:p-4 cursor-pointer hover:bg-accent/5 transition-colors" className="flex flex-col md:flex-row md:items-center gap-2 md:gap-3 p-3 md:p-4 cursor-pointer hover:bg-accent/5"
onClick={onToggleExpand} onClick={onToggleExpand}
> >
<div className="flex items-center gap-2 md:gap-3 flex-1 min-w-0"> <div className="flex items-center gap-2 md:gap-3 flex-1 min-w-0">

View File

@@ -1,5 +1,6 @@
"use client"; "use client";
import Link from "next/link";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { CategoryIcon } from "@/components/ui/category-icon"; import { CategoryIcon } from "@/components/ui/category-icon";
import { import {
@@ -29,6 +30,48 @@ export function CategoryBarChart({
}: CategoryBarChartProps) { }: CategoryBarChartProps) {
const displayData = data.slice(0, maxItems).reverse(); // Reverse pour avoir le plus grand en haut const displayData = data.slice(0, maxItems).reverse(); // Reverse pour avoir le plus grand en haut
// Custom tick component for clickable labels
const CustomYAxisTick = ({ x, y, payload }: any) => {
const categoryName = payload.value;
const item = displayData.find((d) => d.name === categoryName);
if (!item) {
return (
<text
x={x}
y={y}
fill="var(--muted-foreground)"
fontSize={12}
textAnchor="end"
dominantBaseline="middle"
>
{categoryName}
</text>
);
}
const href =
item.categoryId === null || item.categoryId === undefined
? "/transactions?includeUncategorized=true"
: `/transactions?categoryIds=${item.categoryId}`;
return (
<Link href={href}>
<text
x={x}
y={y}
fill="var(--muted-foreground)"
fontSize={12}
className="hover:opacity-80 transition-opacity cursor-pointer"
textAnchor="end"
dominantBaseline="middle"
>
{categoryName}
</text>
</Link>
);
};
return ( return (
<Card> <Card>
<CardHeader> <CardHeader>
@@ -60,11 +103,7 @@ export function CategoryBarChart({
dataKey="name" dataKey="name"
className="text-xs" className="text-xs"
width={90} width={90}
tick={{ fill: "var(--muted-foreground)" }} tick={CustomYAxisTick}
tickFormatter={(value) => {
const item = displayData.find((d) => d.name === value);
return item ? value : "";
}}
/> />
<Tooltip <Tooltip
content={({ active, payload }) => { content={({ active, payload }) => {

View File

@@ -1,6 +1,7 @@
"use client"; "use client";
import { useState } from "react"; import { useState } from "react";
import Link from "next/link";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { CategoryIcon } from "@/components/ui/category-icon"; import { CategoryIcon } from "@/components/ui/category-icon";
@@ -13,7 +14,8 @@ export interface CategoryChartData {
value: number; value: number;
color: string; color: string;
icon: string; icon: string;
[key: string]: string | number; categoryId?: string | null; // null for "Non catégorisé"
[key: string]: string | number | null | undefined;
} }
interface CategoryPieChartProps { interface CategoryPieChartProps {
@@ -162,24 +164,32 @@ export function CategoryPieChart({
Légende Légende
</div> </div>
<div className="max-h-[300px] overflow-y-auto overflow-x-hidden pr-2 space-y-2"> <div className="max-h-[300px] overflow-y-auto overflow-x-hidden pr-2 space-y-2">
{currentData.map((item, index) => ( {currentData.map((item, index) => {
<div const href =
key={`legend-${index}`} item.categoryId === null || item.categoryId === undefined
className="flex items-center gap-2 text-sm" ? "/transactions?includeUncategorized=true"
> : `/transactions?categoryIds=${item.categoryId}`;
<CategoryIcon
icon={item.icon} return (
color={item.color} <Link
size={16} key={`legend-${index}`}
/> href={href}
<span className="text-foreground flex-1 min-w-0 truncate"> className="flex items-center gap-2 text-sm hover:opacity-80 transition-opacity cursor-pointer"
{item.name} >
</span> <CategoryIcon
<span className="text-foreground font-semibold tabular-nums whitespace-nowrap"> icon={item.icon}
{formatCurrency(item.value)} color={item.color}
</span> size={16}
</div> />
))} <span className="text-foreground flex-1 min-w-0 truncate">
{item.name}
</span>
<span className="text-foreground font-semibold tabular-nums whitespace-nowrap">
{formatCurrency(item.value)}
</span>
</Link>
);
})}
</div> </div>
</div> </div>
</div> </div>

View File

@@ -1,5 +1,6 @@
"use client"; "use client";
import Link from "next/link";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { CategoryIcon } from "@/components/ui/category-icon"; import { CategoryIcon } from "@/components/ui/category-icon";
import { Badge } from "@/components/ui/badge"; import { Badge } from "@/components/ui/badge";
@@ -53,24 +54,29 @@ export function TopExpensesList({
{new Date(expense.date).toLocaleDateString("fr-FR")} {new Date(expense.date).toLocaleDateString("fr-FR")}
</span> </span>
{category && ( {category && (
<Badge <Link
variant="secondary" href={`/transactions?categoryIds=${category.id}`}
className="text-[10px] md:text-xs px-1.5 md:px-2 py-0.5 inline-flex items-center gap-1 shrink-0" className="inline-block"
style={{
backgroundColor: `${category.color}20`,
color: category.color,
borderColor: `${category.color}30`,
}}
> >
<CategoryIcon <Badge
icon={category.icon} variant="secondary"
color={category.color} className="text-[10px] md:text-xs px-1.5 md:px-2 py-0.5 inline-flex items-center gap-1 shrink-0 hover:opacity-80 transition-opacity cursor-pointer"
size={isMobile ? 8 : 10} style={{
/> backgroundColor: `${category.color}20`,
<span className="truncate max-w-[120px] md:max-w-none"> color: category.color,
{category.name} borderColor: `${category.color}30`,
</span> }}
</Badge> >
<CategoryIcon
icon={category.icon}
color={category.color}
size={isMobile ? 8 : 10}
/>
<span className="truncate max-w-[120px] md:max-w-none">
{category.name}
</span>
</Badge>
</Link>
)} )}
</div> </div>
</div> </div>

View File

@@ -238,7 +238,7 @@ export function TransactionTable({
<div <div
ref={parentRef} ref={parentRef}
className="overflow-auto" className="overflow-auto"
style={{ height: "calc(100vh - 300px)", minHeight: "400px" }} style={{ height: "calc(100vh - 200px)", minHeight: "600px" }}
> >
<div <div
style={{ style={{
@@ -468,7 +468,7 @@ export function TransactionTable({
<div <div
ref={parentRef} ref={parentRef}
className="overflow-auto" className="overflow-auto"
style={{ height: "calc(100vh - 400px)", minHeight: "400px" }} style={{ height: "calc(100vh - 200px)", minHeight: "700px" }}
> >
<div <div
style={{ style={{

View File

@@ -54,7 +54,7 @@ function AlertDialogContent({
<AlertDialogPrimitive.Content <AlertDialogPrimitive.Content
data-slot="alert-dialog-content" data-slot="alert-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)] max-h-[calc(100vh-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 overflow-y-auto sm:max-w-lg",
className, className,
)} )}
{...props} {...props}

View File

@@ -43,7 +43,7 @@ function BreadcrumbLink({
return ( return (
<Comp <Comp
data-slot="breadcrumb-link" data-slot="breadcrumb-link"
className={cn("hover:text-foreground transition-colors", className)} className={cn("hover:text-foreground", className)}
{...props} {...props}
/> />
); );

View File

@@ -5,21 +5,20 @@ 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-xl text-sm font-semibold transition-all duration-300 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: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-xl text-sm font-semibold 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: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: default:
"bg-gradient-to-r from-primary via-primary/95 to-primary/90 text-primary-foreground hover:from-primary/95 hover:via-primary hover:to-primary/95 shadow-xl shadow-primary/30 hover:shadow-2xl hover:shadow-primary/40 hover:scale-[1.03] active:scale-[0.97] backdrop-blur-sm border border-primary/20", "bg-gradient-to-r from-primary via-primary/95 to-primary/90 text-primary-foreground shadow-xl shadow-primary/30 backdrop-blur-sm border border-primary/20",
destructive: destructive:
"bg-gradient-to-r from-destructive via-destructive/95 to-destructive/90 text-white hover:from-destructive/95 hover:via-destructive hover:to-destructive/95 shadow-xl shadow-destructive/30 hover:shadow-2xl hover:shadow-destructive/40 hover:scale-[1.03] focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 active:scale-[0.97] backdrop-blur-sm border border-destructive/20", "bg-gradient-to-r from-destructive via-destructive/95 to-destructive/90 text-white shadow-xl shadow-destructive/30 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 backdrop-blur-sm border border-destructive/20",
outline: outline:
"border-2 bg-background/95 backdrop-blur-md shadow-md hover:bg-accent hover:text-accent-foreground hover:border-primary/50 hover:shadow-lg hover:scale-[1.03] dark:bg-input/40 dark:border-input dark:hover:bg-input/60 active:scale-[0.97]", "border-2 bg-background/95 backdrop-blur-md shadow-md dark:bg-input/40 dark:border-input",
secondary: secondary:
"bg-gradient-to-r from-secondary via-secondary/95 to-secondary/90 text-secondary-foreground hover:from-secondary/95 hover:via-secondary hover:to-secondary/95 hover:shadow-lg hover:scale-[1.03] active:scale-[0.97] backdrop-blur-sm", "bg-gradient-to-r from-secondary via-secondary/95 to-secondary/90 text-secondary-foreground backdrop-blur-sm",
ghost: ghost: "backdrop-blur-sm",
"hover:bg-accent/70 hover:text-accent-foreground dark:hover:bg-accent/50 hover:scale-[1.03] active:scale-[0.97] backdrop-blur-sm", link: "text-primary underline-offset-4 font-semibold",
link: "text-primary underline-offset-4 hover:underline font-semibold",
}, },
size: { size: {
default: "h-10 px-5 py-2.5 has-[>svg]:px-4", default: "h-10 px-5 py-2.5 has-[>svg]:px-4",
@@ -34,7 +33,7 @@ const buttonVariants = cva(
variant: "default", variant: "default",
size: "default", size: "default",
}, },
}, }
); );
function Button({ function Button({

View File

@@ -9,7 +9,6 @@ function Card({ className, ...props }: React.ComponentProps<"div">) {
className={cn( className={cn(
"fintech-card", "fintech-card",
"bg-card text-card-foreground flex flex-col", "bg-card text-card-foreground flex flex-col",
"transition-all duration-300 ease-out",
className, className,
)} )}
{...props} {...props}

View File

@@ -60,7 +60,7 @@ 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 flex flex-col w-full max-w-[calc(100%-2rem)] max-h-[calc(100vh-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 overflow-y-auto sm:max-w-lg",
className, className,
)} )}
{...props} {...props}
@@ -69,7 +69,7 @@ function DialogContent({
{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 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>

View File

@@ -316,7 +316,7 @@ export function IconPicker({ value, onChange, color }: IconPickerProps) {
key={icon} key={icon}
onClick={() => handleSelect(icon)} onClick={() => handleSelect(icon)}
className={cn( className={cn(
"flex items-center justify-center p-2 rounded-md hover:bg-accent transition-colors", "flex items-center justify-center p-2 rounded-md hover:bg-accent",
value === icon && "bg-accent ring-2 ring-primary", value === icon && "bg-accent ring-2 ring-primary",
)} )}
title={icon} title={icon}

View File

@@ -58,21 +58,21 @@ function SheetContent({
<SheetPrimitive.Content <SheetPrimitive.Content
data-slot="sheet-content" data-slot="sheet-content"
className={cn( className={cn(
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500", "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 overflow-y-auto",
side === "right" && side === "right" &&
"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm", "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
side === "left" && side === "left" &&
"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm", "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
side === "top" && side === "top" &&
"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b", "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 max-h-[calc(100vh-2rem)] border-b",
side === "bottom" && side === "bottom" &&
"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t", "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 max-h-[calc(100vh-2rem)] border-t",
className, className,
)} )}
{...props} {...props}
> >
{children} {children}
<SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary 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"> <SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
<XIcon className="size-4" /> <XIcon className="size-4" />
<span className="sr-only">Close</span> <span className="sr-only">Close</span>
</SheetPrimitive.Close> </SheetPrimitive.Close>

View File

@@ -57,7 +57,7 @@ function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
<tr <tr
data-slot="table-row" data-slot="table-row"
className={cn( className={cn(
"hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors", "hover:bg-muted/50 data-[state=selected]:bg-muted border-b",
className, className,
)} )}
{...props} {...props}

View File

@@ -69,6 +69,21 @@ export function useTransactionsPage() {
} }
}, [searchParams]); }, [searchParams]);
// Handle categoryIds and includeUncategorized from URL params
useEffect(() => {
const categoryIdsParam = searchParams.get("categoryIds");
const includeUncategorizedParam = searchParams.get("includeUncategorized");
if (categoryIdsParam) {
const categoryIds = categoryIdsParam.split(",");
setSelectedCategories(categoryIds);
setPage(0);
} else if (includeUncategorizedParam === "true") {
setSelectedCategories(["uncategorized"]);
setPage(0);
}
}, [searchParams]);
// Calculate start date based on period // Calculate start date based on period
const startDate = useMemo(() => { const startDate = useMemo(() => {
const now = new Date(); const now = new Date();

View File

@@ -26,6 +26,7 @@ export interface TransactionsPaginatedResult {
transactions: Transaction[]; transactions: Transaction[];
total: number; total: number;
hasMore: boolean; hasMore: boolean;
uncategorizedCount: number;
} }
export const bankingService = { export const bankingService = {
@@ -210,6 +211,15 @@ export const bankingService = {
// Get total count // Get total count
const total = await prisma.transaction.count({ where }); const total = await prisma.transaction.count({ where });
// Get uncategorized count with same filters
const uncategorizedWhere = {
...where,
categoryId: null,
};
const uncategorizedCount = await prisma.transaction.count({
where: uncategorizedWhere,
});
// Get paginated transactions // Get paginated transactions
const transactions = await prisma.transaction.findMany({ const transactions = await prisma.transaction.findMany({
where, where,
@@ -252,6 +262,7 @@ export const bankingService = {
transactions: transformedTransactions, transactions: transformedTransactions,
total, total,
hasMore: offset + limit < total, hasMore: offset + limit < total,
uncategorizedCount,
}; };
}, },