From f9736deab8b7b52f0657f4f8aa447fa4e011dac8 Mon Sep 17 00:00:00 2001 From: Che <30403707+Che-Zhu@users.noreply.github.com> Date: Mon, 19 Jan 2026 14:43:59 +0800 Subject: [PATCH 1/3] refactor: reorganize app directory with route groups and add error pages - Organize application routes into (auth) and (dashboard) groups - Add global error.tsx and not-found.tsx for better error handling - Move sealos-auth action to lib directory - Update references and imports --- app/{error => (auth)/auth-error}/page.tsx | 0 app/{ => (auth)}/login/page.tsx | 0 .../projects/[id]/auth/page.tsx | 0 .../[id]/database/connection-string.tsx | 0 .../projects/[id]/database/page.tsx | 0 .../projects/[id]/environment/page.tsx | 0 .../projects/[id]/exec-test/client.tsx | 0 .../projects/[id]/exec-test/page.tsx | 0 .../projects/[id]/github/page.tsx | 0 .../projects/[id]/layout.tsx | 0 app/{ => (dashboard)}/projects/[id]/page.tsx | 0 .../projects/[id]/payment/page.tsx | 0 .../projects/[id]/secrets/page.tsx | 0 .../projects/[id]/terminal/page.tsx | 0 app/{ => (dashboard)}/projects/page.tsx | 0 app/error.tsx | 88 +++++++++++++++++++ app/not-found.tsx | 64 ++++++++++++++ components/home-page.tsx | 2 +- {app => lib}/actions/sealos-auth.ts | 0 lib/auth.ts | 2 +- 20 files changed, 154 insertions(+), 2 deletions(-) rename app/{error => (auth)/auth-error}/page.tsx (100%) rename app/{ => (auth)}/login/page.tsx (100%) rename app/{ => (dashboard)}/projects/[id]/auth/page.tsx (100%) rename app/{ => (dashboard)}/projects/[id]/database/connection-string.tsx (100%) rename app/{ => (dashboard)}/projects/[id]/database/page.tsx (100%) rename app/{ => (dashboard)}/projects/[id]/environment/page.tsx (100%) rename app/{ => (dashboard)}/projects/[id]/exec-test/client.tsx (100%) rename app/{ => (dashboard)}/projects/[id]/exec-test/page.tsx (100%) rename app/{ => (dashboard)}/projects/[id]/github/page.tsx (100%) rename app/{ => (dashboard)}/projects/[id]/layout.tsx (100%) rename app/{ => (dashboard)}/projects/[id]/page.tsx (100%) rename app/{ => (dashboard)}/projects/[id]/payment/page.tsx (100%) rename app/{ => (dashboard)}/projects/[id]/secrets/page.tsx (100%) rename app/{ => (dashboard)}/projects/[id]/terminal/page.tsx (100%) rename app/{ => (dashboard)}/projects/page.tsx (100%) create mode 100644 app/error.tsx create mode 100644 app/not-found.tsx rename {app => lib}/actions/sealos-auth.ts (100%) diff --git a/app/error/page.tsx b/app/(auth)/auth-error/page.tsx similarity index 100% rename from app/error/page.tsx rename to app/(auth)/auth-error/page.tsx diff --git a/app/login/page.tsx b/app/(auth)/login/page.tsx similarity index 100% rename from app/login/page.tsx rename to app/(auth)/login/page.tsx diff --git a/app/projects/[id]/auth/page.tsx b/app/(dashboard)/projects/[id]/auth/page.tsx similarity index 100% rename from app/projects/[id]/auth/page.tsx rename to app/(dashboard)/projects/[id]/auth/page.tsx diff --git a/app/projects/[id]/database/connection-string.tsx b/app/(dashboard)/projects/[id]/database/connection-string.tsx similarity index 100% rename from app/projects/[id]/database/connection-string.tsx rename to app/(dashboard)/projects/[id]/database/connection-string.tsx diff --git a/app/projects/[id]/database/page.tsx b/app/(dashboard)/projects/[id]/database/page.tsx similarity index 100% rename from app/projects/[id]/database/page.tsx rename to app/(dashboard)/projects/[id]/database/page.tsx diff --git a/app/projects/[id]/environment/page.tsx b/app/(dashboard)/projects/[id]/environment/page.tsx similarity index 100% rename from app/projects/[id]/environment/page.tsx rename to app/(dashboard)/projects/[id]/environment/page.tsx diff --git a/app/projects/[id]/exec-test/client.tsx b/app/(dashboard)/projects/[id]/exec-test/client.tsx similarity index 100% rename from app/projects/[id]/exec-test/client.tsx rename to app/(dashboard)/projects/[id]/exec-test/client.tsx diff --git a/app/projects/[id]/exec-test/page.tsx b/app/(dashboard)/projects/[id]/exec-test/page.tsx similarity index 100% rename from app/projects/[id]/exec-test/page.tsx rename to app/(dashboard)/projects/[id]/exec-test/page.tsx diff --git a/app/projects/[id]/github/page.tsx b/app/(dashboard)/projects/[id]/github/page.tsx similarity index 100% rename from app/projects/[id]/github/page.tsx rename to app/(dashboard)/projects/[id]/github/page.tsx diff --git a/app/projects/[id]/layout.tsx b/app/(dashboard)/projects/[id]/layout.tsx similarity index 100% rename from app/projects/[id]/layout.tsx rename to app/(dashboard)/projects/[id]/layout.tsx diff --git a/app/projects/[id]/page.tsx b/app/(dashboard)/projects/[id]/page.tsx similarity index 100% rename from app/projects/[id]/page.tsx rename to app/(dashboard)/projects/[id]/page.tsx diff --git a/app/projects/[id]/payment/page.tsx b/app/(dashboard)/projects/[id]/payment/page.tsx similarity index 100% rename from app/projects/[id]/payment/page.tsx rename to app/(dashboard)/projects/[id]/payment/page.tsx diff --git a/app/projects/[id]/secrets/page.tsx b/app/(dashboard)/projects/[id]/secrets/page.tsx similarity index 100% rename from app/projects/[id]/secrets/page.tsx rename to app/(dashboard)/projects/[id]/secrets/page.tsx diff --git a/app/projects/[id]/terminal/page.tsx b/app/(dashboard)/projects/[id]/terminal/page.tsx similarity index 100% rename from app/projects/[id]/terminal/page.tsx rename to app/(dashboard)/projects/[id]/terminal/page.tsx diff --git a/app/projects/page.tsx b/app/(dashboard)/projects/page.tsx similarity index 100% rename from app/projects/page.tsx rename to app/(dashboard)/projects/page.tsx diff --git a/app/error.tsx b/app/error.tsx new file mode 100644 index 0000000..0b77ad4 --- /dev/null +++ b/app/error.tsx @@ -0,0 +1,88 @@ +'use client'; + +import { useEffect } from 'react'; +import { AlertCircle, Home,RefreshCw } from 'lucide-react'; +import Link from 'next/link'; + +import { Button } from '@/components/ui/button'; + +export default function Error({ + error, + reset, +}: { + error: Error & { digest?: string }; + reset: () => void; +}) { + useEffect(() => { + // Log the error to an error reporting service + console.error('Application error:', error); + }, [error]); + + return ( +
+ An unexpected error occurred. Please try again or return to the home page. +
++ If this problem persists, please{' '} + + open an issue + + {' '}on GitHub. +
++ The page you're looking for doesn't exist or has been moved. +
++ Check the URL for typos, or use the navigation above to find what you need. +
+