feat: enhance TransactionsPage with total count and amount display; update CategoryCard and ParentCategoryRow to link to transaction filters by category; implement localStorage for transaction period preference
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 1m57s

This commit is contained in:
Julien Froidefond
2025-12-21 08:33:19 +01:00
parent 8b62cd8385
commit 82e27524b5
4 changed files with 24 additions and 4 deletions

View File

@@ -243,6 +243,13 @@ export default function TransactionsPage() {
<CardHeader className="flex flex-row items-center justify-between space-y-0 py-3 px-6"> <CardHeader className="flex flex-row items-center justify-between space-y-0 py-3 px-6">
<CardTitle className="text-base font-semibold"> <CardTitle className="text-base font-semibold">
Statistiques Statistiques
{!isStatsExpanded && (
<span className="ml-3 text-sm font-normal text-muted-foreground">
{displayTotalCount} opération
{displayTotalCount > 1 ? "s" : ""} {" "}
{formatCurrency(totalAmount)}
</span>
)}
</CardTitle> </CardTitle>
<CollapsibleTrigger asChild> <CollapsibleTrigger asChild>
<Button variant="ghost" size="sm" className="h-8"> <Button variant="ghost" size="sm" className="h-8">

View File

@@ -1,5 +1,6 @@
"use client"; "use client";
import Link from "next/link";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge"; import { Badge } from "@/components/ui/badge";
import { CategoryIcon } from "@/components/ui/category-icon"; import { CategoryIcon } from "@/components/ui/category-icon";
@@ -37,7 +38,13 @@ export function CategoryCard({
size={isMobile ? 10 : 12} size={isMobile ? 10 : 12}
/> />
</div> </div>
<span className="text-xs md:text-sm truncate">{category.name}</span> <Link
href={`/transactions?categoryIds=${category.id}`}
className="text-xs md:text-sm truncate hover:underline"
onClick={(e) => e.stopPropagation()}
>
{category.name}
</Link>
{!isMobile && ( {!isMobile && (
<span className="text-xs md:text-sm text-muted-foreground shrink-0"> <span className="text-xs md:text-sm text-muted-foreground shrink-0">
{stats.count} opération{stats.count > 1 ? "s" : ""} {" "} {stats.count} opération{stats.count > 1 ? "s" : ""} {" "}

View File

@@ -1,5 +1,6 @@
"use client"; "use client";
import Link from "next/link";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { import {
DropdownMenu, DropdownMenu,
@@ -73,9 +74,13 @@ export function ParentCategoryRow({
size={isMobile ? 10 : 14} size={isMobile ? 10 : 14}
/> />
</div> </div>
<span className="font-medium text-xs md:text-sm truncate"> <Link
href={`/transactions?categoryIds=${parent.id}`}
className="font-medium text-xs md:text-sm truncate hover:underline"
onClick={(e) => e.stopPropagation()}
>
{parent.name} {parent.name}
</span> </Link>
{!isMobile && ( {!isMobile && (
<span className="text-xs md:text-sm text-muted-foreground shrink-0"> <span className="text-xs md:text-sm text-muted-foreground shrink-0">
{children.length} {stats.count} opération {children.length} {stats.count} opération

View File

@@ -7,6 +7,7 @@ import {
useTransactions, useTransactions,
useDuplicateIds, useDuplicateIds,
} from "@/lib/hooks"; } from "@/lib/hooks";
import { useLocalStorage } from "@/hooks/use-local-storage";
import type { TransactionsPaginatedParams } from "@/services/banking.service"; import type { TransactionsPaginatedParams } from "@/services/banking.service";
import type { Category } from "@/lib/types"; import type { Category } from "@/lib/types";
@@ -30,7 +31,7 @@ export function useTransactionsPage() {
"all", "all",
]); ]);
const [showReconciled, setShowReconciled] = useState<string>("all"); const [showReconciled, setShowReconciled] = useState<string>("all");
const [period, setPeriod] = useState<Period>("3months"); const [period, setPeriod] = useLocalStorage<Period>("transactions-period", "3months");
const [customStartDate, setCustomStartDate] = useState<Date | undefined>( const [customStartDate, setCustomStartDate] = useState<Date | undefined>(
undefined, undefined,
); );