{# Inbox-specific macros. Kept separate from ``_macros.html`` (which holds the shared hand-drawn primitives) so the inbox can evolve without touching that file. Each macro here renders semantic HTML with the class names listed in the inbox contract — CSS styling lives in ``static/inbox.css``. #} {% from "_macros.html" import brush_mark %} {# Status dot — 8px circle whose background + ring are picked by CSS based on the modifier class. Four states mirror the schema's lifecycle timestamps: unread (peach + ring), read (transparent), pinned (indigo), archived (inkFaint). #} {% macro status_dot(state) -%} {%- endmacro %} {# Priority badge — inline mono label. Only renders visible text for urgent/high; ``normal`` and ``low`` collapse to empty so the separator stack in the DropCard meta row doesn't need per-priority branching. ``urgent``/``high`` include a BrushMark before the label per the handoff's ``PriorityBadge`` component. #} {% macro priority_badge(priority) -%} {%- if priority == "urgent" -%} {{ brush_mark(variant="urgent") }} urgent {%- elif priority == "high" -%} {{ brush_mark(variant="high", color="var(--color-peach)") }} high {%- endif -%} {%- endmacro %} {# DropCard — the single row in the inbox list. ``drop`` is the ORM row; ``time_ago_text`` is the pre-formatted string passed in from the template (the filter is cheap, but callers already loop so we accept the string rather than invoke the filter inside the macro). #} {% macro dropcard(drop, time_ago_text) -%} {%- set state = "archived" if drop.archived_at else "pinned" if drop.pinned_at else "read" if drop.read_at else "unread" -%} {%- set is_unread = (state == "unread") -%}
{{ status_dot(state) }} {% if drop.source %} {{ drop.source }} {% endif %} {{ time_ago_text }} {% if state == "pinned" %} pinned {% endif %} {% if drop.priority in ("urgent", "high") %} {{ priority_badge(drop.priority) }} {% endif %}
{{ drop.title }}
{% if drop.body %}
{{ drop.body }}
{% endif %}
{%- endmacro %}