From b89366de2aca1c92182057d33045142534793112 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Fri, 23 Dec 2022 19:55:41 -0600 Subject: [PATCH] Made sections support computable titles and subtitles --- src/data/common.tsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/data/common.tsx b/src/data/common.tsx index bd0a296..3b420e6 100644 --- a/src/data/common.tsx +++ b/src/data/common.tsx @@ -237,9 +237,9 @@ export function createLayerTreeNode( /** An option object for a modifier display as a single section. **/ export interface Section { /** The header for this modifier. **/ - title: string; + title: Computable; /** A subtitle for this modifier, e.g. to explain the context for the modifier. **/ - subtitle?: string; + subtitle?: Computable; /** The modifier to be displaying in this section. **/ modifier: WithRequired; /** The base value being modified. **/ @@ -266,6 +266,8 @@ export function createCollapsibleModifierSections( base: ProcessedComputable[]; baseText: ProcessedComputable[]; visible: ProcessedComputable[]; + title: ProcessedComputable[]; + subtitle: ProcessedComputable[]; } | Record = {}; let calculated = false; @@ -275,6 +277,8 @@ export function createCollapsibleModifierSections( processed.base = sections.map(s => convertComputable(s.base)); processed.baseText = sections.map(s => convertComputable(s.baseText)); processed.visible = sections.map(s => convertComputable(s.visible)); + processed.title = sections.map(s => convertComputable(s.title)); + processed.subtitle = sections.map(s => convertComputable(s.subtitle)); calculated = true; } return sections; @@ -297,8 +301,10 @@ export function createCollapsibleModifierSections( > ▼ - {s.title} - {s.subtitle != null ? ({s.subtitle}) : null} + {unref(processed.title)} + {unref(processed.subtitle) != null ? ( + ({unref(processed.subtitle)}) + ) : null} );