defmodule PhoenixKitWeb.Components.Core.MaintenancePage do
@moduledoc """
Maintenance page card component.
Renders the maintenance mode card with header, subtext, and optional countdown.
Used by the `/maintenance` LiveView. Can also be embedded in other views.
## Examples
"""
use Phoenix.Component
alias PhoenixKit.Modules.Maintenance
@doc """
Renders the maintenance card (header + subtext + emoji).
## Attributes
- `header` - Main heading text (default: loaded from settings)
- `subtext` - Descriptive text (default: loaded from settings)
"""
attr :header, :string, default: nil
attr :subtext, :string, default: nil
def maintenance_card(assigns) do
assigns =
assigns
|> assign_new(:header, fn -> Maintenance.get_header() end)
|> assign_new(:subtext, fn -> Maintenance.get_subtext() end)
~H"""
🚧
{@header}
{@subtext}
"""
end
# Keep the old function name as an alias for backwards compatibility
@doc false
def maintenance_page(assigns), do: maintenance_card(assigns)
end