From a062f27b0b95ba138cfe45576943e840086b5726 Mon Sep 17 00:00:00 2001 From: Pierre Hubert Date: Fri, 11 Aug 2023 11:38:16 +0200 Subject: [PATCH] Can set member biography --- geneit_app/src/api/MemberApi.ts | 4 ++++ .../src/routes/family/FamilyMemberRoute.tsx | 22 ++++++++++++++++--- geneit_app/src/widgets/forms/PropEdit.tsx | 6 +++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/geneit_app/src/api/MemberApi.ts b/geneit_app/src/api/MemberApi.ts index 22e83ea..8cb80da 100644 --- a/geneit_app/src/api/MemberApi.ts +++ b/geneit_app/src/api/MemberApi.ts @@ -159,6 +159,10 @@ export class Member implements MemberDataApi { ? true : false; } + + get hasNote(): boolean { + return (this.note?.length ?? 0) > 0; + } } export function fmtDate(d?: DateValue): string { diff --git a/geneit_app/src/routes/family/FamilyMemberRoute.tsx b/geneit_app/src/routes/family/FamilyMemberRoute.tsx index 5fd935e..9332444 100644 --- a/geneit_app/src/routes/family/FamilyMemberRoute.tsx +++ b/geneit_app/src/routes/family/FamilyMemberRoute.tsx @@ -576,9 +576,25 @@ export function MemberPage(p: { )} {/* Bio */} - - TODO - + {(p.editing || member.hasNote) && ( + + + { + member.note = v; + updatedMember(); + }} + size={ServerApi.Config.constraints.member_note} + /> + + + )} {/* Spouse */} diff --git a/geneit_app/src/widgets/forms/PropEdit.tsx b/geneit_app/src/widgets/forms/PropEdit.tsx index e55efb6..217d359 100644 --- a/geneit_app/src/widgets/forms/PropEdit.tsx +++ b/geneit_app/src/widgets/forms/PropEdit.tsx @@ -11,6 +11,9 @@ export function PropEdit(p: { onValueChange?: (newVal: string | undefined) => void; size?: LenConstraint; checkValue?: (s: string) => boolean; + multiline?: boolean; + minRows?: number; + maxRows?: number; }): React.ReactElement { if (((!p.editable && p.value) ?? "") === "") return <>; @@ -31,6 +34,9 @@ export function PropEdit(p: { }} variant={p.editable ? "filled" : "standard"} style={{ width: "100%", marginBottom: "15px" }} + multiline={p.multiline} + minRows={p.minRows} + maxRows={p.maxRows} error={ (p.checkValue && p.value &&