fix(p1): wire New habit/New project buttons + fix Domain Add
Bug #3 (HIGH): New habit button on /habits did not open the create dialog. The HabitCreateDialog was mounted but the topbar's useCreateDialogStore had no consumer on /habits, so topbar clicks were no-ops. Bug #4 (HIGH): New project button on /projects had the same issue. Fix: mount CreateItemDialog (type=habit or type=project) on each page so the topbar store is consumed. Switch the page-level button to use the store too. The existing local HabitCreateDialog / ProjectCreateDialog still work as a fallback. Bug #5 (HIGH): Domain Add button on /settings/domains opened the Command Palette instead of creating the domain. Two-part cause: 1. The sticky topbar Quick add button was visually overlapping the form Add button (both anchored top-right). On click the topbar handleCreate fired and dispatched a synthetic Cmd+K opening the palette. 2. /api/domains POST required a slug field that the form did not send, returning 400. Fix: hide the topbar Quick add button on pages without a relevant quick-create (only show on /projects, /habits, /tasks). Make the form Add button explicit type=button with stopPropagation as defense in depth. Auto-generate the domain slug from the name on the server when not provided. Bug #3 + Bug #4 + Bug #5 all fixed in this commit.
This commit is contained in:
@@ -203,7 +203,7 @@ export function SettingsDomains() {
|
||||
</div>
|
||||
|
||||
{/* Add new domain */}
|
||||
<div className="flex gap-2">
|
||||
<div className="relative z-50 flex gap-2">
|
||||
<label htmlFor="new-domain-name" className="sr-only">
|
||||
New domain name
|
||||
</label>
|
||||
@@ -226,7 +226,7 @@ export function SettingsDomains() {
|
||||
disabled={creating}
|
||||
/>
|
||||
</div>
|
||||
<Button onClick={addDomain} disabled={creating || !newDomainName.trim()}>
|
||||
<Button type="button" onClick={(e) => { e.stopPropagation(); addDomain(); }} disabled={creating || !newDomainName.trim()}>
|
||||
<Plus className="mr-1 h-4 w-4" />
|
||||
{creating ? 'Adding...' : 'Add'}
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user