defmodule LivebookWeb.SessionLive.DeleteSectionComponent do use LivebookWeb, :live_component @impl true def render(assigns) do ~H"""

Delete section

Are you sure you want to delete this section - “<%= @section.name %>”?

Options

<% # If there is no previous section, all cells need to be deleted %> <.switch_field name="delete_cells" label="Delete all cells in this section" value={@is_first} disabled={@is_first} />
<.link patch={@return_to} class="button-base button-outlined-gray"> Cancel
""" end @impl true def handle_event("delete", %{"delete_cells" => delete_cells}, socket) do delete_cells? = delete_cells == "true" Livebook.Session.delete_section( socket.assigns.session.pid, socket.assigns.section.id, delete_cells? ) {:noreply, push_patch(socket, to: socket.assigns.return_to, replace: true)} end end