PhoenixKitCRM.Web.Components.MirrorPanel (PhoenixKitCRM v0.7.1)

Copy Markdown View Source

The "mirror account" status + actions block, shared by the Company and Contact forms (Tasks G/H) — the CRM-record side of the CRM ↔ system-user mirror (PhoenixKitCRM.Mirror, Companies/Contacts "connect" contexts).

Pure presentation function component. The consumer LiveView owns all state (:linked_user, :can_link) and implements the events this panel fires:

mirror_unlink         linked state, "Unlink" clicked
mirror_create         unlinked state, "Create mirror user" clicked
mirror_open_picker    unlinked state, "Link existing…" clicked

Usage

<.mirror_panel
  kind={:company}
  linked_user={@linked_user}
  can_link={@org_accounts_enabled?}
  account_path={@linked_user && Paths.user_view(@linked_user.uuid)}
/>

Summary

Functions

Same precedence Andi.CRMBridge.user_display_name/1 uses for the reverse (user -> contact) direction: organization name when set, else the trimmed first+last name, else the email. Public — reused by CompanyShowLive's read-only mirror status row (Task J) so both surfaces render the same name for the same user.

Functions

display_name(user)

@spec display_name(PhoenixKit.Users.Auth.User.t()) :: String.t()

Same precedence Andi.CRMBridge.user_display_name/1 uses for the reverse (user -> contact) direction: organization name when set, else the trimmed first+last name, else the email. Public — reused by CompanyShowLive's read-only mirror status row (Task J) so both surfaces render the same name for the same user.

mirror_panel(assigns)

Attributes

  • kind (:atom) (required) - Must be one of :company, or :contact.
  • linked_user (:any) - Defaults to nil.
  • can_link (:boolean) - Defaults to true.
  • account_path (:string) - Defaults to nil.