diff --git a/lib/livebook_web/live/home_live.ex b/lib/livebook_web/live/home_live.ex index 46d3b518f..7afca84c8 100644 --- a/lib/livebook_web/live/home_live.ex +++ b/lib/livebook_web/live/home_live.ex @@ -116,8 +116,23 @@ defmodule LivebookWeb.HomeLive do sessions={@sessions} added_at_label="Starred" > - <:card_icon> - <.remix_icon icon="star-fill" class="text-yellow-600" /> + <:card_icon :let={{_info, idx}}> + + + <% end %> @@ -262,6 +277,12 @@ defmodule LivebookWeb.HomeLive do {:noreply, create_session(socket)} end + def handle_event("unstar_notebook", %{"idx" => idx}, socket) do + %{file: file} = Enum.fetch!(socket.assigns.starred_notebooks, idx) + Livebook.NotebookManager.remove_starred_notebook(file) + {:noreply, socket} + end + def handle_event("bulk_action", %{"action" => "disconnect"} = params, socket) do socket = assign(socket, selected_session_ids: params["session_ids"]) {:noreply, push_patch(socket, to: ~p"/home/sessions/edit_sessions/disconnect")} diff --git a/lib/livebook_web/live/notebook_cards_component.ex b/lib/livebook_web/live/notebook_cards_component.ex index b46fb8c35..07be8107f 100644 --- a/lib/livebook_web/live/notebook_cards_component.ex +++ b/lib/livebook_web/live/notebook_cards_component.ex @@ -18,7 +18,7 @@ defmodule LivebookWeb.NotebookCardsComponent do <%= info.name %> - <%= @card_icon && render_slot(@card_icon) %> + <%= @card_icon && render_slot(@card_icon, {info, idx}) %>
<%= @added_at_label %> <%= format_date_relatively(info.added_at) %>