Onboarding improvements (#76)
* Disabled pro modal during onboarding * Restructured the way onboarding changes settings * Added better upload date template placeholder
This commit is contained in:
@@ -35,6 +35,7 @@ defmodule PinchflatWeb.MediaProfiles.MediaProfileHTML do
|
||||
upload_day: nil,
|
||||
upload_month: nil,
|
||||
upload_year: nil,
|
||||
upload_yyyy_mm_dd: "the upload date in the format YYYY-MM-DD",
|
||||
source_custom_name: "the name of the sources that use this profile",
|
||||
source_collection_type: "the collection type of the sources that use this profile. Either 'channel' or 'playlist'"
|
||||
}
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
type="text"
|
||||
inputclass="font-mono"
|
||||
label="Output path template"
|
||||
help="Must end with .{{ ext }}. See below for more details. I promise the default is good for most cases (required)"
|
||||
help="Must end with .{{ ext }}. See below for more details. The default is good for most cases (required)"
|
||||
/>
|
||||
|
||||
<h3 class="mt-8 text-2xl text-black dark:text-white">
|
||||
|
||||
@@ -8,38 +8,34 @@ defmodule PinchflatWeb.Pages.PageController do
|
||||
alias Pinchflat.Profiles.MediaProfile
|
||||
|
||||
def home(conn, params) do
|
||||
force_onboarding = params["onboarding"]
|
||||
media_profiles_exist = Repo.exists?(MediaProfile)
|
||||
sources_exist = Repo.exists?(Source)
|
||||
done_onboarding = params["onboarding"] == "0"
|
||||
force_onboarding = params["onboarding"] == "1"
|
||||
|
||||
if !force_onboarding && media_profiles_exist && sources_exist do
|
||||
render_home_page(conn)
|
||||
if done_onboarding, do: Settings.set!(:onboarding, false)
|
||||
|
||||
if force_onboarding || Settings.get!(:onboarding) do
|
||||
render_onboarding_page(conn)
|
||||
else
|
||||
render_onboarding_page(conn, media_profiles_exist, sources_exist)
|
||||
render_home_page(conn)
|
||||
end
|
||||
end
|
||||
|
||||
defp render_home_page(conn) do
|
||||
Settings.set!(:onboarding, false)
|
||||
media_profile_count = Repo.aggregate(MediaProfile, :count, :id)
|
||||
source_count = Repo.aggregate(Source, :count, :id)
|
||||
media_item_count = Repo.aggregate(MediaItem, :count, :id)
|
||||
|
||||
conn
|
||||
|> render(:home,
|
||||
media_profile_count: media_profile_count,
|
||||
source_count: source_count,
|
||||
media_item_count: media_item_count
|
||||
media_profile_count: Repo.aggregate(MediaProfile, :count, :id),
|
||||
source_count: Repo.aggregate(Source, :count, :id),
|
||||
media_item_count: Repo.aggregate(MediaItem, :count, :id)
|
||||
)
|
||||
end
|
||||
|
||||
defp render_onboarding_page(conn, media_profiles_exist, sources_exist) do
|
||||
defp render_onboarding_page(conn) do
|
||||
Settings.set!(:onboarding, true)
|
||||
|
||||
conn
|
||||
|> render(:onboarding_checklist,
|
||||
media_profiles_exist: media_profiles_exist,
|
||||
sources_exist: sources_exist,
|
||||
media_profiles_exist: Repo.exists?(MediaProfile),
|
||||
sources_exist: Repo.exists?(Source),
|
||||
layout: {Layouts, :onboarding}
|
||||
)
|
||||
end
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
</p>
|
||||
<p class="text-md text-bodydark">Feel free to add more Media Profiles or Sources in the meantime!</p>
|
||||
<div class="mt-8">
|
||||
<.link href={~p"/"}>
|
||||
<.link href={~p"/?onboarding=0"}>
|
||||
<.button color="bg-primary" rounding="rounded-full" disabled={not @sources_exist}>
|
||||
Let's Go <span class="font-bold mx-2">🚀</span>
|
||||
</.button>
|
||||
|
||||
Reference in New Issue
Block a user