defmodule PlausibleWeb.Team.Notice do @moduledoc """ Components with teams related notices. """ use PlausibleWeb, :component import PlausibleWeb.Components.Icons alias Plausible.Teams alias PlausibleWeb.Components.PrimaDropdown def owner_cta_banner(assigns) do ~H""" """ end def guest_cta_banner(assigns) do ~H""" """ end def team_members_notice(assigns) do ~H""" """ end def team_invitations(assigns) do ~H""" """ end def site_ownership_invitations(assigns) do ~H""" """ end defp site_ownership_invitation(assigns) do {can_accept?, can_accept_without_members?, exceeded_limits} = case assigns.invitation.ownership_check do :ok -> {true, false, nil} {:error, {:over_plan_limits, limits}} -> {false, limits == [:team_member_limit], PlausibleWeb.TextHelpers.pretty_list(limits)} _ -> {false, false, nil} end assigns = assign(assigns, can_accept?: can_accept?, can_accept_without_members?: can_accept_without_members?, exceeded_limits: exceeded_limits ) ~H""" <.notice id={"site-ownership-invitation-#{@invitation.transfer_id}"} title={"#{@invitation.initiator.name} has invited you to own #{@invitation.site.domain}"} theme={:white} icon_class="hidden md:block" > <:icon>
<.envelope_icon class="size-4 text-green-600 dark:text-green-400" />

On acceptance, you'll be responsible for billing and this site will join "{Teams.name( @current_team )}"

You don't have an active subscription. Upgrade to accept ownership and take over billing.

This exceeds your current {@exceeded_limits} limits. Upgrade to accept ownership.

<:actions> <.button_link method="post" href={ Routes.invitation_path( PlausibleWeb.Endpoint, :reject_invitation, @invitation.transfer_id ) } theme="ghost" size="sm" class="order-3 md:order-1" mt?={false} > Reject <.button_link :if={@can_accept?} method="post" href={ Routes.invitation_path( PlausibleWeb.Endpoint, :accept_invitation, @invitation.transfer_id ) } theme="secondary" size="sm" class="order-1 md:order-2" mt?={false} > Accept Accept Upgrade to accept link(Map.put(a, :method, "post")) end} id={"ownership-accept-item-members-#{@invitation.transfer_id}"} href={ Routes.invitation_path( PlausibleWeb.Endpoint, :accept_invitation, @invitation.transfer_id, skip_site_members_transfer: "true" ) } > Accept without members <.button_link :if={not @can_accept? and not @can_accept_without_members?} href={Routes.billing_path(PlausibleWeb.Endpoint, :choose_plan)} theme="secondary" size="sm" class="order-1 md:order-3" mt?={false} > Upgrade to accept """ end def site_invitations(assigns) do ~H""" """ end end