Skip to content

Commit 2ba15d0

Browse files
authored
feat: ui: add view all link and fix currency display in analytics (#133)
1 parent e457d98 commit 2ba15d0

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

frontend/components/custom/AccountAnalytics/AccountAnalytics.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { formatCurrency, getTransactionColor } from "@/lib/utils";
2323
import { format } from "date-fns";
2424
import { ChevronRight, Plus, Wallet } from "lucide-react";
2525
import { useTheme } from "next-themes";
26+
import Link from "next/link";
2627
import { Fragment, useEffect, useState } from "react";
2728

2829
interface AccountAnalyticsProps {
@@ -95,12 +96,19 @@ function AccountTransactions({ accountId }: AccountTransactionsProps) {
9596
);
9697
}
9798

99+
const transactionsUrl = `/transaction?account_id=${accountId}`;
100+
98101
return (
99102
<TableRow>
100103
<TableCell colSpan={4} className="bg-muted/40">
101104
<div className="px-4 py-3">
102-
<div className="text-xs uppercase tracking-wide text-muted-foreground">
103-
Latest 5 transactions
105+
<div className="flex items-center justify-between gap-2">
106+
<div className="text-xs uppercase tracking-wide text-muted-foreground">
107+
Latest 5 transactions
108+
</div>
109+
<Button variant="ghost" size="sm" asChild>
110+
<Link href={transactionsUrl}>View all</Link>
111+
</Button>
104112
</div>
105113
<div className="mt-3 space-y-2">
106114
{transactions.map((transaction) => (

frontend/components/custom/CategoryAnalytics/CategoryAnalytics.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { formatCurrency, getTransactionColor } from "@/lib/utils";
2323
import { format } from "date-fns";
2424
import { ChevronRight, FileQuestion, Plus, Tag } from "lucide-react";
2525
import { useTheme } from "next-themes";
26+
import Link from "next/link";
2627
import { Fragment, useEffect, useState } from "react";
2728

2829
interface CategoryAnalyticsProps {
@@ -104,12 +105,21 @@ function CategoryTransactions({
104105
);
105106
}
106107

108+
const transactionsUrl = isUncategorized
109+
? "/transaction?uncategorized=true"
110+
: `/transaction?category_id=${categoryId}`;
111+
107112
return (
108113
<TableRow>
109114
<TableCell colSpan={4} className="bg-muted/40">
110115
<div className="px-4 py-3">
111-
<div className="text-xs uppercase tracking-wide text-muted-foreground">
112-
Latest 5 transactions
116+
<div className="flex items-center justify-between gap-2">
117+
<div className="text-xs uppercase tracking-wide text-muted-foreground">
118+
Latest 5 transactions
119+
</div>
120+
<Button variant="ghost" size="sm" asChild>
121+
<Link href={transactionsUrl}>View all</Link>
122+
</Button>
113123
</div>
114124
<div className="mt-3 space-y-2">
115125
{transactions.map((transaction) => (

0 commit comments

Comments
 (0)