diff --git a/apps/web/app/(dashboard)/habits/page.tsx b/apps/web/app/(dashboard)/habits/page.tsx index 43cf3d3..3545abf 100644 --- a/apps/web/app/(dashboard)/habits/page.tsx +++ b/apps/web/app/(dashboard)/habits/page.tsx @@ -25,6 +25,8 @@ import { HabitEditDialog } from "@/components/habits/habit-edit-dialog"; import { HabitCompletionDialog } from "@/components/habits/habit-completion-dialog"; import { HabitCalendarHeatmap } from "@/components/habits/habit-calendar-heatmap"; import { HabitAnalytics } from "@/components/habits/habit-analytics"; +import { CreateItemDialog } from "@/components/create-item-dialog"; +import { useCreateDialogStore } from "@/lib/stores/use-create-dialog-store"; import { toast } from "sonner"; interface Habit { @@ -54,6 +56,7 @@ export default function HabitsPage() { const [domainId, setDomainId] = useState(null); const [domains, setDomains] = useState<{ id: string; name: string }[]>([]); const [createOpen, setCreateOpen] = useState(false); + const { open: storeOpen, openCreate, closeCreate } = useCreateDialogStore(); const [editHabit, setEditHabit] = useState(null); const [completionHabit, setCompletionHabit] = useState(null); const [deleteHabit, setDeleteHabit] = useState(null); @@ -154,7 +157,7 @@ export default function HabitsPage() { Active - @@ -255,11 +258,19 @@ export default function HabitsPage() { { setCreateOpen(o); if (!o) closeCreate(); }} domainId={domainId || ''} onCreated={fetchHabits} /> + {/* Global CreateItemDialog from useCreateDialogStore — opened by topbar 'New habit' button */} + { if (!o) closeCreate(); else openCreate('habit'); }} + onCreated={fetchHabits} + /> + {editHabit && ( (null); const [domains, setDomains] = useState<{ id: string; name: string }[]>([]); const [createOpen, setCreateOpen] = useState(false); + const { open: storeOpen, openCreate, closeCreate } = useCreateDialogStore(); const [editProject, setEditProject] = useState(null); const [archiveProject, setArchiveProject] = useState(null); const [archiving, setArchiving] = useState(false); @@ -119,7 +122,7 @@ export default function ProjectsPage() { ))} )} - @@ -220,11 +223,19 @@ export default function ProjectsPage() { { setCreateOpen(o); if (!o) closeCreate(); }} domainId={domainId || ''} onCreated={fetchProjects} /> + {/* Global CreateItemDialog from useCreateDialogStore — opened by topbar 'New project' button */} + { if (!o) closeCreate(); else openCreate('project'); }} + onCreated={fetchProjects} + /> + {editProject && (