MailglassAdmin.Preview.Sidebar (MailglassAdmin v1.9.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

Absolute /<mount>/<Mailable>/<scenario> path (no query string).

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.
  • device_width (:integer) - Defaults to 768.
  • dark_chrome (:boolean) - Defaults to false.
  • admin_chrome_theme (:atom) - Defaults to nil.
  • mount_path (:string) - Defaults to nil.

scenario_base_path(mount_path, mod, scenario)

@spec scenario_base_path(String.t() | nil, module(), atom() | String.t()) ::
  String.t()

Absolute /<mount>/<Mailable>/<scenario> path (no query string).

Shared by the sidebar links and PreviewLive's start-page deep link so both build identical, mount-aware URLs. mount_path is the absolute base the admin surface is mounted at (/dev/mail, /admin/preview, …) as recovered by MailglassAdmin.MountPath.base/1.

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.
  • device_width (:integer) - Defaults to 768.
  • dark_chrome (:boolean) - Defaults to false.
  • admin_chrome_theme (:atom) - Defaults to nil.
  • mount_path (:string) - Defaults to nil.