Alternate names (maiden/married), self-person link, deletion integrity
Names (the genealogy standard: maiden name primary, married/alias as typed
alternates):
- Name model already supported multiple typed names; expose full CRUD —
NameCreate/Read/Update schemas, name_service (one-primary invariant,
promote-on-delete), nested /persons/{id}/names routes.
- Person page gains a Names card: add/edit/delete + "make primary", with a
curated name_type dropdown (birth/maiden, married, alias, nickname, …).
Self-person ("who am I"):
- users.self_person_id FK (use_alter for the users<->persons<->trees cycle)
+ migration; PATCH /users/me/self-person; "This is me" / "This is you"
on the person page. Soft-deleting the linked person clears it.
Deletion integrity (fixes the broken tree view):
- delete_person now soft-deletes the relationships touching the person, so no
dangling edges remain; family-chart also filters links to missing people.
- Optional cascade=true recursively deletes descendants (GEDCOM cleanup);
the person page asks "only this person" vs "with all descendants".
- DELETE returns {deleted: n}.
Family view surfaces "Not connected to anyone" so dangling people aren't lost.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -317,6 +317,17 @@ export default function FamilyViewPage() {
|
||||
const partners = partnersOf(focus.id);
|
||||
const children = childrenOf(focus.id);
|
||||
|
||||
// "Dangling" people: not linked to anyone. Common after a GEDCOM import or a
|
||||
// mistaken delete — surface them so they're not lost in the directory.
|
||||
const connected = new Set<string>();
|
||||
for (const r of rels) {
|
||||
connected.add(r.person_from_id);
|
||||
connected.add(r.person_to_id);
|
||||
}
|
||||
const unconnected = people
|
||||
.filter((p) => !connected.has(p.id))
|
||||
.sort((a, b) => (a.primary_name ?? "").localeCompare(b.primary_name ?? ""));
|
||||
|
||||
const sorted = [...people].sort((a, b) =>
|
||||
(a.primary_name ?? "").localeCompare(b.primary_name ?? ""),
|
||||
);
|
||||
@@ -380,6 +391,40 @@ export default function FamilyViewPage() {
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
{/* Unconnected people — not linked to anyone in the tree */}
|
||||
{unconnected.length > 0 && (
|
||||
<Card className="border-bronze/40">
|
||||
<CardContent className="space-y-3 p-6">
|
||||
<div className="flex items-center justify-between">
|
||||
<h2 className="font-serif text-base font-semibold">
|
||||
Not connected to anyone ({unconnected.length})
|
||||
</h2>
|
||||
<span className="text-xs text-[var(--muted)]">
|
||||
Open one and add a relationship, or delete it.
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex flex-wrap gap-3">
|
||||
{unconnected.slice(0, 60).map((p) => (
|
||||
<div key={p.id} className="flex items-center gap-1">
|
||||
<PersonBox id={p.id} muted />
|
||||
<Link
|
||||
href={`/trees/${treeId}/persons/${p.id}`}
|
||||
className="text-xs text-bronze hover:underline"
|
||||
>
|
||||
open
|
||||
</Link>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
{unconnected.length > 60 && (
|
||||
<p className="text-xs text-[var(--muted)]">
|
||||
Showing 60 of {unconnected.length}.
|
||||
</p>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{/* Scrollable, searchable people directory (scales to large trees) */}
|
||||
<div className="space-y-3">
|
||||
<div className="flex flex-wrap items-center justify-between gap-3">
|
||||
|
||||
Reference in New Issue
Block a user