defmodule LiveBeatsWeb.LiveHelpers do import Phoenix.LiveView import Phoenix.LiveView.Helpers alias LiveBeatsWeb.Router.Helpers, as: Routes alias Phoenix.LiveView.JS alias LiveBeats.Accounts alias LiveBeats.MediaLibrary def home_path(nil = _current_user), do: "/" def home_path(%Accounts.User{} = current_user), do: profile_path(current_user) def profile_path(current_user_or_profile, action \\ :show) def profile_path(username, action) when is_binary(username) do Routes.profile_path(LiveBeatsWeb.Endpoint, action, username) end def profile_path(%Accounts.User{} = current_user, action) do profile_path(current_user.username, action) end def profile_path(%MediaLibrary.Profile{} = profile, action) do profile_path(profile.username, action) end def connection_status(assigns) do ~H"""
<%= render_slot(@inner_block) %>
<%= live_flash(@flash, @kind) %>
<%= live_flash(@flash, @kind) %>
<%= render_slot(@inner_block) %>
<%= col.label %> | <% end %>
---|
<%= render_slot(col, row) %>
|
<% end %>
<%= col.label %> | <% end %>
---|