feat: add links to transaction pages from accounts and folders for improved navigation

This commit is contained in:
Julien Froidefond
2025-11-27 11:53:36 +01:00
parent 5eb37e631f
commit ef668510c8
3 changed files with 24 additions and 4 deletions

View File

@@ -40,6 +40,7 @@ import {
} from "lucide-react";
import type { Account } from "@/lib/types";
import { cn } from "@/lib/utils";
import Link from "next/link";
const accountTypeIcons = {
CHECKING: Wallet,
@@ -235,9 +236,12 @@ export default function AccountsPage() {
{formatCurrency(account.balance)}
</div>
<div className="flex items-center justify-between text-sm text-muted-foreground">
<span>
<Link
href={`/transactions?accountId=${account.id}`}
className="hover:text-primary hover:underline"
>
{getTransactionCount(account.id)} transactions
</span>
</Link>
{folder && <span>{folder.name}</span>}
</div>
{account.lastImport && (

View File

@@ -46,6 +46,7 @@ import {
} from "@/lib/store-db";
import type { Folder as FolderType, Account } from "@/lib/types";
import { cn } from "@/lib/utils";
import Link from "next/link";
const folderColors = [
{ value: "#6366f1", label: "Indigo" },
@@ -177,7 +178,12 @@ function FolderTreeItem({
)}
>
<Building2 className="w-4 h-4 text-muted-foreground" />
<span className="flex-1 text-sm">{account.name}</span>
<Link
href={`/transactions?accountId=${account.id}`}
className="flex-1 text-sm hover:text-primary hover:underline"
>
{account.name}
</Link>
<span
className={cn(
"text-sm tabular-nums",

View File

@@ -1,6 +1,7 @@
"use client";
import { useState, useMemo } from "react";
import { useState, useMemo, useEffect } from "react";
import { useSearchParams } from "next/navigation";
import { Sidebar } from "@/components/dashboard/sidebar";
import { useBankingData } from "@/lib/hooks";
import { Button } from "@/components/ui/button";
@@ -41,9 +42,18 @@ type SortField = "date" | "amount" | "description";
type SortOrder = "asc" | "desc";
export default function TransactionsPage() {
const searchParams = useSearchParams();
const { data, isLoading, refresh, update } = useBankingData();
const [searchQuery, setSearchQuery] = useState("");
const [selectedAccount, setSelectedAccount] = useState<string>("all");
// Initialize account filter from URL params
useEffect(() => {
const accountId = searchParams.get("accountId");
if (accountId) {
setSelectedAccount(accountId);
}
}, [searchParams]);
const [selectedCategory, setSelectedCategory] = useState<string>("all");
const [showReconciled, setShowReconciled] = useState<string>("all");
const [sortField, setSortField] = useState<SortField>("date");