defmodule PhoenixKitWeb.Components.InvitationBanner do @moduledoc """ Stacked alert banners for pending organization invitations. Rendered by LayoutWrapper when `pk_pending_invitations` is assigned via `PhoenixKitWeb.Hooks.InvitationHook`. Events are forwarded to the parent LiveView which must have the InvitationHook attached to handle `accept_invitation` / `decline_invitation`. """ use Phoenix.Component use Gettext, backend: PhoenixKitWeb.Gettext @doc """ Renders a stacked list of invitation banners, one per pending invitation. ## Attributes - `invitations` — list of `OrganizationInvitation` structs with `:organization` preloaded """ attr :invitations, :list, default: [] def invitation_banners(assigns) do ~H""" <%= for invitation <- @invitations do %> <.invitation_banner invitation={invitation} /> <% end %> """ end attr :invitation, :any, required: true defp invitation_banner(assigns) do ~H"""