PhoenixKitWeb.Components.ProfileSettingsTabs (phoenix_kit v2.45.0)

Copy Markdown View Source

The tabs of the signed-in user's own settings, /profile/settings/<tab>.

One URL per tab, and a tab is offered only when it has something to show for this user:

  • account — who you are: avatar and name, custom fields, email, the start page, and the annotation-tools reset
  • security — password and connected sign-in accounts
  • sessions — signed-in devices and recent sign-in attempts
  • notifications — which notifications you get (when any types exist)
  • integrations — your own service connections, for holders of the opt-in integrations permission. Its own LiveView at /profile/settings/integrations.
  • media — your storage libraries and their members (PhoenixKitWeb.Live.Components.LibrarySettings), while user libraries are on and you hold the "storage" permission. The end-user surface for them is phoenix_kit_photos; this tab is where they are set up.

/profile/settings opens the first tab. Every section of PhoenixKitWeb.Live.Components.UserSettings.default_sections/0 is on exactly one tab (a section on none would be one nobody can reach).

Hiding sections

An admin can hide sections a site does not use (Settings → Users → Profile page). What is stored is the list of HIDDEN sections, in the user_settings_hidden_sections setting — so a section added in a later release shows up on existing sites instead of staying invisible. A tab whose sections are all hidden is not offered. :identity (name and avatar) cannot be hidden. :google_email is the Google address field inside the identity form, hideable on its own.

Summary

Functions

Every section some tab shows.

The tab /profile/settings opens on.

Whether the Google address field shows in the identity form.

The sections an admin has hidden. Unknown names are ignored.

The sections (and the :google_email field) an admin may hide.

The path of a tab.

The tab strip. active is the tab being shown; scope decides which tabs are offered. Tabs rendered by the same LiveView patch; the integrations tab, a LiveView of its own, navigates.

Whether ProfileSettings renders the tab itself (every tab but integrations).

The UserSettings sections a tab rendered by ProfileSettings shows, or nil for a tab that is not one of them (integrations has a page of its own).

Hides or shows section for every user. section must be hideable. opts reach the setting write (actor_uuid:, source:), so the change is attributed like any other settings save.

The ids of the tabs scope is offered, in order.

Functions

all_sections()

@spec all_sections() :: [atom()]

Every section some tab shows.

default_tab()

@spec default_tab() :: String.t()

The tab /profile/settings opens on.

google_email_shown?()

@spec google_email_shown?() :: boolean()

Whether the Google address field shows in the identity form.

hidden_sections()

@spec hidden_sections() :: [atom()]

The sections an admin has hidden. Unknown names are ignored.

hideable_sections()

@spec hideable_sections() :: [atom()]

The sections (and the :google_email field) an admin may hide.

path(tab)

@spec path(String.t()) :: String.t()

The path of a tab.

profile_tabs(assigns)

The tab strip. active is the tab being shown; scope decides which tabs are offered. Tabs rendered by the same LiveView patch; the integrations tab, a LiveView of its own, navigates.

Attributes

  • active (:string) (required)
  • scope (:any) (required)

rendered_here?(tab)

@spec rendered_here?(String.t()) :: boolean()

Whether ProfileSettings renders the tab itself (every tab but integrations).

sections(tab)

@spec sections(String.t()) :: [atom()] | nil

The UserSettings sections a tab rendered by ProfileSettings shows, or nil for a tab that is not one of them (integrations has a page of its own).

set_section_hidden(section, hidden?, opts \\ [])

@spec set_section_hidden(atom(), boolean(), keyword()) :: :ok | {:error, term()}

Hides or shows section for every user. section must be hideable. opts reach the setting write (actor_uuid:, source:), so the change is attributed like any other settings save.

tab_ids(scope)

@spec tab_ids(PhoenixKit.Users.Auth.Scope.t() | nil) :: [String.t()]

The ids of the tabs scope is offered, in order.