mirror of
https://github.com/dong-nz/cv.git
synced 2026-11-22 16:10:40 +07:00
Typewriter reads useReducedMotion: under reduced motion the timer never starts and the first role renders whole, while a screen-reader-only span exposes the full role list once instead of one keystroke at a time. BackToTop scrolls instantly under reduced motion and is labelled in the active language; the nav landmark and the mode toggle stop being English-only. The hero photo declares its measured 1200x1600 canvas plus fetch priority so the box is reserved before the 898 kB image decodes. HomePage stays eagerly imported because it owns the LCP; the other six routes lazy-load behind one Suspense boundary, which is also why the pages barrel is gone.
45 lines
2.1 KiB
TypeScript
45 lines
2.1 KiB
TypeScript
import './App.css'
|
|
import { lazy, Suspense } from 'react'
|
|
import { BrowserRouter, Routes, Route } from 'react-router'
|
|
import { ThemeProvider } from '@/hooks/useTheme'
|
|
import { Layout } from '@/components/layout/Layout'
|
|
import { LanguageProvider } from '@/hooks/useLanguage'
|
|
import { HomePage } from '@/pages/HomePage'
|
|
|
|
// HomePage stays eager: it is the landing route and owns the LCP, so its code must
|
|
// already be in the entry chunk. The other six split out and load on navigation.
|
|
const AboutPage = lazy(() => import('@/pages/AboutPage').then((m) => ({ default: m.AboutPage })))
|
|
const ExperiencePage = lazy(() => import('@/pages/ExperiencePage').then((m) => ({ default: m.ExperiencePage })))
|
|
const ProjectsListPage = lazy(() => import('@/pages/ProjectsListPage').then((m) => ({ default: m.ProjectsListPage })))
|
|
const ProjectDetailPage = lazy(() => import('@/pages/ProjectDetailPage').then((m) => ({ default: m.ProjectDetailPage })))
|
|
const PhilosophyPage = lazy(() => import('@/pages/PhilosophyPage').then((m) => ({ default: m.PhilosophyPage })))
|
|
const ContactPage = lazy(() => import('@/pages/ContactPage').then((m) => ({ default: m.ContactPage })))
|
|
|
|
function App() {
|
|
return (
|
|
<BrowserRouter>
|
|
<ThemeProvider>
|
|
<LanguageProvider>
|
|
<Layout>
|
|
{/* A null fallback keeps the shell (nav, footer) painted without reserving a
|
|
box that would shift the page when the route chunk lands. */}
|
|
<Suspense fallback={null}>
|
|
<Routes>
|
|
<Route path="/" element={<HomePage />} />
|
|
<Route path="/about" element={<AboutPage />} />
|
|
<Route path="/experience" element={<ExperiencePage />} />
|
|
<Route path="/projects" element={<ProjectsListPage />} />
|
|
<Route path="/projects/:id" element={<ProjectDetailPage />} />
|
|
<Route path="/philosophy" element={<PhilosophyPage />} />
|
|
<Route path="/contact" element={<ContactPage />} />
|
|
</Routes>
|
|
</Suspense>
|
|
</Layout>
|
|
</LanguageProvider>
|
|
</ThemeProvider>
|
|
</BrowserRouter>
|
|
)
|
|
}
|
|
|
|
export default App
|