mirror of
https://github.com/lobehub/lobe-chat.git
synced 2026-06-14 03:30:19 +00:00
2253d46ee0
This implements Phase 3 of LOBE-2850, establishing a dual routing architecture
for the Next.js to Vite React Router SPA migration.
## Changes
### New wrapper modules
- `src/libs/next/` - Next.js wrappers for auth pages (Link, Image, navigation, dynamic)
- `src/libs/router/` - React Router wrappers for SPA routes (Link, navigation hooks)
### Link component updates
- External links (`http://`, `https://`) → native `<a>` tags
- SPA internal routes → React Router `<Link>`
- Auth pages → Next.js `<Link>` (preserved)
- Global `src/components/Link.tsx` → smart component for ConfigProvider
### Navigation hook updates
- SPA routes use `@/libs/router/navigation` (useRouter, usePathname, useSearchParams)
- Auth pages use `@/libs/next/navigation`
- GlobalProvider uses `window.location` (outside Router context)
### Architecture
```
GlobalProvider (no Router context)
└── AppTheme + ConfigProvider
├── Auth pages (Next.js routing)
└── SPA Router (BrowserRouter)
└── SPA pages (React Router)
```
Resolves LOBE-2850
13 lines
294 B
TypeScript
13 lines
294 B
TypeScript
import { notFound } from '@/libs/next/navigation';
|
|
import { type PropsWithChildren } from 'react';
|
|
|
|
import { enableBetterAuth } from '@/envs/auth';
|
|
|
|
const Layout = ({ children }: PropsWithChildren) => {
|
|
if (!enableBetterAuth) return notFound();
|
|
|
|
return children;
|
|
};
|
|
|
|
export default Layout;
|