2026-07-25 02:22:01 +00:00
|
|
|
"use client";
|
2026-07-16 06:19:58 -04:00
|
|
|
|
2026-07-25 02:22:01 +00:00
|
|
|
import { useState } from "react";
|
|
|
|
|
import { Plus } from "lucide-react";
|
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
|
import { HabitCard } from "@/components/habits/habit-card";
|
|
|
|
|
import { CreateItemDialog } from "@/components/create-item-dialog";
|
|
|
|
|
import { useCreateDialogStore } from "@/lib/stores/use-create-dialog-store";
|
2026-07-16 06:19:58 -04:00
|
|
|
|
|
|
|
|
export default function HabitsPage() {
|
2026-07-25 02:22:01 +00:00
|
|
|
const [refreshKey, setRefreshKey] = useState(0);
|
|
|
|
|
const { open, openCreate, closeCreate } = useCreateDialogStore();
|
2026-07-16 06:19:58 -04:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<div className="mb-6 flex items-center justify-between">
|
|
|
|
|
<div>
|
|
|
|
|
<h1 className="text-2xl font-bold">Habits</h1>
|
2026-07-25 02:22:01 +00:00
|
|
|
<p className="mt-1 text-muted-foreground">Build consistency, one day at a time.</p>
|
2026-07-16 06:19:58 -04:00
|
|
|
</div>
|
2026-07-25 02:22:01 +00:00
|
|
|
<Button onClick={() => openCreate("habit")}>
|
|
|
|
|
<Plus className="mr-2 h-4 w-4" aria-hidden="true" /> New habit
|
2026-07-16 06:19:58 -04:00
|
|
|
</Button>
|
|
|
|
|
</div>
|
2026-07-25 02:22:01 +00:00
|
|
|
<HabitCard key={refreshKey} />
|
|
|
|
|
<CreateItemDialog type="habit" open={open} onOpenChange={(o) => (o ? openCreate("habit") : closeCreate())} onCreated={() => setRefreshKey((k) => k + 1)} />
|
2026-07-16 06:19:58 -04:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|