rename project from SimpleshopTheme to Berrypod
All modules, configs, paths, and references updated. 836 tests pass, zero warnings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -28,7 +28,7 @@ This plan covers the first piece. The other two are separate tasks that build on
|
||||
|
||||
## Design: single-admin, closed registration
|
||||
|
||||
SimpleShop is single-tenant: one shop, one admin. The setup wizard replaces the generic registration flow entirely.
|
||||
Berrypod is single-tenant: one shop, one admin. The setup wizard replaces the generic registration flow entirely.
|
||||
|
||||
### Fresh install flow
|
||||
|
||||
@@ -62,28 +62,28 @@ The setup wizard checks three things before allowing "go live":
|
||||
|
||||
| Step | How to check | Module/function |
|
||||
|------|-------------|-----------------|
|
||||
| Printify connected | `Products.get_provider_connection_by_type("printify")` returns a connection with a non-nil `api_key_encrypted` | `SimpleshopTheme.Products` |
|
||||
| Products synced | `Products.count_products_for_connection(conn.id) > 0` | `SimpleshopTheme.Products` |
|
||||
| Stripe connected | `Settings.has_secret?("stripe_api_key")` | `SimpleshopTheme.Settings` |
|
||||
| Printify connected | `Products.get_provider_connection_by_type("printify")` returns a connection with a non-nil `api_key_encrypted` | `Berrypod.Products` |
|
||||
| Products synced | `Products.count_products_for_connection(conn.id) > 0` | `Berrypod.Products` |
|
||||
| Stripe connected | `Settings.has_secret?("stripe_api_key")` | `Berrypod.Settings` |
|
||||
|
||||
Optional (nice-to-have, not blocking go-live):
|
||||
- Stripe webhook configured: `Settings.has_secret?("stripe_webhook_signing_secret")`
|
||||
- Shop name customised: `theme_settings.site_name != "SimpleShop"` (or similar default check)
|
||||
- Shop name customised: `theme_settings.site_name != "Berrypod"` (or similar default check)
|
||||
|
||||
## Changes
|
||||
|
||||
### 1. `Accounts.has_admin?/0` and registration lockdown
|
||||
|
||||
**File:** `lib/simpleshop_theme/accounts.ex`
|
||||
**File:** `lib/berrypod/accounts.ex`
|
||||
|
||||
- Add `has_admin?/0` — `Repo.exists?(User)` (any user = admin exists)
|
||||
- This is the single check that gates registration
|
||||
|
||||
**File:** `lib/simpleshop_theme_web/live/user_live/registration.ex`
|
||||
**File:** `lib/berrypod_web/live/user_live/registration.ex`
|
||||
|
||||
- In `mount/3`, check `Accounts.has_admin?()` — if true, redirect to `/users/log-in` with a flash like "Registration is closed"
|
||||
|
||||
**File:** `lib/simpleshop_theme_web/router.ex`
|
||||
**File:** `lib/berrypod_web/router.ex`
|
||||
|
||||
- No route changes needed yet — the LiveView mount handles the redirect
|
||||
|
||||
@@ -91,14 +91,14 @@ Optional (nice-to-have, not blocking go-live):
|
||||
|
||||
### 2. Add `site_live` setting and setup status
|
||||
|
||||
**File:** `lib/simpleshop_theme/settings.ex`
|
||||
**File:** `lib/berrypod/settings.ex`
|
||||
|
||||
- Add `site_live?/0` — reads `get_setting("shop", "site_live")`, returns boolean (default `false`)
|
||||
- Add `set_site_live/1` — writes `put_setting("shop", "site_live", value)`
|
||||
|
||||
No migration needed — settings table already stores arbitrary key/value pairs.
|
||||
|
||||
**File:** `lib/simpleshop_theme/setup.ex` (new module)
|
||||
**File:** `lib/berrypod/setup.ex` (new module)
|
||||
|
||||
- `setup_status/0` returns a map:
|
||||
```elixir
|
||||
@@ -118,24 +118,24 @@ No migration needed — settings table already stores arbitrary key/value pairs.
|
||||
|
||||
### 3. Fresh install redirect (no admin exists)
|
||||
|
||||
**File:** `lib/simpleshop_theme_web/hooks/theme_hook.ex`
|
||||
**File:** `lib/berrypod_web/hooks/theme_hook.ex`
|
||||
|
||||
ThemeHook already runs on every public shop page mount. Add early check:
|
||||
|
||||
- If `Accounts.has_admin?()` is false → redirect to `/setup`
|
||||
- This catches the fresh install case before any other logic runs
|
||||
|
||||
**File:** `lib/simpleshop_theme_web/live/setup_live.ex` (new)
|
||||
**File:** `lib/berrypod_web/live/setup_live.ex` (new)
|
||||
|
||||
A simple public LiveView at `/setup` that:
|
||||
- If admin already exists → redirect to `/users/log-in`
|
||||
- If no admin → show "Welcome to SimpleShop" with email input form
|
||||
- If no admin → show "Welcome to Berrypod" with email input form
|
||||
- On submit → calls `Accounts.register_user/1` and sends magic link
|
||||
- Shows "Check your email" confirmation
|
||||
|
||||
This reuses the existing registration logic but with a different UI (setup-focused, not generic registration).
|
||||
|
||||
**File:** `lib/simpleshop_theme_web/router.ex`
|
||||
**File:** `lib/berrypod_web/router.ex`
|
||||
|
||||
- Add `/setup` route in a minimal live_session (no ThemeHook, no CartHook — avoids the redirect loop)
|
||||
|
||||
@@ -143,20 +143,20 @@ This reuses the existing registration logic but with a different UI (setup-focus
|
||||
|
||||
### 4. "Coming soon" page for public visitors
|
||||
|
||||
**File:** `lib/simpleshop_theme_web/hooks/theme_hook.ex`
|
||||
**File:** `lib/berrypod_web/hooks/theme_hook.ex`
|
||||
|
||||
Extend the ThemeHook logic (after the fresh install check):
|
||||
|
||||
- If `site_live?()` is false AND user is not authenticated → redirect to `/coming-soon`
|
||||
|
||||
**File:** `lib/simpleshop_theme_web/live/shop_live/coming_soon.ex` (new)
|
||||
**File:** `lib/berrypod_web/live/shop_live/coming_soon.ex` (new)
|
||||
|
||||
Minimal LiveView:
|
||||
- Uses the shop root layout (gets theme styling) but no nav/footer
|
||||
- Shows site name/logo, "Coming soon" heading, optional tagline
|
||||
- No redirect loop — this page itself doesn't trigger the gate
|
||||
|
||||
**File:** `lib/simpleshop_theme_web/router.ex`
|
||||
**File:** `lib/berrypod_web/router.ex`
|
||||
|
||||
- Add `/coming-soon` route in the public shop live_session but mark it as exempt from the gate (via assign or separate handling in ThemeHook)
|
||||
|
||||
@@ -164,7 +164,7 @@ Minimal LiveView:
|
||||
|
||||
### 5. Admin setup checklist page
|
||||
|
||||
**File:** `lib/simpleshop_theme_web/live/admin/setup_live.ex` (new)
|
||||
**File:** `lib/berrypod_web/live/admin/setup_live.ex` (new)
|
||||
|
||||
Admin page at `/admin/setup` showing:
|
||||
|
||||
@@ -177,7 +177,7 @@ Admin page at `/admin/setup` showing:
|
||||
Each step shows what to do and links to where to do it. Feels like guided onboarding, not a settings dump.
|
||||
|
||||
**Files:**
|
||||
- `lib/simpleshop_theme_web/live/admin/setup_live.ex`
|
||||
- `lib/berrypod_web/live/admin/setup_live.ex`
|
||||
- Router update to add the route
|
||||
- Admin nav update to include "Setup" link (prominent when not live)
|
||||
|
||||
@@ -185,7 +185,7 @@ Each step shows what to do and links to where to do it. Feels like guided onboar
|
||||
|
||||
### 6. Admin bar "not live" indicator
|
||||
|
||||
**File:** `lib/simpleshop_theme_web/components/shop_components/layout.ex`
|
||||
**File:** `lib/berrypod_web/components/shop_components/layout.ex`
|
||||
|
||||
- When shop is not live, show a banner in the admin bar: "Your shop is not live — [Complete setup →]"
|
||||
- When shop is live, the setup page becomes a less prominent settings link
|
||||
@@ -194,7 +194,7 @@ Each step shows what to do and links to where to do it. Feels like guided onboar
|
||||
|
||||
### 7. Post-login redirect for fresh admin
|
||||
|
||||
**File:** `lib/simpleshop_theme_web/user_auth.ex`
|
||||
**File:** `lib/berrypod_web/user_auth.ex`
|
||||
|
||||
- After confirming magic link (first login ever), redirect to `/admin/setup` instead of `/`
|
||||
- Subsequent logins go to `/` as normal (or `/admin/setup` if not live yet)
|
||||
|
||||
Reference in New Issue
Block a user