# `MailglassAdmin.PreviewLive`
[🔗](https://github.com/szTheory/mailglass/blob/v1.0.0/lib/mailglass_admin/preview_live.ex#L1)

The single dev-preview LiveView surface (PREV-03..PREV-05).

Mounted by `MailglassAdmin.Router.mailglass_admin_routes/2`. Two live
actions:

  * `:index` at `/` — no scenario selected. Renders the empty-state
    card with copy `"Select a scenario from the sidebar to preview it."`
    per 05-UI-SPEC Copywriting Contract line 465.
  * `:show` at `/:mailable/:scenario` — renders the full preview:
    sidebar, main pane header, device + dark toggles, assigns form,
    HTML/Text/Raw/Headers tab strip.

## PubSub + LiveReload

On connected-socket mount, subscribes to
`MailglassAdmin.PubSub.Topics.admin_reload/0`
(`"mailglass:admin:reload"`) iff
`MailglassAdmin.OptionalDeps.PhoenixLiveReload` is loaded. Re-discovers
mailables + re-renders the current scenario on each broadcast and
surfaces a flash `"Reloaded: {basename}"`.

## Error handling

Errors match by STRUCT per CLAUDE.md pitfall #7 — never by message
string. `%Mailglass.TemplateError{}` surfaces as an in-pane error
card; the dashboard stays live. Discovery's `{:error, stacktrace}`
return (Plan 04) flows through `handle_params/3` into the same error
card.

## No PII in telemetry

v0.1 emits NO telemetry. The cost of shipping the wrong whitelist once
is permanent (PII leaks into adopter handlers). v0.5 adds a
`mailables_count` counter after whitelist review.

Preview NEVER calls `Mailglass.Outbound.deliver/2` — per CLAUDE.md
pitfall #4 the admin boundary's `exports: [Router]` already
structurally prevents it, but the principle is reinforced here.

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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
