import type { CommunityRuleSection } from "../../app/components/type/CommunityRule/CommunityRule.types"; import sharedTerms from "../../messages/en/create/sharedTerms.json"; /** Fixed at launch. Cards that omit a consensus level read this share. */ export const LAUNCH_SUPERMAJORITY_SHARE = 75; type SharedTerm = { term: string; meaning: string }; /** * Every shared term, definitions only. Fallbacks for a skipped topic do not print. * Use-case example Rules do not call this. */ export function sharedTermsSection(): CommunityRuleSection { const terms = (sharedTerms as { terms: SharedTerm[] }).terms; return { categoryName: sharedTerms.sectionTitle, entries: terms.map((term) => ({ title: term.term, body: term.meaning, })), }; } export function withSharedTerms( sections: CommunityRuleSection[], ): CommunityRuleSection[] { if (sections.some((section) => section.categoryName === sharedTerms.sectionTitle)) { return sections; } return [...sections, sharedTermsSection()]; }