mirror of
https://github.com/fly-apps/live_beats.git
synced 2024-11-25 09:20:59 +00:00
21 lines
522 B
Elixir
21 lines
522 B
Elixir
defmodule LiveBeatsWeb.Nav do
|
|
import Phoenix.LiveView
|
|
|
|
alias LiveBeats.MediaLibrary
|
|
alias LiveBeatsWeb.{ProfileLive, SettingsLive}
|
|
|
|
def on_mount(:default, _params, _session, socket) do
|
|
active_tab =
|
|
case {socket.view, socket.assigns.live_action} do
|
|
{ProfileLive, _} -> :profile
|
|
{SettingsLive, _} -> :settings
|
|
{_, _} -> nil
|
|
end
|
|
|
|
{:cont,
|
|
assign(socket,
|
|
active_users: MediaLibrary.list_active_profiles(limit: 20),
|
|
active_tab: active_tab
|
|
)}
|
|
end
|
|
end
|