Remove /settings page and redirect / to first org dashboard
- Delete unused /settings route - Update root page to redirect authenticated users to their first org - Falls back to /dashboard if user has no orgs Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,20 +1,38 @@
|
||||
<script lang="ts">
|
||||
import { Loader2 } from "@lucide/svelte";
|
||||
import { createQuery } from "@tanstack/svelte-query";
|
||||
import { goto } from "$app/navigation";
|
||||
import { api } from "$lib/api/client";
|
||||
|
||||
/**
|
||||
* Root page - redirects to first org dashboard or org list
|
||||
*/
|
||||
|
||||
const orgsQuery = createQuery(() => ({
|
||||
queryKey: ["orgs"],
|
||||
queryFn: () => api.orgs.list(),
|
||||
}));
|
||||
|
||||
$effect(() => {
|
||||
if (orgsQuery.error) {
|
||||
// Not authenticated, redirect to login
|
||||
goto(`/auth/login?redirect=${encodeURIComponent("/")}`);
|
||||
} else if (orgsQuery.data) {
|
||||
if (orgsQuery.data.length > 0) {
|
||||
// Redirect to first org's dashboard
|
||||
goto(`/dashboard/${orgsQuery.data[0].slug}`, { replaceState: true });
|
||||
} else {
|
||||
// No orgs, show org list (empty state)
|
||||
goto("/dashboard", { replaceState: true });
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Publisher Dashboard</title>
|
||||
</svelte:head>
|
||||
|
||||
<div class="space-y-6">
|
||||
<h1 class="text-3xl font-bold tracking-tight">Publisher Dashboard</h1>
|
||||
<p class="text-muted-foreground">Welcome to the Publisher Dashboard</p>
|
||||
|
||||
<nav class="flex gap-4">
|
||||
<a
|
||||
href="/settings"
|
||||
class="text-primary underline-offset-4 hover:underline"
|
||||
>
|
||||
Settings
|
||||
</a>
|
||||
</nav>
|
||||
<div class="flex min-h-screen items-center justify-center">
|
||||
<Loader2 class="h-8 w-8 animate-spin text-muted-foreground" />
|
||||
</div>
|
||||
|
||||
@@ -16,8 +16,8 @@ import {
|
||||
} from "$lib/components/ui/card";
|
||||
import { Input } from "$lib/components/ui/input";
|
||||
import { Label } from "$lib/components/ui/label";
|
||||
import { PhoneNumberInput } from "$lib/components/ui/phone-number-input";
|
||||
import { LoadingButton } from "$lib/components/ui/loading-button";
|
||||
import { PhoneNumberInput } from "$lib/components/ui/phone-number-input";
|
||||
import { Separator } from "$lib/components/ui/separator";
|
||||
import { cn } from "$lib/utils";
|
||||
import { validatePhone } from "$lib/utils/validation";
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
<svelte:head>
|
||||
<title>Settings - Publisher Dashboard</title>
|
||||
</svelte:head>
|
||||
|
||||
<div class="space-y-6">
|
||||
<h1 class="text-3xl font-bold tracking-tight">Settings</h1>
|
||||
<p class="text-muted-foreground">Configure your publisher settings here.</p>
|
||||
|
||||
<nav>
|
||||
<a href="/" class="text-primary underline-offset-4 hover:underline">
|
||||
Back to Home
|
||||
</a>
|
||||
</nav>
|
||||
</div>
|
||||
Reference in New Issue
Block a user