feat(docs): render configured facts on every topic
This commit is contained in:
@@ -360,10 +360,26 @@ function DocumentationTopicList({ topics, emptyText, showTechnical = false, docu
|
||||
}
|
||||
|
||||
function TopicMetadata({ topic, showTechnical, documentationType, topicById }: { topic: DocsDocumentationTopic; showTechnical: boolean; documentationType: DocumentationType; topicById: Map<string, DocsDocumentationTopic> }) {
|
||||
if (topic.kind === "workflow") return <WorkflowDetails topic={topic} documentationType={documentationType} topicById={topicById} />;
|
||||
if (topic.kind === "reference") return <ReferenceDetails topic={topic} showTechnical={showTechnical} documentationType={documentationType} topicById={topicById} />;
|
||||
if (topic.kind === "pattern") return <PatternDetails topic={topic} showTechnical={showTechnical} documentationType={documentationType} topicById={topicById} />;
|
||||
return <RelatedTopics topic={topic} documentationType={documentationType} topicById={topicById} />;
|
||||
const configuredDetails = <ConfiguredDetails topic={topic} />;
|
||||
if (topic.kind === "workflow") return <>{configuredDetails}<WorkflowDetails topic={topic} documentationType={documentationType} topicById={topicById} /></>;
|
||||
if (topic.kind === "reference") return <>{configuredDetails}<ReferenceDetails topic={topic} showTechnical={showTechnical} documentationType={documentationType} topicById={topicById} /></>;
|
||||
if (topic.kind === "pattern") return <>{configuredDetails}<PatternDetails topic={topic} showTechnical={showTechnical} documentationType={documentationType} topicById={topicById} /></>;
|
||||
return <>{configuredDetails}<RelatedTopics topic={topic} documentationType={documentationType} topicById={topicById} /></>;
|
||||
}
|
||||
|
||||
function ConfiguredDetails({ topic }: { topic: DocsDocumentationTopic }) {
|
||||
const currentConfiguration = metadataList(topic.metadata, "current_configuration");
|
||||
const limitations = metadataList(topic.metadata, "limitations");
|
||||
const constraints = metadataRecords(topic.metadata, "constraints");
|
||||
const prefix = topicAnchorId(topic);
|
||||
if (!currentConfiguration.length && !limitations.length && !constraints.length) return null;
|
||||
return (
|
||||
<div className="docs-topic-details">
|
||||
{!!currentConfiguration.length && <DetailList id={`${prefix}-current-configuration`} title="i18n:govoplan-docs.this_system.b13a51ad" items={currentConfiguration} />}
|
||||
{!!constraints.length && <ConstraintDetails id={`${prefix}-constraints`} constraints={constraints} />}
|
||||
{!!limitations.length && <DetailList id={`${prefix}-limitations`} title="i18n:govoplan-docs.details.a6b3c45f" items={limitations} />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function WorkflowDetails({ topic, documentationType, topicById }: { topic: DocsDocumentationTopic; documentationType: DocumentationType; topicById: Map<string, DocsDocumentationTopic> }) {
|
||||
@@ -372,16 +388,10 @@ function WorkflowDetails({ topic, documentationType, topicById }: { topic: DocsD
|
||||
const outcome = metadataString(topic.metadata, "outcome");
|
||||
const result = metadataString(topic.metadata, "result");
|
||||
const verification = metadataString(topic.metadata, "verification");
|
||||
const currentConfiguration = metadataList(topic.metadata, "current_configuration");
|
||||
const limitations = metadataList(topic.metadata, "limitations");
|
||||
const constraints = metadataRecords(topic.metadata, "constraints");
|
||||
const prefix = topicAnchorId(topic);
|
||||
return (
|
||||
<div className="docs-topic-details">
|
||||
{outcome && <DetailBlock id={`${prefix}-outcome`} title="i18n:govoplan-docs.outcome.10172bd3" value={outcome} />}
|
||||
{!!currentConfiguration.length && <DetailList id={`${prefix}-current-configuration`} title="i18n:govoplan-docs.this_system.b13a51ad" items={currentConfiguration} />}
|
||||
{!!constraints.length && <ConstraintDetails id={`${prefix}-constraints`} constraints={constraints} />}
|
||||
{!!limitations.length && <DetailList id={`${prefix}-limitations`} title="i18n:govoplan-docs.details.a6b3c45f" items={limitations} />}
|
||||
{!!prerequisites.length && <DetailList id={`${prefix}-prerequisites`} title="i18n:govoplan-docs.prerequisites.fdf2407f" items={prerequisites} />}
|
||||
{!!steps.length &&
|
||||
<div className="docs-detail-block" id={`${prefix}-steps`}>
|
||||
@@ -835,11 +845,11 @@ function outlineForPage(page: DocsPageNode | null, showTechnical: boolean): Outl
|
||||
const prefix = topicAnchorId(topic);
|
||||
const items: OutlineItem[] = [{ id: prefix, label: topic.title }];
|
||||
if (topic.summary) items.push({ id: `${prefix}-summary`, label: "i18n:govoplan-docs.summary.d6b9936d" });
|
||||
if (metadataList(topic.metadata, "current_configuration").length) items.push({ id: `${prefix}-current-configuration`, label: "i18n:govoplan-docs.this_system.b13a51ad" });
|
||||
if (metadataRecords(topic.metadata, "constraints").length) items.push({ id: `${prefix}-constraints`, label: "i18n:govoplan-docs.requirements.09a428f9" });
|
||||
if (metadataList(topic.metadata, "limitations").length) items.push({ id: `${prefix}-limitations`, label: "i18n:govoplan-docs.details.a6b3c45f" });
|
||||
if (topic.kind === "workflow") {
|
||||
if (metadataString(topic.metadata, "outcome")) items.push({ id: `${prefix}-outcome`, label: "i18n:govoplan-docs.outcome.10172bd3" });
|
||||
if (metadataList(topic.metadata, "current_configuration").length) items.push({ id: `${prefix}-current-configuration`, label: "i18n:govoplan-docs.this_system.b13a51ad" });
|
||||
if (metadataRecords(topic.metadata, "constraints").length) items.push({ id: `${prefix}-constraints`, label: "i18n:govoplan-docs.requirements.09a428f9" });
|
||||
if (metadataList(topic.metadata, "limitations").length) items.push({ id: `${prefix}-limitations`, label: "i18n:govoplan-docs.details.a6b3c45f" });
|
||||
if (metadataList(topic.metadata, "prerequisites").length) items.push({ id: `${prefix}-prerequisites`, label: "i18n:govoplan-docs.prerequisites.fdf2407f" });
|
||||
if (metadataList(topic.metadata, "steps").length) items.push({ id: `${prefix}-steps`, label: "i18n:govoplan-docs.steps.6041435e" });
|
||||
if (metadataString(topic.metadata, "result")) items.push({ id: `${prefix}-result`, label: "i18n:govoplan-docs.result.1f4fbf43" });
|
||||
|
||||
Reference in New Issue
Block a user