aboutsummaryrefslogtreecommitdiffstats
path: root/frontend/src/app/(main)/goals/page.tsx
blob: b703cffb1a7d4b1f024fae6f45dccfd247bdb98d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"use client";

import { Button } from "@/components/ui/button";
import { PlusCircle, RefreshCw } from "lucide-react";
import Link from "next/link";
import { GoalsList } from "./components/goals-list";
import { useState } from "react";

export default function GoalsPage() {
  const [refreshing, setRefreshing] = useState(false);

  const handleRefresh = () => {
    setRefreshing(true);
    // Force reload the page
    window.location.href = `/goals?refresh=${new Date().getTime()}`;
  };

  return (
    <div className="container mx-auto px-4 py-6 md:py-8">
      <div className="flex flex-col sm:flex-row sm:justify-between sm:items-center mb-6 gap-4">
        <div>
          <h1 className="text-xl sm:text-2xl font-bold tracking-tight">Financial Goals</h1>
          <p className="text-sm text-muted-foreground">
            Track your progress towards your financial goals
          </p>
        </div>
        <div className="flex gap-2 sm:gap-3">
          <Button variant="outline" onClick={handleRefresh} disabled={refreshing} size="sm" className="text-xs sm:text-sm">
            <RefreshCw className="mr-1 h-3 w-3 sm:h-4 sm:w-4" />
            Refresh
          </Button>
          <Link href="/goals/new">
            <Button size="sm" className="text-xs sm:text-sm">
              <PlusCircle className="mr-1 h-3 w-3 sm:h-4 sm:w-4" />
              New Goal
            </Button>
          </Link>
        </div>
      </div>
      
      <GoalsList />
    </div>
  );
}