{# Ops Console semantic chip macros (V3 #208). Canonical label-to-semantic mapping for the Ops Console chip system. Import: {% from "fragments/_chips.html" import chip %} Usage: {{ chip("done") }} {{ chip("needs review") }} The mapping is the single source; R1-R6 consume it via the macro. Extending: add a row to CHIP_MAP below and the CSS class if needed. #} {# Map: label → (css_class, display_text). Labels are the canonical user-facing strings from the design spec (#208). "needs you" / "need you" are deprecated aliases kept for backward compat; the canonical label is "needs review" (S17 glossary). #} {% set CHIP_MAP = { "verified": ("chip-ok", "✓ verified"), "verified by you": ("chip-ok", "✓ verified by you"), "reviewed": ("chip-ok", "✓ reviewed"), "all reviewed": ("chip-ok", "✓ all reviewed"), "done": ("chip-ok", "done"), "transcribing": ("chip-info", none), "needs review": ("chip-warn", "needs review"), "needs you": ("chip-warn", "needs review"), "need you": ("chip-warn", "needs review"), "failed": ("chip-danger", "failed"), "active": ("chip-ok", "active"), "watched": ("chip-accent", "watched"), "learned": ("chip-info", none), "unknown": ("chip-neutral", "unknown"), } %} {# Count-inflected "needs review" chip. Owns BOTH the inflection and the warn class, so call sites cannot drift into subject-verb disagreement or fall through the exact-key chip() lookup to chip-neutral. #} {% macro needs_review_chip(count) -%} {{ count }} voice{{ "s" if count != 1 else "" }} need{{ "s" if count == 1 else "" }} review {%- endmacro %} {% macro chip(label, extra_class="") -%} {%- set key = label.split()[0] if label.split()[0] in ["transcribing", "learned"] else label.lower().rstrip("s") if label.lower().rstrip("s") in CHIP_MAP else label.lower() -%} {%- set entry = CHIP_MAP.get(key, ("chip-neutral", none)) -%} {{ entry[1] or label }} {%- endmacro %}