MailglassAdmin.Preview.Sidebar (MailglassAdmin v1.0.0)

Copy Markdown View Source

Sidebar function component: mailable list with collapsible scenario groups + status badges.

Renders the structure documented in 05-UI-SPEC §Sidebar structure (lines 188-207 + 234-263). Branches on the second element of each {mod, reflection} tuple from MailglassAdmin.Preview.Discovery.discover/1:

  • list when is_list(list) — healthy mailable; render <details>/<summary> with scenario links. Active scenario gets a 3px Glass left border; inactive gets border-transparent + hover state.
  • :no_previews — stub mailable; shows the literal copy "No previews defined" per UI-SPEC Copywriting Contract line 457.
  • {:error, _} — preview_props/0 raised during discovery; shows a warning badge (via MailglassAdmin.Components.badge/1).

Boundary classification: submodule auto-classifies into the MailglassAdmin root boundary.

Summary

Functions

Renders the mailable sidebar.

Functions

mailable_entry(assigns)

Attributes

  • mod (:atom) (required)
  • reflection (:any) (required)
  • current_mailable (:atom) - Defaults to nil.
  • current_scenario (:atom) - Defaults to nil.

sidebar(assigns)

(since 0.1.0)

Renders the mailable sidebar.

mailables is the list of {module, reflection} tuples produced by MailglassAdmin.Preview.Discovery.discover/1. current_mailable and current_scenario drive the active-item highlight.

Attributes

  • mailables (:list) (required)
  • current_mailable (:atom) - Defaults to nil.
  • current_scenario (:atom) - Defaults to nil.