add fresh install redirect and admin provider tests

Fresh installs now redirect to /users/register instead of showing the
demo shop. Post-login redirect goes to /admin dashboard (with setup
checklist) instead of /admin/settings. Added 16 provider tests covering
index (list, delete, sync) and form (new, edit, test connection).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-02-12 14:40:58 +00:00
parent 0dac93ec0b
commit 2cc8c4a9cb
13 changed files with 312 additions and 15 deletions

View File

@@ -8,7 +8,7 @@
</.header>
<div id="connections" phx-update="stream" class="mt-6 space-y-4">
<div class="hidden only:block text-center py-12">
<div id="connections-empty" class="hidden only:block text-center py-12">
<.icon name="hero-cube" class="size-16 mx-auto mb-4 text-base-content/30" />
<h2 class="text-xl font-medium">Connect your Printify account</h2>
<p class="mt-2 text-base-content/60 max-w-md mx-auto">

View File

@@ -51,8 +51,8 @@ defmodule SimpleshopThemeWeb.ThemeHook do
{:cont, socket}
not SimpleshopTheme.Accounts.has_admin?() ->
# Fresh install — no admin yet, show the demo shop
{:cont, socket}
# Fresh install — send to registration
{:halt, Phoenix.LiveView.redirect(socket, to: "/users/register")}
true ->
{:halt, Phoenix.LiveView.redirect(socket, to: "/coming-soon")}

View File

@@ -257,9 +257,9 @@ defmodule SimpleshopThemeWeb.UserAuth do
end
@doc "Returns the path to redirect to after log in."
# the user was already logged in, redirect to admin settings
# the user was already logged in, redirect to admin dashboard
def signed_in_path(%Plug.Conn{assigns: %{current_scope: %Scope{user: %Accounts.User{}}}}) do
~p"/admin/settings"
~p"/admin"
end
def signed_in_path(_), do: ~p"/"