defmodule LivebookWeb.HomeLive.CloseSessionComponent do use LivebookWeb, :live_component alias LivebookWeb.HomeLive.SessionListComponent @impl true def render(assigns) do ~H"""

Close session

Are you sure you want to close this session - “<%= @session.notebook_name %>”?
<%= if @session.file, do: "This won't delete any persisted files.", else: "The notebook is not persisted and content may be lost." %>

<%= live_patch("Cancel", to: @return_to, class: "button-base button-outlined-gray") %>
""" end @impl true def handle_event("close", %{}, socket) do Livebook.Session.close(socket.assigns.session.pid) {:noreply, push_patch(socket, to: socket.assigns.return_to, replace: true)} end end