Skip to content

Commit 20fac07

Browse files
authored
feat: add navigation buttons to MonthlyAnalyticsCard (#128)
1 parent 6c2752a commit 20fac07

File tree

2 files changed

+39
-15
lines changed

2 files changed

+39
-15
lines changed

frontend/components/custom/Dashboard/MonthlyAnalyticsCard.tsx

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { formatCurrency } from "@/lib/utils";
77
import {
88
ArrowRightLeftIcon,
99
CalendarIcon,
10+
ChevronLeftIcon,
11+
ChevronRightIcon,
1012
TrendingDownIcon,
1113
TrendingUpIcon,
1214
} from "lucide-react";
@@ -242,20 +244,42 @@ export function MonthlyAnalyticsCard() {
242244
))}
243245
</div>
244246

245-
{/* Dots Indicator */}
246-
<div className="flex justify-center gap-1">
247-
{dateRanges.map((_, index) => (
248-
<button
249-
key={index}
250-
className={`h-1.5 w-1.5 rounded-full transition-all duration-200 ${
251-
index === currentIndex
252-
? "bg-primary w-4"
253-
: "bg-muted-foreground/30 hover:bg-muted-foreground/50"
254-
}`}
255-
onClick={() => scrollToIndex(index)}
256-
aria-label={`View ${dateRanges[index].label} analytics`}
257-
/>
258-
))}
247+
{/* Navigation */}
248+
<div className="flex items-center justify-center gap-3">
249+
<button
250+
type="button"
251+
className="p-1 rounded-full text-muted-foreground hover:text-foreground disabled:opacity-40"
252+
onClick={() => scrollToIndex(Math.max(0, currentIndex - 1))}
253+
disabled={currentIndex === 0}
254+
aria-label="View previous range"
255+
>
256+
<ChevronLeftIcon className="h-4 w-4" />
257+
</button>
258+
<div className="flex justify-center gap-1">
259+
{dateRanges.map((_, index) => (
260+
<button
261+
key={index}
262+
className={`h-1.5 w-1.5 rounded-full transition-all duration-200 ${
263+
index === currentIndex
264+
? "bg-primary w-4"
265+
: "bg-muted-foreground/30 hover:bg-muted-foreground/50"
266+
}`}
267+
onClick={() => scrollToIndex(index)}
268+
aria-label={`View ${dateRanges[index].label} analytics`}
269+
/>
270+
))}
271+
</div>
272+
<button
273+
type="button"
274+
className="p-1 rounded-full text-muted-foreground hover:text-foreground disabled:opacity-40"
275+
onClick={() =>
276+
scrollToIndex(Math.min(dateRanges.length - 1, currentIndex + 1))
277+
}
278+
disabled={currentIndex === dateRanges.length - 1}
279+
aria-label="View next range"
280+
>
281+
<ChevronRightIcon className="h-4 w-4" />
282+
</button>
259283
</div>
260284
</CardContent>
261285
</Card>

frontend/components/custom/Modal/Statement/ViewStatementsModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ export function ViewStatementsModal({
288288
</TableCell>
289289
<TableCell>
290290
<div className="flex items-center space-x-2">
291-
<Calendar className="h-4 w-4 text-muted-foreground" />
291+
<CalendarIcon className="h-4 w-4 text-muted-foreground" />
292292
<span className="text-sm">
293293
{format(
294294
new Date(statement.created_at),

0 commit comments

Comments
 (0)