From d0ef0e0279cf56c4e8f300aa24d994a0e8dbedc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 10 Aug 2023 20:54:07 +0200 Subject: [PATCH] Improve unlisted error when there is no files/ directory --- .../add_file_entry_unlisted_component.ex | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/livebook_web/live/session_live/add_file_entry_unlisted_component.ex b/lib/livebook_web/live/session_live/add_file_entry_unlisted_component.ex index 3f8559c6c..2c9a22f80 100644 --- a/lib/livebook_web/live/session_live/add_file_entry_unlisted_component.ex +++ b/lib/livebook_web/live/session_live/add_file_entry_unlisted_component.ex @@ -16,7 +16,7 @@ defmodule LivebookWeb.SessionLive.AddFileEntryUnlistedComponent do |> assign_new(:files, fn -> case FileSystem.File.list(assigns.session.files_dir) do {:ok, files} -> unlisted_files(files, assigns.file_entries) - {:error, _} -> [] + {:error, _} -> :none end end) @@ -37,12 +37,16 @@ defmodule LivebookWeb.SessionLive.AddFileEntryUnlistedComponent do @impl true def render(assigns) do ~H""" -
- <%= if @files == [] do %> -

- No other files found in the files/ directory. -

- <% else %> +
+

+ There is no files/ directory that exists alongside your notebook. +

+ +

+ No other files found in the files/ directory. +

+ +

Here are other files from the files/ directory that you may want to add.

@@ -77,7 +81,7 @@ defmodule LivebookWeb.SessionLive.AddFileEntryUnlistedComponent do
- <% end %> +
""" end