From ce99b86b5567743a767dd749e8ae906be57e16a2 Mon Sep 17 00:00:00 2001 From: Eugene Shishkin Date: Thu, 30 Oct 2025 02:21:21 +0400 Subject: [PATCH] Display types for attributes/facts in the sidebar (#221) * feat: Show attribute names in sidebar * feat: Take into account case when no TYPE tag for FACT is found --- src/sidepanel/details/details.tsx | 44 +++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/src/sidepanel/details/details.tsx b/src/sidepanel/details/details.tsx index 1661842..6984fd8 100644 --- a/src/sidepanel/details/details.tsx +++ b/src/sidepanel/details/details.tsx @@ -26,6 +26,7 @@ const EXCLUDED_TAGS = [ 'FAMS', 'NOTE', 'SOUR', + 'FACT', ]; function dataDetails(entry: GedcomEntry) { @@ -53,6 +54,43 @@ function dataDetails(entry: GedcomEntry) { ); } +function attributeDetails(entry: GedcomEntry) { + if (!entry.data) { + return null; + } + + let attributeName = entry.tree + .filter((subentry) => subentry.tag === 'TYPE') + .flatMap((type) => getData(type)) + .join() + .trim(); + + let attributeValue = getData(entry).join(' ').trim(); + if(attributeName) { + return ( + <> +
+ +
+
+ {attributeName}: {attributeValue} +
+ + ); + } else { + return ( + <> +
+ +
+
+ {attributeValue} +
+ + ); + } +} + function imageDetails(objectEntryReference: GedcomEntry, gedcom: GedcomData) { const imageEntry = dereference( objectEntryReference, @@ -289,6 +327,12 @@ export function Details(props: Props) { imageDetails, )} + {getSectionForEachMatchingEntry( + entries, + props.gedcom, + ['FACT'], + attributeDetails, + )} {getOtherSections(entries, props.gedcom)} {getSectionForEachMatchingEntry( entries,