MailglassAdmin.Operator.Shell (MailglassAdmin v1.4.4)

Copy Markdown View Source

Shared application shell for the operator surface — the chrome wrapping both MailglassAdmin.OperatorLive (deliveries) and MailglassAdmin.InboundLive (inbound records). The two screens mount in the SAME operator live_session (one Operator.Mount + Auth gate), so a shared shell is a within-surface concern, not a cross-mount one — it never reaches the dev-preview surface.

Provides:

  • a persistent left sidebar that navigates BETWEEN surfaces (Deliveries / Inbound) — navigation, not filtering. The Inbound item is conditionally omitted via inbound_available? (the same OptionalDeps.MailglassInbound gate the router uses to decide whether to emit the /inbound route), so an operator without the inbound package never sees a dead link.
  • a read-only tenant-context chip (forensic trust: always show whose data is on screen).
  • a shell-owned theme toggle (the dark theme is fully built but was previously unreachable from the operator UI). Theme is carried in the URL ?theme= param so it survives both Deliveries↔Inbound navigation and refresh — mirroring the preview surface's pattern.

Nav links reset to each surface's base path (no delivery_id/inbound_id, no stale filters): switching surfaces is a fresh question, and inheriting a selected id across surfaces is the classic sidebar-nav footgun.

This is internal UI — not part of the stable router/auth contract.

Summary

Functions

True when the request carries an explicit dark-theme selection.

Whether the inbound surface is present — the SAME gate the router uses to decide whether to emit the /inbound route. Centralized here so the nav and the route never disagree.

Renders the operator shell around a surface's body (passed as the inner block).

Derives the {deliveries, inbound} nav paths from a screen's base_path, carrying the ?theme= param so the active theme survives navigation. active tells us which surface we're on so we can recover the operator root (the inbound screen's base_path has a trailing /inbound to strip).

Builds the push_patch target for the theme toggle: flips the theme param on the CURRENT url, preserving every other filter/selection param.

Functions

dark_chrome?(params)

True when the request carries an explicit dark-theme selection.

inbound_available?()

Whether the inbound surface is present — the SAME gate the router uses to decide whether to emit the /inbound route. Centralized here so the nav and the route never disagree.

shell(assigns)

Renders the operator shell around a surface's body (passed as the inner block).

Attributes

  • active (:atom) (required) - Must be one of :deliveries, or :inbound.
  • deliveries_path (:string) (required)
  • inbound_path (:string) (required)
  • inbound_available? (:boolean) - Defaults to false.
  • dark_chrome (:boolean) - Defaults to false.
  • tenant (:string) - Defaults to nil.
  • title (:string) (required)
  • subtitle (:string) - Defaults to nil.
  • flash (:map) - Defaults to %{}.

Slots

  • inner_block (required)

surface_paths(base_path, active, dark_chrome)

Derives the {deliveries, inbound} nav paths from a screen's base_path, carrying the ?theme= param so the active theme survives navigation. active tells us which surface we're on so we can recover the operator root (the inbound screen's base_path has a trailing /inbound to strip).

toggle_theme_path(uri, currently_dark?)

Builds the push_patch target for the theme toggle: flips the theme param on the CURRENT url, preserving every other filter/selection param.