Rename the Explore section to Learn (#1424)

Co-authored-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
Paulo Valim 2022-09-21 12:06:22 +02:00 committed by GitHub
parent c30894a7f3
commit 285bc923b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 80 additions and 80 deletions

View file

@ -28,7 +28,7 @@ Livebook is a web application for writing interactive and collaborative code not
## Getting started
Head out to [the Install section](https://livebook.dev/#install) of Livebook's website to get started. Once Livebook is up and running on your machine, **visit the "Explore" section** with introductory guides and documentation on several Livebook features. Here is a sneak peak of the "Welcome to Livebook" guide:
Head out to [the Install section](https://livebook.dev/#install) of Livebook's website to get started. Once Livebook is up and running on your machine, **visit the "Learn" section** with introductory guides and documentation on several Livebook features. Here is a sneak peak of the "Welcome to Livebook" guide:
![Screenshot](https://github.com/livebook-dev/livebook/raw/main/.github/imgs/welcome.png)

View file

@ -23,7 +23,7 @@ config :livebook,
app_service_name: nil,
app_service_url: nil,
authentication_mode: :token,
explore_notebooks: [],
learn_notebooks: [],
feature_flags: [],
plugs: [],
shutdown_enabled: false,

View file

@ -38,20 +38,20 @@ defmodule Livebook do
}
]
### Custom explore notebooks
### Custom learn notebooks
**Note that this is compile time configuration.**
A list of additional notebooks to include in the Explore section.
A list of additional notebooks to include in the Learn section.
Note that the notebooks are loaded and embedded in a compiled module,
so the paths are accessed at compile time only.
config :livebook, :explore_notebooks, [
config :livebook, :learn_notebooks, [
%{
# Required notebook path
path: "/path/to/notebook.livemd",
# Optional notebook identifier for URLs, as in /explore/notebooks/{slug}
# Optional notebook identifier for URLs, as in /learn/notebooks/{slug}
# By default the slug is inferred from file name, so there is no need to set it
slug: "my-notebook"
# Optional list of images
@ -60,7 +60,7 @@ defmodule Livebook do
"/path/to/myimage.jpg"
],
# Optional details for the notebook card. If omitted, the notebook
# is hidden in the UI, but still accessible under /explore/notebooks/{slug}
# is hidden in the UI, but still accessible under /learn/notebooks/{slug}
details: %{
cover_path: "/path/to/logo.png",
description: "My custom notebook that showcases some amazing stuff."

View file

@ -1,4 +1,4 @@
defmodule Livebook.Notebook.Explore do
defmodule Livebook.Notebook.Learn do
@moduledoc false
defmodule NotFoundError do
@ -34,19 +34,19 @@ defmodule Livebook.Notebook.Explore do
notebook_infos: list(notebook_info())
}
images_dir = Path.expand("explore/images", __DIR__)
images_dir = Path.expand("learn/images", __DIR__)
welcome_config = %{
path: Path.join(__DIR__, "explore/intro_to_livebook.livemd"),
path: Path.join(__DIR__, "learn/intro_to_livebook.livemd"),
details: %{
description: "Get to know Livebook, see how it works, and explore its features.",
description: "Get to know Livebook, see how it works, and learn its features.",
cover_url: "/images/logo.png"
}
}
other_configs = [
%{
path: Path.join(__DIR__, "explore/distributed_portals_with_elixir.livemd"),
path: Path.join(__DIR__, "learn/distributed_portals_with_elixir.livemd"),
image_paths: [
Path.join(images_dir, "portal-drop.jpeg"),
Path.join(images_dir, "portal-list.jpeg")
@ -58,28 +58,28 @@ defmodule Livebook.Notebook.Explore do
}
},
%{
path: Path.join(__DIR__, "explore/elixir_and_livebook.livemd"),
path: Path.join(__DIR__, "learn/elixir_and_livebook.livemd"),
details: %{
description: "Learn how to use some of their unique features together.",
cover_url: "/images/elixir.png"
}
},
%{
path: Path.join(__DIR__, "explore/intro_to_kino.livemd"),
path: Path.join(__DIR__, "learn/intro_to_kino.livemd"),
details: %{
description: "Make your notebooks interactive with inputs, controls, and more.",
cover_url: "/images/kino.png"
}
},
%{
path: Path.join(__DIR__, "explore/intro_to_vega_lite.livemd"),
path: Path.join(__DIR__, "learn/intro_to_vega_lite.livemd"),
details: %{
description: "Learn how to quickly create numerous plots for your data.",
cover_url: "/images/vega_lite.png"
}
},
%{
path: Path.join(__DIR__, "explore/intro_to_maplibre.livemd"),
path: Path.join(__DIR__, "learn/intro_to_maplibre.livemd"),
details: %{
description: "Seamlessly plot maps using geospatial and tabular data.",
cover_url: "/images/maplibre.png"
@ -87,27 +87,27 @@ defmodule Livebook.Notebook.Explore do
},
%{
ref: :kino_vm_introspection,
path: Path.join(__DIR__, "explore/kino/vm_introspection.livemd")
path: Path.join(__DIR__, "learn/kino/vm_introspection.livemd")
},
%{
ref: :kino_chat_app,
path: Path.join(__DIR__, "explore/kino/chat_app.livemd")
path: Path.join(__DIR__, "learn/kino/chat_app.livemd")
},
%{
ref: :kino_pong,
path: Path.join(__DIR__, "explore/kino/pong.livemd")
path: Path.join(__DIR__, "learn/kino/pong.livemd")
},
%{
ref: :kino_custom_kinos,
path: Path.join(__DIR__, "explore/kino/custom_kinos.livemd")
path: Path.join(__DIR__, "learn/kino/custom_kinos.livemd")
},
%{
ref: :kino_smart_cells,
path: Path.join(__DIR__, "explore/kino/smart_cells.livemd")
path: Path.join(__DIR__, "learn/kino/smart_cells.livemd")
}
]
user_configs = Application.compile_env(:livebook, :explore_notebooks, [])
user_configs = Application.compile_env(:livebook, :learn_notebooks, [])
notebook_configs = [welcome_config] ++ user_configs ++ other_configs
@ -180,7 +180,7 @@ defmodule Livebook.Notebook.Explore do
end
@doc """
Finds explore notebook by slug and returns the parsed data structure.
Finds learn notebook by slug and returns the parsed data structure.
Returns the notebook along with the images it uses as preloaded binaries.
"""

View file

@ -692,7 +692,7 @@ Now we have everything we need to connect across notebooks.
### Notebook connections
In order to connect across notebooks, open up [a new empty notebook](/explore/notebooks/new)
In order to connect across notebooks, open up [a new empty notebook](/learn/notebooks/new)
in a separate tab, copy and paste the code below to this new notebook,
and execute it:
@ -794,7 +794,7 @@ To learn more about Elixir, we welcome you to explore our [website](http://elixi
and [many of the available learning resources](https://elixir-lang.org/learning.html).
You can also learn how to use some of Elixir and Livebook's unique features together
in the [Elixir and Livebook](/explore/notebooks/elixir-and-livebook) notebook.
in the [Elixir and Livebook](/learn/notebooks/elixir-and-livebook) notebook.
Finally, huge thanks to Augie De Blieck Jr. for the drawings in this tutorial.

View file

@ -8,7 +8,7 @@ and more.
If you are not familiar with Elixir, there is a fast paced
introduction to the language in the [Distributed portals with
Elixir](/explore/notebooks/distributed-portals-with-elixir)
Elixir](/learn/notebooks/distributed-portals-with-elixir)
notebook. For a more structured introduction to the language,
see [Elixir's Getting Started guide](https://elixir-lang.org/getting-started/introduction.html)
and [the many learning resources available](https://elixir-lang.org/learning.html).
@ -93,7 +93,7 @@ Mix.install(
## More on branches #1
We already mentioned branching sections in
[Welcome to Livebook](/explore/notebooks/intro-to-livebook),
[Welcome to Livebook](/learn/notebooks/intro-to-livebook),
but in Elixir terms each branching section:
* runs in a separate process from the main flow

View file

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View file

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View file

@ -69,7 +69,7 @@ A regular Markdown file.
The way it works is that Livebook automatically detects
the output is a kino and renders it in Markdown. That's
the first of many kinos we will learn today. Let's move
the first of many kinos we will explore today. Let's move
forward.
<!-- livebook:{"branch_parent_index":0} -->
@ -231,11 +231,11 @@ to inspect, toggle, and swap each operation along the way:
With this, we finished our introduction to Kino. Most the guides
ahead of us will use Kino in one way or the other. You can jump
into [the VegaLite guide](/explore/notebooks/intro-to-vega-lite)
for plotting charts or [the MapLibre guide](/explore/notebooks/intro-to-maplibre)
into [the VegaLite guide](/learn/notebooks/intro-to-vega-lite)
for plotting charts or [the MapLibre guide](/learn/notebooks/intro-to-maplibre)
for rendering maps to learn how other packages extend Livebook
through Kino.
We also have a collection of deep dive guides into Kino in the
[Explore](/explore) page if you want to learn more, including how
[Learn](/learn) page if you want to learn more, including how
to create your custom widgets.

View file

@ -144,11 +144,11 @@ That's our quick intro to Livebook! Where to go next?
* If you are not familiar with Elixir, there is a fast paced
introduction to the language in the [Distributed portals
with Elixir](/explore/notebooks/distributed-portals-with-elixir)
with Elixir](/learn/notebooks/distributed-portals-with-elixir)
notebook;
* Learn how Elixir integrates with Livebook in the
[Elixir and Livebook](/explore/notebooks/elixir-and-livebook) notebook;
[Elixir and Livebook](/learn/notebooks/elixir-and-livebook) notebook;
* Finally, remember Livebook is an open source project, so feel free to
look into [the repository](https://github.com/livebook-dev/livebook)

View file

@ -87,7 +87,7 @@ a regular Code cell for further adjustments!
The Chart smart cell is one of many Smart cells available
in Livebook ⚡ Not only that, you can create your own Smart
cells too, which we discuss in the
[Exploring Smart cells](/explore/notebooks/smart-cells) notebook!
[Exploring Smart cells](/learn/notebooks/smart-cells) notebook!
<!-- livebook:{"branch_parent_index":0} -->

View file

@ -14,7 +14,7 @@ have a look at the building blocks that we will need!
## Kino.Control
In our [introduction to Kino](/explore/notebooks/intro-to-kino),
In our [introduction to Kino](/learn/notebooks/intro-to-kino),
we learned about inputs and several different outputs, such as
tables, frames, and more. In particular, we learned how to use
inputs to capture values directly into our notebooks:
@ -150,4 +150,4 @@ on different tabs and each different user can post
their messages.
In the next notebook we will go one step further and
[develop a multiplayer pong game](/explore/notebooks/pong)!
[develop a multiplayer pong game](/learn/notebooks/pong)!

View file

@ -197,4 +197,4 @@ KinoGuide.Counter.bump(counter)
```
In the next notebook we will get back to those concepts and
[extend Livebook with custom Smart cells](/explore/notebooks/smart-cells)!
[extend Livebook with custom Smart cells](/learn/notebooks/smart-cells)!

View file

@ -936,5 +936,5 @@ disable the keyboard, the game continues running. Could you change the
code above to stop the game once any player toggles the keyboard off?
In any case, this was a fun and long ride! The next guide should be
much shorter and we will learn [how to create our own kinos](/explore/notebooks/custom-kinos)
much shorter and we will learn [how to create our own kinos](/learn/notebooks/custom-kinos)
using Elixir and JavaScript.

View file

@ -9,10 +9,10 @@ Mix.install([
## Introduction
In this notebook, we will learn how to use `Kino` and `VegaLite`
to explore how Elixir works and plot how our system behaves over
In this notebook, we will explore how to use `Kino` and `VegaLite`
to learn how Elixir works and plot how our system behaves over
time. If you are not familiar with VegaLite, [read
its introductory notebook](/explore/notebooks/intro-to-vega-lite).
its introductory notebook](/learn/notebooks/intro-to-vega-lite).
Both `Kino` and `VegaLite` have been listed as dependencies in the
setup cell.
@ -364,4 +364,4 @@ end
```
In the next notebook, we will learn [how to use `Kino.Control`
to build a chat app](/explore/notebooks/chat-app)!
to build a chat app](/learn/notebooks/chat-app)!

View file

@ -161,7 +161,7 @@ defmodule LivebookCLI.Server do
defp open_from_args(base_url, ["new"]) do
base_url
|> set_path("/explore/notebooks/new")
|> set_path("/learn/notebooks/new")
|> Livebook.Utils.browser_open()
end

View file

@ -3,7 +3,7 @@ defmodule LivebookWeb.HomeLive do
import LivebookWeb.SessionHelpers
alias LivebookWeb.{ExploreHelpers, PageHelpers, LayoutHelpers}
alias LivebookWeb.{LearnHelpers, PageHelpers, LayoutHelpers}
alias Livebook.{Sessions, Session, LiveMarkdown, Notebook, FileSystem}
on_mount LivebookWeb.SidebarHook
@ -16,7 +16,7 @@ defmodule LivebookWeb.HomeLive do
end
sessions = Sessions.list_sessions()
notebook_infos = Notebook.Explore.visible_notebook_infos() |> Enum.take(3)
notebook_infos = Notebook.Learn.visible_notebook_infos() |> Enum.take(3)
{:ok,
assign(socket,
@ -101,12 +101,12 @@ defmodule LivebookWeb.HomeLive do
</.live_component>
</div>
<div class="py-12" data-el-explore-section role="region" aria-label="explore section">
<div class="py-12" data-el-learn-section role="region" aria-label="learn section">
<div class="mb-4 flex justify-between items-center">
<h2 class="uppercase font-semibold text-gray-500">
Explore
Learn
</h2>
<%= live_redirect to: Routes.explore_path(@socket, :page),
<%= live_redirect to: Routes.learn_path(@socket, :page),
class: "flex items-center text-blue-600" do %>
<span class="font-semibold">See all</span>
<.remix_icon icon="arrow-right-line" class="align-middle ml-1" />
@ -116,7 +116,7 @@ defmodule LivebookWeb.HomeLive do
<% # Note: it's fine to use stateless components in this comprehension,
# because @notebook_infos never change %>
<%= for info <- @notebook_infos do %>
<ExploreHelpers.notebook_card notebook_info={info} socket={@socket} />
<LearnHelpers.notebook_card notebook_info={info} socket={@socket} />
<% end %>
</div>
</div>

View file

@ -109,9 +109,9 @@ defmodule LivebookWeb.LayoutHelpers do
current={@current_page}
/>
<.sidebar_link
title="Explore"
icon="compass-3-line"
to={Routes.explore_path(@socket, :page)}
title="Learn"
icon="article-line"
to={Routes.learn_path(@socket, :page)}
current={@current_page}
/>
<.sidebar_link

View file

@ -1,15 +1,15 @@
defmodule LivebookWeb.ExploreHelpers do
defmodule LivebookWeb.LearnHelpers do
use Phoenix.Component
alias LivebookWeb.Router.Helpers, as: Routes
@doc """
Renders an explore notebook card.
Renders an learn notebook card.
"""
def notebook_card(assigns) do
~H"""
<div class="flex flex-col">
<%= live_redirect to: Routes.explore_path(@socket, :notebook, @notebook_info.slug),
<%= live_redirect to: Routes.learn_path(@socket, :notebook, @notebook_info.slug),
class: "flex items-center justify-center p-6 border-2 border-gray-100 rounded-t-2xl h-[150px]" do %>
<img
src={@notebook_info.details.cover_url}
@ -19,7 +19,7 @@ defmodule LivebookWeb.ExploreHelpers do
<% end %>
<div class="px-6 py-4 bg-gray-100 rounded-b-2xl grow">
<%= live_redirect(@notebook_info.title,
to: Routes.explore_path(@socket, :notebook, @notebook_info.slug),
to: Routes.learn_path(@socket, :notebook, @notebook_info.slug),
class: "text-gray-800 font-semibold cursor-pointer"
) %>
<p class="mt-2 text-sm text-gray-600">

View file

@ -1,22 +1,22 @@
defmodule LivebookWeb.ExploreLive do
defmodule LivebookWeb.LearnLive do
use LivebookWeb, :live_view
import LivebookWeb.SessionHelpers
alias LivebookWeb.{LayoutHelpers, ExploreHelpers, PageHelpers}
alias Livebook.Notebook.Explore
alias LivebookWeb.{LayoutHelpers, LearnHelpers, PageHelpers}
alias Livebook.Notebook.Learn
on_mount LivebookWeb.SidebarHook
@impl true
def mount(_params, _session, socket) do
[lead_notebook_info | notebook_infos] = Explore.visible_notebook_infos()
[lead_notebook_info | notebook_infos] = Learn.visible_notebook_infos()
{:ok,
assign(socket,
lead_notebook_info: lead_notebook_info,
notebook_infos: notebook_infos,
page_title: "Livebook - Explore"
page_title: "Livebook - Learn"
)}
end
@ -25,13 +25,13 @@ defmodule LivebookWeb.ExploreLive do
~H"""
<LayoutHelpers.layout
socket={@socket}
current_page={Routes.explore_path(@socket, :page)}
current_page={Routes.learn_path(@socket, :page)}
current_user={@current_user}
saved_hubs={@saved_hubs}
>
<div class="p-4 sm:px-8 md:px-16 sm:py-7 max-w-screen-lg mx-auto space-y-4">
<div>
<PageHelpers.title text="Explore" />
<PageHelpers.title text="Learn" />
<p class="mt-4 mb-8 text-gray-700">
Check out a number of examples showcasing various parts of the Elixir ecosystem.<br />
Click on any notebook you like and start playing around with it!
@ -51,7 +51,7 @@ defmodule LivebookWeb.ExploreLive do
</p>
<div class="mt-4">
<%= live_patch("Open notebook",
to: Routes.explore_path(@socket, :notebook, @lead_notebook_info.slug),
to: Routes.learn_path(@socket, :notebook, @lead_notebook_info.slug),
class: "button-base button-blue"
) %>
</div>
@ -61,10 +61,10 @@ defmodule LivebookWeb.ExploreLive do
<% # Note: it's fine to use stateless components in this comprehension,
# because @notebook_infos never change %>
<%= for info <- @notebook_infos do %>
<ExploreHelpers.notebook_card notebook_info={info} socket={@socket} />
<LearnHelpers.notebook_card notebook_info={info} socket={@socket} />
<% end %>
</div>
<%= for group_info <- Explore.group_infos() do %>
<%= for group_info <- Learn.group_infos() do %>
<.notebook_group group_info={group_info} socket={@socket} />
<% end %>
</div>
@ -99,7 +99,7 @@ defmodule LivebookWeb.ExploreLive do
<div class="grow text-gray-800 font-semibold">
<%= notebook_info.title %>
</div>
<%= live_redirect to: Routes.explore_path(@socket, :notebook, notebook_info.slug),
<%= live_redirect to: Routes.learn_path(@socket, :notebook, notebook_info.slug),
class: "button-base button-outlined-gray mt-3 sm:mt-0" do %>
<.remix_icon icon="play-circle-line" class="align-middle mr-1" /> Open notebook
<% end %>
@ -117,7 +117,7 @@ defmodule LivebookWeb.ExploreLive do
end
def handle_params(%{"slug" => slug}, _url, socket) do
{notebook, images} = Explore.notebook_by_slug!(slug)
{notebook, images} = Learn.notebook_by_slug!(slug)
{:noreply, create_session(socket, notebook: notebook, images: images)}
end

View file

@ -6,7 +6,7 @@ defmodule LivebookWeb.PageHelpers do
## Examples
<.title text="Explore" socket={@socket} />
<.title text="Learn" socket={@socket} />
"""
def title(assigns) do
~H"""

View file

@ -54,8 +54,8 @@ defmodule LivebookWeb.Router do
live "/settings/env-var/new", SettingsLive, :add_env_var
live "/settings/env-var/edit/:env_var_id", SettingsLive, :edit_env_var
live "/explore", ExploreLive, :page
live "/explore/notebooks/:slug", ExploreLive, :notebook
live "/learn", LearnLive, :page
live "/learn/notebooks/:slug", LearnLive, :notebook
live "/hub", Hub.NewLive, :new, as: :hub
live "/hub/:id", Hub.EditLive, :edit, as: :hub

View file

@ -1,17 +1,17 @@
defmodule Livebook.ExploreTest do
defmodule Livebook.LearnTest do
use ExUnit.Case, async: true
alias Livebook.Notebook
alias Livebook.Notebook.Explore
alias Livebook.Notebook.Learn
describe "notebook_by_slug!/1" do
test "returns notebook structure and images if found" do
assert {%Notebook{}, _imaegs} = Explore.notebook_by_slug!("intro-to-livebook")
assert {%Notebook{}, _imaegs} = Learn.notebook_by_slug!("intro-to-livebook")
end
test "raises an error if no matching notebook if found" do
assert_raise Explore.NotFoundError, fn ->
Explore.notebook_by_slug!("invalid-slug")
assert_raise Learn.NotFoundError, fn ->
Learn.notebook_by_slug!("invalid-slug")
end
end
end

View file

@ -254,7 +254,7 @@ defmodule LivebookWeb.HomeLiveTest do
assert {:error, {:live_redirect, %{to: to}}} =
view
|> element(~s{[data-el-explore-section] a}, "Welcome to Livebook")
|> element(~s{[data-el-learn-section] a}, "Welcome to Livebook")
|> render_click()
|> follow_redirect(conn)

View file

@ -1,10 +1,10 @@
defmodule LivebookWeb.ExploreLiveTest do
defmodule LivebookWeb.LearnLiveTest do
use LivebookWeb.ConnCase, async: true
import Phoenix.LiveViewTest
test "link to introductory notebook correctly creates a new session", %{conn: conn} do
{:ok, view, _} = live(conn, "/explore")
{:ok, view, _} = live(conn, "/learn")
assert {:error, {:live_redirect, %{to: to}}} =
view
@ -20,7 +20,7 @@ defmodule LivebookWeb.ExploreLiveTest do
test "link to a new notebook creates an empty session", %{conn: conn} do
{:ok, view, _} =
conn
|> live("/explore/notebooks/new")
|> live("/learn/notebooks/new")
|> follow_redirect(conn)
assert render(view) =~ "Untitled notebook"