defmodule LivebookWeb.Hub.NewLive do use LivebookWeb, :live_view alias LivebookWeb.LayoutHelpers alias Phoenix.LiveView.JS on_mount LivebookWeb.SidebarHook @impl true def mount(_params, _session, socket) do enabled? = Livebook.Config.feature_flag_enabled?(:create_hub) {:ok, assign(socket, selected_type: nil, page_title: "Livebook - Hub", enabled?: enabled?)} end @impl true def handle_params(_params, _url, socket), do: {:noreply, socket} @impl true def render(%{enabled?: false} = assigns) do ~H"""

Deploy applications, share secrets, templates, and more with Livebook Hubs.

Each Livebook user has their own personal Hub and soon they will be able to deploy their personal notebooks to Fly.io and Hugging Face.

We are also working on Livebook Teams, which were designed from the ground up to deploy notebooks within your organization. Livebook Teams runs on your own infrastructure to provide essential features for secure collaboration between team members, such as digital signing of notebooks, safe sharing of secrets, and more. To learn more, get in touch!

- The Livebook Team

""" end 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.

2. Configure your Hub

<.live_component :if={@selected_type == "fly"} module={LivebookWeb.Hub.New.FlyComponent} id="fly-form" /> <.live_component :if={@selected_type == "enterprise"} module={LivebookWeb.Hub.New.EnterpriseComponent} id="enterprise-form" />
""" end defp card_item(assigns) do ~H"""
<%= render_slot(@logo) %>

<%= @title %>

<%= render_slot(@headline) %>

""" end @impl true def handle_event("select_type", %{"value" => service}, socket) do {:noreply, assign(socket, selected_type: service)} end end