diff --git a/web/src/app/(dashboard)/backfill/page.tsx b/web/src/app/dashboard/backfill/page.tsx similarity index 100% rename from web/src/app/(dashboard)/backfill/page.tsx rename to web/src/app/dashboard/backfill/page.tsx diff --git a/web/src/app/(dashboard)/events/page.tsx b/web/src/app/dashboard/events/page.tsx similarity index 100% rename from web/src/app/(dashboard)/events/page.tsx rename to web/src/app/dashboard/events/page.tsx diff --git a/web/src/app/(dashboard)/layout.tsx b/web/src/app/dashboard/layout.tsx similarity index 100% rename from web/src/app/(dashboard)/layout.tsx rename to web/src/app/dashboard/layout.tsx diff --git a/web/src/app/(dashboard)/lexicons/[id]/lexicon-detail.tsx b/web/src/app/dashboard/lexicons/[id]/lexicon-detail.tsx similarity index 97% rename from web/src/app/(dashboard)/lexicons/[id]/lexicon-detail.tsx rename to web/src/app/dashboard/lexicons/[id]/lexicon-detail.tsx index 5ce49e0..7e8a4f3 100644 --- a/web/src/app/(dashboard)/lexicons/[id]/lexicon-detail.tsx +++ b/web/src/app/dashboard/lexicons/[id]/lexicon-detail.tsx @@ -122,7 +122,7 @@ export default function LexiconDetailPage() { } else { await deleteLexicon(getToken, lexicon.id); } - router.push("/lexicons"); + router.push("/dashboard/lexicons"); } catch (e: unknown) { setError(e instanceof Error ? e.message : String(e)); setDeleting(false); @@ -132,7 +132,7 @@ export default function LexiconDetailPage() { if (error && !lexicon) { return ( <> - +

{error}

@@ -143,7 +143,7 @@ export default function LexiconDetailPage() { if (!lexicon) { return ( <> - +

Loading...

@@ -161,7 +161,7 @@ export default function LexiconDetailPage() { return (
- +
{error &&

{error}

} diff --git a/web/src/app/(dashboard)/lexicons/[id]/page.tsx b/web/src/app/dashboard/lexicons/[id]/page.tsx similarity index 100% rename from web/src/app/(dashboard)/lexicons/[id]/page.tsx rename to web/src/app/dashboard/lexicons/[id]/page.tsx diff --git a/web/src/app/(dashboard)/lexicons/new/page.tsx b/web/src/app/dashboard/lexicons/new/page.tsx similarity index 98% rename from web/src/app/(dashboard)/lexicons/new/page.tsx rename to web/src/app/dashboard/lexicons/new/page.tsx index c7f77a3..215286d 100644 --- a/web/src/app/(dashboard)/lexicons/new/page.tsx +++ b/web/src/app/dashboard/lexicons/new/page.tsx @@ -30,7 +30,7 @@ export default function AddLexiconPage() { // Redirect if the user cannot create lexicons useEffect(() => { if (!hasPermission("lexicons:create")) { - router.replace("/lexicons"); + router.replace("/dashboard/lexicons"); } }, [hasPermission, router]); @@ -137,7 +137,7 @@ export default function AddLexiconPage() { backfill: localMainType === "record" && backfill, script: showScript && script ? script : undefined, }); - router.push("/lexicons"); + router.push("/dashboard/lexicons"); } catch (e: unknown) { setError(e instanceof Error ? e.message : String(e)); setSubmitting(false); @@ -154,7 +154,7 @@ export default function AddLexiconPage() { ? networkTargetCollection || undefined : undefined, }); - router.push("/lexicons"); + router.push("/dashboard/lexicons"); } catch (e: unknown) { setError(e instanceof Error ? e.message : String(e)); setSubmitting(false); @@ -163,7 +163,7 @@ export default function AddLexiconPage() { return ( <> - +
e.stopPropagation()} > @@ -217,7 +217,7 @@ export default function LexiconsPage() { asChild > e.stopPropagation()} > @@ -294,13 +294,13 @@ export default function LexiconsPage() { - router.push(`/lexicons/${encodeURIComponent(lex.id)}`) + router.push(`/dashboard/lexicons/${encodeURIComponent(lex.id)}`) } > {hasPermission("lexicons:create") && ( )} diff --git a/web/src/app/(dashboard)/page.tsx b/web/src/app/dashboard/page.tsx similarity index 100% rename from web/src/app/(dashboard)/page.tsx rename to web/src/app/dashboard/page.tsx diff --git a/web/src/app/(dashboard)/records/page.tsx b/web/src/app/dashboard/records/page.tsx similarity index 100% rename from web/src/app/(dashboard)/records/page.tsx rename to web/src/app/dashboard/records/page.tsx diff --git a/web/src/app/(dashboard)/settings/api-keys/page.tsx b/web/src/app/dashboard/settings/api-keys/page.tsx similarity index 100% rename from web/src/app/(dashboard)/settings/api-keys/page.tsx rename to web/src/app/dashboard/settings/api-keys/page.tsx diff --git a/web/src/app/(dashboard)/settings/env-variables/page.tsx b/web/src/app/dashboard/settings/env-variables/page.tsx similarity index 100% rename from web/src/app/(dashboard)/settings/env-variables/page.tsx rename to web/src/app/dashboard/settings/env-variables/page.tsx diff --git a/web/src/app/(dashboard)/settings/page.tsx b/web/src/app/dashboard/settings/page.tsx similarity index 75% rename from web/src/app/(dashboard)/settings/page.tsx rename to web/src/app/dashboard/settings/page.tsx index 1cc771f..a2c245f 100644 --- a/web/src/app/(dashboard)/settings/page.tsx +++ b/web/src/app/dashboard/settings/page.tsx @@ -11,11 +11,11 @@ export default function SettingsPage() { useEffect(() => { if (hasPermission("users:read")) { - router.replace("/settings/users"); + router.replace("/dashboard/settings/users"); } else if (hasPermission("script-variables:read")) { - router.replace("/settings/env-variables"); + router.replace("/dashboard/settings/env-variables"); } else if (hasPermission("api-keys:read")) { - router.replace("/settings/api-keys"); + router.replace("/dashboard/settings/api-keys"); } }, [router, hasPermission]); diff --git a/web/src/app/(dashboard)/settings/users/page.tsx b/web/src/app/dashboard/settings/users/page.tsx similarity index 100% rename from web/src/app/(dashboard)/settings/users/page.tsx rename to web/src/app/dashboard/settings/users/page.tsx diff --git a/web/src/app/(dashboard)/users/page.tsx b/web/src/app/dashboard/users/page.tsx similarity index 81% rename from web/src/app/(dashboard)/users/page.tsx rename to web/src/app/dashboard/users/page.tsx index 5e474bf..6515757 100644 --- a/web/src/app/(dashboard)/users/page.tsx +++ b/web/src/app/dashboard/users/page.tsx @@ -6,7 +6,7 @@ import { useRouter } from "next/navigation"; export default function UsersRedirect() { const router = useRouter(); useEffect(() => { - router.replace("/settings/users"); + router.replace("/dashboard/settings/users"); }, [router]); return null; } diff --git a/web/src/app/login/page.tsx b/web/src/app/login/page.tsx index 3b33708..113fc06 100644 --- a/web/src/app/login/page.tsx +++ b/web/src/app/login/page.tsx @@ -10,7 +10,7 @@ export default function LoginPage() { const router = useRouter() useEffect(() => { - if (did) router.replace("/") + if (did) router.replace("/dashboard") }, [did, router]) if (did) return null diff --git a/web/src/app/page.tsx b/web/src/app/page.tsx new file mode 100644 index 0000000..f0e942d --- /dev/null +++ b/web/src/app/page.tsx @@ -0,0 +1,12 @@ +"use client"; + +import { useEffect } from "react"; +import { useRouter } from "next/navigation"; + +export default function RootRedirect() { + const router = useRouter(); + useEffect(() => { + router.replace("/dashboard"); + }, [router]); + return null; +} diff --git a/web/src/components/app-sidebar.tsx b/web/src/components/app-sidebar.tsx index 5cecd50..228c9d5 100644 --- a/web/src/components/app-sidebar.tsx +++ b/web/src/components/app-sidebar.tsx @@ -40,17 +40,17 @@ import { } from "@/components/ui/sidebar" const navItems = [ - { title: "Dashboard", url: "/", icon: IconDashboard }, - { title: "Lexicons", url: "/lexicons", icon: IconFileDescription }, - { title: "Backfill", url: "/backfill", icon: IconDatabase }, - { title: "Records", url: "/records", icon: IconTable }, - { title: "Event Logs", url: "/events", icon: IconClipboardList, requiredPermissions: ["events:read"] }, + { title: "Dashboard", url: "/dashboard", icon: IconDashboard }, + { title: "Lexicons", url: "/dashboard/lexicons", icon: IconFileDescription }, + { title: "Backfill", url: "/dashboard/backfill", icon: IconDatabase }, + { title: "Records", url: "/dashboard/records", icon: IconTable }, + { title: "Event Logs", url: "/dashboard/events", icon: IconClipboardList, requiredPermissions: ["events:read"] }, ] as const const settingsSubItems = [ - { title: "Users", url: "/settings/users", icon: IconUsers, requiredPermissions: ["users:read"] }, - { title: "ENV Variables", url: "/settings/env-variables", icon: IconVariable, requiredPermissions: ["script-variables:read"] }, - { title: "API Keys", url: "/settings/api-keys", icon: IconKey, requiredPermissions: ["api-keys:read"] }, + { title: "Users", url: "/dashboard/settings/users", icon: IconUsers, requiredPermissions: ["users:read"] }, + { title: "ENV Variables", url: "/dashboard/settings/env-variables", icon: IconVariable, requiredPermissions: ["script-variables:read"] }, + { title: "API Keys", url: "/dashboard/settings/api-keys", icon: IconKey, requiredPermissions: ["api-keys:read"] }, ] as const export function AppSidebar({ @@ -69,7 +69,7 @@ export function AppSidebar({ item.requiredPermissions.some((perm) => hasPermission(perm)) ) - const isSettingsActive = pathname.startsWith("/settings") + const isSettingsActive = pathname.startsWith("/dashboard/settings") return ( @@ -99,8 +99,8 @@ export function AppSidebar({ asChild tooltip={item.title} isActive={ - item.url === "/" - ? pathname === "/" + item.url === "/dashboard" + ? pathname === "/dashboard" : pathname.startsWith(item.url) } >