Keep every picked card on the finished Rule, and wait for its words before Continue.
This commit is contained in:
1 parent
a846169960
commit
a2815ae05f
16 files changed
+417
-114
No files matched your search
@@ -4,13 +4,6 @@ import type { PublishedMethodSelections } from "./buildPublishPayload";
|
||||
import { parseDocumentSectionsForDisplay } from "./buildPublishPayload";
|
||||
import { resolveMethodPresetIdFromLabel } from "./buildFinalReviewCategories";
|
||||
import { resolveCoreValueChipIdFromLabel } from "./finalReviewChipPresets";
|
||||
import {
|
||||
communicationPresetFor,
|
||||
conflictManagementPresetFor,
|
||||
decisionApproachPresetFor,
|
||||
membershipPresetFor,
|
||||
mergeCoreValueDetailWithPresets,
|
||||
} from "./finalReviewChipPresets";
|
||||
import { templateCategoryToGroupKey } from "./templateReviewMapping";
|
||||
import type { TemplateFacetGroupKey } from "./templateReviewMapping";
|
||||
import { RULE_SECTION_CATEGORY } from "./ruleSectionsFromMethodSelections";
|
||||
@@ -110,26 +103,9 @@ function sectionsRecordFromBlocks(
|
||||
return out;
|
||||
}
|
||||
|
||||
function presetForMethod(
|
||||
groupKey: Exclude<TemplateFacetGroupKey, "coreValues">,
|
||||
id: string,
|
||||
): Record<string, unknown> {
|
||||
switch (groupKey) {
|
||||
case "communication":
|
||||
return { ...communicationPresetFor(id) } as Record<string, unknown>;
|
||||
case "membership":
|
||||
return { ...membershipPresetFor(id) } as Record<string, unknown>;
|
||||
case "decisionApproaches":
|
||||
return { ...decisionApproachPresetFor(id) } as Record<string, unknown>;
|
||||
case "conflictManagement":
|
||||
return { ...conflictManagementPresetFor(id) } as Record<string, unknown>;
|
||||
}
|
||||
}
|
||||
|
||||
function sectionsRecordFromEntry(
|
||||
entry: CommunityRuleSection["entries"][number],
|
||||
groupKey: Exclude<TemplateFacetGroupKey, "coreValues">,
|
||||
presetId: string,
|
||||
): Record<string, unknown> {
|
||||
const labelByKey = LABELS_BY_GROUP[groupKey];
|
||||
const consensusKey =
|
||||
@@ -140,16 +116,16 @@ function sectionsRecordFromEntry(
|
||||
consensusLevelKey: consensusKey,
|
||||
});
|
||||
if (Object.keys(fromBlocks).length > 0) {
|
||||
return { ...presetForMethod(groupKey, presetId), ...fromBlocks };
|
||||
return fromBlocks;
|
||||
}
|
||||
}
|
||||
|
||||
const body = (entry.body ?? "").trim();
|
||||
if (body.length === 0) {
|
||||
return presetForMethod(groupKey, presetId);
|
||||
return {};
|
||||
}
|
||||
|
||||
return { ...presetForMethod(groupKey, presetId), corePrinciple: body };
|
||||
return { corePrinciple: body };
|
||||
}
|
||||
|
||||
function coreValuesFromValuesSection(
|
||||
@@ -169,18 +145,14 @@ function coreValuesFromValuesSection(
|
||||
const parts = body.length > 0 ? body.split(/\n\n+/) : [];
|
||||
const meaning = (parts[0] ?? "").trim();
|
||||
const signals = parts.slice(1).join("\n\n").trim();
|
||||
const merged = mergeCoreValueDetailWithPresets("", label, {
|
||||
meaning,
|
||||
signals,
|
||||
});
|
||||
const chipId =
|
||||
resolveCoreValueChipIdFromLabel(label) ??
|
||||
`hydrated-${label.toLowerCase()}`;
|
||||
out.push({
|
||||
chipId,
|
||||
label,
|
||||
meaning: merged.meaning,
|
||||
signals: merged.signals,
|
||||
meaning,
|
||||
signals,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -213,7 +185,7 @@ function methodSelectionsFromDisplaySections(
|
||||
rows.push({
|
||||
id,
|
||||
label,
|
||||
sections: sectionsRecordFromEntry(entry, groupKey, id),
|
||||
sections: sectionsRecordFromEntry(entry, groupKey),
|
||||
});
|
||||
}
|
||||
if (rows.length > 0) {
|
||||
|
||||
Reference in new issue
Block a user