<%= @hub.name %>
"""
end
defp sidebar_hub_link_with_tooltip(assigns) do
~H"""
<.link {hub_connection_link_opts(@hub, @to, @current)}>
<%= @hub.emoji %>
<%= @hub.name %>
"""
end
defp hub_section(assigns) do
~H"""
HUBS
<%= for hub <- @hubs do %>
<%= if Provider.connection_spec(hub.provider) do %>
<.sidebar_hub_link_with_tooltip hub={hub} to={~p"/hub/#{hub.id}"} current={@current_page} />
<% else %>
<.sidebar_hub_link hub={hub} to={~p"/hub/#{hub.id}"} current={@current_page} />
<% end %>
<% end %>
<.sidebar_link title="Add Organization" icon="add-line" to={~p"/hub"} current={@current_page} />
"""
end
defp sidebar_link_text_color(to, current) when to == current, do: "text-white"
defp sidebar_link_text_color(_to, _current), do: "text-gray-400"
defp sidebar_link_border_color(to, current) when to == current, do: "border-white"
defp sidebar_link_border_color(_to, _current), do: "border-transparent"
defp hub_connection_link_opts(hub, to, current) do
text_color = sidebar_link_text_color(to, current)
border_color = sidebar_link_border_color(to, current)
class =
"h-7 flex items-center hover:text-white #{text_color} border-l-4 #{border_color} hover:border-white"
if hub.connected? do
[id: "hub-#{hub.id}", navigate: to, class: class]
else
[
id: "hub-#{hub.id}",
navigate: to,
"data-tooltip": Provider.connection_error(hub.provider),
class: "tooltip right " <> class
]
end
end
@doc """
Renders page title.
## Examples
<.title text="Learn" />
"""
attr :text, :string, default: nil
attr :back_navigate, :string, default: nil
slot :inner_block
def title(assigns) do
if assigns.text == nil and assigns.inner_block == [] do
raise ArgumentError, "should pass at least text attribute or an inner block"
end
~H"""