defmodule LivebookWeb.SidebarHelpers do use Phoenix.Component import LivebookWeb.LiveHelpers import LivebookWeb.UserHelpers alias Phoenix.LiveView.JS alias LivebookWeb.Router.Helpers, as: Routes @doc """ Renders sidebar container. """ def sidebar(assigns) do ~H""" """ end defp sidebar_link(assigns) do ~H""" <%= live_redirect to: @to, class: "h-7 flex items-center hover:text-white #{sidebar_link_text_color(@to, @current)} border-l-4 #{sidebar_link_border_color(@to, @current)} hover:border-white" do %> <.remix_icon icon={@icon} class="text-lg leading-6 w-[56px] flex justify-center" /> <%= @title %> <% end %> """ 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" def sidebar_handlers(socket) do if Livebook.Config.shutdown_enabled?() do attach_hook(socket, :shutdown, :handle_event, fn "shutdown", _params, socket -> System.stop() {:halt, put_flash(socket, :info, "Livebook is shutting down. You can close this page.")} _event, _params, socket -> {:cont, socket} end) else socket end end end