defmodule AlgoraWeb.Layouts do
use AlgoraWeb, :html
embed_templates "layouts/*"
attr :id, :string
attr :users, :list
def sidebar_active_users(assigns) do
~H"""
<.link
navigate="/"
class={
"text-gray-200 hover:text-gray-50 group flex items-center px-2 py-2 text-sm font-medium rounded-md #{if @active_tab == :home, do: "bg-gray-800", else: "hover:bg-gray-900"}"
}
aria-current={if @active_tab == :home, do: "true", else: "false"}
>
Home
<.link
navigate={channel_path(@current_user)}
class={
"text-gray-200 hover:text-gray-50 group flex items-center px-2 py-2 text-sm font-medium rounded-md #{if @active_tab == :channel, do: "bg-gray-800", else: "hover:bg-gray-900"}"
}
aria-current={if @active_tab == :channel, do: "true", else: "false"}
>
Channel
<.link
navigate="/channel/studio"
class={
"text-gray-200 hover:text-gray-50 group flex items-center px-2 py-2 text-sm font-medium rounded-md #{if @active_tab == :studio, do: "bg-gray-800", else: "hover:bg-gray-900"}"
}
aria-current={if @active_tab == :studio, do: "true", else: "false"}
>
Studio
<.link
navigate="/subscriptions"
class={
"text-gray-200 hover:text-gray-50 group flex items-center px-2 py-2 text-sm font-medium rounded-md #{if @active_tab == :studio, do: "bg-gray-800", else: "hover:bg-gray-900"}"
}
aria-current={if @active_tab == :studio, do: "true", else: "false"}
>
Subscriptions
<.link
navigate={~p"/channel/settings"}
class={
"text-gray-200 hover:text-gray-50 group flex items-center px-2 py-2 text-sm font-medium rounded-md #{if @active_tab == :settings, do: "bg-gray-800", else: "hover:bg-gray-900"}"
}
aria-current={if @active_tab == :settings, do: "true", else: "false"}
>
Settings
"""
end
attr :id, :string
attr :current_user, :any
def sidebar_account_dropdown(assigns) do
~H"""
<.dropdown id={@id}>
<:img src={@current_user.avatar_url} alt={@current_user.handle} />
<:title><%= @current_user.name %>
<:subtitle>@<%= @current_user.handle %>
<:link navigate={channel_path(@current_user)}>Channel
<:link navigate={~p"/channel/studio"}>Studio
<:link navigate={~p"/subscriptions"}>Subscriptions
<:link navigate={~p"/channel/settings"}>Settings
<:link href={~p"/auth/logout"} method={:delete}>Sign out
"""
end
end