defmodule LivebookWeb.Hub.NewLive do use LivebookWeb, :live_view alias LivebookWeb.{PageHelpers, LayoutHelpers} alias Phoenix.LiveView.JS on_mount LivebookWeb.SidebarHook @impl true def mount(_params, _session, socket) do {:ok, assign(socket, selected_type: nil, page_title: "Livebook - Hub")} end @impl true def render(assigns) do ~H"""

Manage your Livebooks in the cloud with Hubs.

1. Select your Hub service

<.card_item id="fly" selected={@selected_type} title="Fly"> <:logo> <%= Phoenix.HTML.raw(File.read!("static/images/fly.svg")) %> <:headline> Deploy notebooks to your Fly account. <.card_item id="enterprise" selected={@selected_type} title="Livebook Enterprise"> <:logo> Livebook Enterprise logo <:headline> Control access, manage secrets, and deploy notebooks within your team.
<%= if @selected_type do %>

2. Configure your Hub

<%= if @selected_type == "fly" do %> <.live_component module={LivebookWeb.Hub.New.FlyComponent} id="fly-form" /> <% end %> <%= if @selected_type == "enterprise" do %>
Livebook Enterprise is currently in closed beta. If you want to learn more, click here.
<% end %>
<% end %>
""" end defp card_item(assigns) do ~H"""
card_item_bg_color(@id, @selected)} phx-click={JS.push("select_type", value: %{value: @id})} >

<%= @title %>

<%= render_slot(@headline) %>

""" end defp card_item_bg_color(id, selected) when id == selected, do: "selected" defp card_item_bg_color(_id, _selected), do: "" @impl true def handle_event("select_type", %{"value" => service}, socket) do {:noreply, assign(socket, selected_type: service)} end end