All files / src/aggregator/reader-guide icons.ts

100% Statements 2/2
100% Branches 2/2
100% Functions 1/1
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51                        17x                                                                       1074x    
// SPDX-FileCopyrightText: 2024-2026 Hack23 AB
// SPDX-License-Identifier: Apache-2.0
 
/**
 * @module Aggregator/ReaderGuide/Icons
 * @description Visual icons for each reader-guide section, keyed by
 * section anchor id. Used by both the Reader Intelligence Guide rows
 * and the article-level Table of Contents so the two surfaces share a
 * single visual vocabulary.
 */
 
/** Visual icons for each reader guide section to improve scannability. */
const SECTION_ICONS: Readonly<Record<string, string>> = {
  'section-executive-brief': '📋',
  'section-synthesis': '🔗',
  'section-significance': '⚖️',
  'section-actors-forces': '🎭',
  'section-coalitions-voting': '🤝',
  'section-stakeholder-map': '👥',
  'section-economic-context': '💶',
  'section-risk': '⚠️',
  'section-threat': '🛡️',
  'section-scenarios': '🔮',
  'section-forward-projection': '🔭',
  'section-electoral-arc': '🗳️',
  'section-pestle-context': '🌍',
  'section-continuity': '🔁',
  'section-deep-analysis': '🔬',
  'section-documents': '📄',
  'section-extended-intel': '🧠',
  'section-mcp-reliability': '📡',
  'section-quality-reflection': '🪞',
  'section-supplementary-intelligence': '📎',
};
 
/**
 * Look up the visual icon for a known article section.
 *
 * Exposed so the article-level Table-of-Contents (`buildArticleToc`)
 * can render the same emoji that the Reader Intelligence Guide uses
 * for each section, keeping the two navigation surfaces visually
 * consistent. Unknown section IDs (e.g. ad-hoc `supplementary-…` or
 * appendix anchors) fall back to a generic 📎 paperclip.
 *
 * @param sectionId - Anchor id of the section (e.g. `section-risk`)
 * @returns Single emoji glyph used as a `guide-icon`
 */
export function getReaderGuideSectionIcon(sectionId: string): string {
  return SECTION_ICONS[sectionId] ?? '📎';
}