From 69c47c2c653f737383dda9ec232ade3b15f081f2 Mon Sep 17 00:00:00 2001 From: Kieran Date: Tue, 20 Feb 2024 17:37:17 -0800 Subject: [PATCH] Basic onboading flow (#24) * removed unused file * [WIP] Created onboarding form * Finished basic onboarding flow; added tests * Improved onboarding language --- .github/workflows/list_and_test.yml | 0 lib/pinchflat/media.ex | 1 + lib/pinchflat/profiles/media_profile.ex | 2 +- lib/pinchflat_web.ex | 2 + .../custom_components/button_components.ex | 18 +- .../components/layouts/onboarding.html.heex | 18 ++ .../layouts/partials/header.html.heex | 4 +- .../layouts/partials/sidebar.html.heex | 6 +- .../components/layouts/root.html.heex | 2 +- .../media_profile_controller.ex | 18 +- .../media_profile_form.html.heex | 16 +- .../media_profile_html/new.html.heex | 2 +- .../media_sources/source_controller.ex | 25 ++- .../media_sources/source_html/new.html.heex | 2 +- .../source_html/source_form.html.heex | 8 +- .../controllers/page_controller.ex | 9 - .../controllers/page_html/home.html.heex | 202 ------------------ .../controllers/pages/page_controller.ex | 35 +++ .../controllers/{ => pages}/page_html.ex | 2 +- .../pages/page_html/home.html.heex | 8 + .../page_html/onboarding_checklist.html.heex | 51 +++++ lib/pinchflat_web/router.ex | 2 +- test/pinchflat/media_test.exs | 12 ++ .../media_profile_controller_test.exs | 27 +++ .../controllers/page_controller_test.exs | 50 ++++- .../controllers/source_controller_test.exs | 29 +++ test/support/conn_case.ex | 6 +- 27 files changed, 313 insertions(+), 244 deletions(-) delete mode 100644 .github/workflows/list_and_test.yml create mode 100644 lib/pinchflat_web/components/layouts/onboarding.html.heex delete mode 100644 lib/pinchflat_web/controllers/page_controller.ex delete mode 100644 lib/pinchflat_web/controllers/page_html/home.html.heex create mode 100644 lib/pinchflat_web/controllers/pages/page_controller.ex rename lib/pinchflat_web/controllers/{ => pages}/page_html.ex (60%) create mode 100644 lib/pinchflat_web/controllers/pages/page_html/home.html.heex create mode 100644 lib/pinchflat_web/controllers/pages/page_html/onboarding_checklist.html.heex diff --git a/.github/workflows/list_and_test.yml b/.github/workflows/list_and_test.yml deleted file mode 100644 index e69de29..0000000 diff --git a/lib/pinchflat/media.ex b/lib/pinchflat/media.ex index cdd3fd6..0eb996a 100644 --- a/lib/pinchflat/media.ex +++ b/lib/pinchflat/media.ex @@ -100,6 +100,7 @@ defmodule Pinchflat.Media do field -> List.wrap(mapped_struct[field]) end) |> List.flatten() + |> Enum.filter(&is_binary/1) end @doc """ diff --git a/lib/pinchflat/profiles/media_profile.ex b/lib/pinchflat/profiles/media_profile.ex index b765055..25bd38c 100644 --- a/lib/pinchflat/profiles/media_profile.ex +++ b/lib/pinchflat/profiles/media_profile.ex @@ -29,7 +29,7 @@ defmodule Pinchflat.Profiles.MediaProfile do schema "media_profiles" do field :name, :string - field :output_path_template, :string, default: "/{{ uploader }}/{{ title }}.{{ ext }}" + field :output_path_template, :string, default: "/{{ uploader }}/{{ title }}/{{ title }}-{{ id }}.{{ ext }}" field :download_subs, :boolean, default: true field :download_auto_subs, :boolean, default: true diff --git a/lib/pinchflat_web.ex b/lib/pinchflat_web.ex index 0ec628b..0df8659 100644 --- a/lib/pinchflat_web.ex +++ b/lib/pinchflat_web.ex @@ -45,6 +45,8 @@ defmodule PinchflatWeb do import Plug.Conn import PinchflatWeb.Gettext + alias PinchflatWeb.Layouts + unquote(verified_routes()) end end diff --git a/lib/pinchflat_web/components/custom_components/button_components.ex b/lib/pinchflat_web/components/custom_components/button_components.ex index 5949ae0..0240f3c 100644 --- a/lib/pinchflat_web/components/custom_components/button_components.ex +++ b/lib/pinchflat_web/components/custom_components/button_components.ex @@ -14,18 +14,22 @@ defmodule PinchflatWeb.CustomComponents.ButtonComponents do attr :color, :string, default: "bg-primary" attr :rounding, :string, default: "rounded-sm" attr :class, :string, default: "" + attr :disabled, :boolean, default: false slot :inner_block, required: true def button(assigns) do ~H""" - """ diff --git a/lib/pinchflat_web/components/layouts/onboarding.html.heex b/lib/pinchflat_web/components/layouts/onboarding.html.heex new file mode 100644 index 0000000..7228a33 --- /dev/null +++ b/lib/pinchflat_web/components/layouts/onboarding.html.heex @@ -0,0 +1,18 @@ +
+
+
+
+
+

Pinchflat

+
+
+
+ +
+
+ <.flash_group flash={@flash} /> + <%= @inner_content %> +
+
+
+
diff --git a/lib/pinchflat_web/components/layouts/partials/header.html.heex b/lib/pinchflat_web/components/layouts/partials/header.html.heex index 056d30b..3140ce9 100644 --- a/lib/pinchflat_web/components/layouts/partials/header.html.heex +++ b/lib/pinchflat_web/components/layouts/partials/header.html.heex @@ -7,7 +7,7 @@ > <.icon name="hero-bars-3" /> - @@ -22,7 +22,7 @@ name="q" value={@params["q"]} placeholder="Type to search..." - class="w-full bg-transparent pl-9 pr-4 border-0 focus:ring-0 focus:outline-none xl:w-125" + class="w-full bg-transparent pl-9 pr-4 border-0 focus:ring-0 focus:outline-none lg:w-125" /> diff --git a/lib/pinchflat_web/components/layouts/partials/sidebar.html.heex b/lib/pinchflat_web/components/layouts/partials/sidebar.html.heex index 5b7fe3c..43cc94c 100644 --- a/lib/pinchflat_web/components/layouts/partials/sidebar.html.heex +++ b/lib/pinchflat_web/components/layouts/partials/sidebar.html.heex @@ -4,7 +4,9 @@ @click.outside="sidebarToggle = false" >
-

Pinchflat

+ +

Pinchflat

+