Make creating a person obvious; inline "create new" when linking relatives
- Family view gets a prominent "+ Add person" button that creates a person and opens their page to fill in details (previously you could only add a person via the empty-state form or by linking from another person). - The person page's relationship picker (PersonCombobox) now offers "+ Create '<typed name>'" when the person doesn't exist yet: it creates them, links them in the chosen role (parent/child/partner/sibling), and jumps to their new page to edit — no more create-then-go-back-and-link. Frontend only — no migration. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -126,6 +126,12 @@ export default function FamilyViewPage() {
|
||||
return data?.id ?? null;
|
||||
}
|
||||
|
||||
// Create a new (blank) person and open their page to fill in details.
|
||||
async function newPersonAndGo() {
|
||||
const id = await addPerson("");
|
||||
if (id) router.push(`/trees/${treeId}/persons/${id}`);
|
||||
}
|
||||
|
||||
async function createFirst(e: React.FormEvent) {
|
||||
e.preventDefault();
|
||||
if (!firstName.trim()) return;
|
||||
@@ -352,12 +358,17 @@ export default function FamilyViewPage() {
|
||||
<div className="space-y-8">
|
||||
<div className="flex flex-wrap items-center justify-between gap-3">
|
||||
<h1 className="text-2xl font-semibold">Family view</h1>
|
||||
<Link
|
||||
href={`/trees/${treeId}/persons/${focus.id}`}
|
||||
className="text-sm text-bronze hover:underline"
|
||||
>
|
||||
Open {focus.primary_name ?? "person"} →
|
||||
</Link>
|
||||
<div className="flex items-center gap-3">
|
||||
<Button size="sm" onClick={newPersonAndGo}>
|
||||
+ Add person
|
||||
</Button>
|
||||
<Link
|
||||
href={`/trees/${treeId}/persons/${focus.id}`}
|
||||
className="text-sm text-bronze hover:underline"
|
||||
>
|
||||
Open {focus.primary_name ?? "person"} →
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Pedigree: focus → parents → grandparents, with bracket connectors */}
|
||||
|
||||
Reference in New Issue
Block a user