구조 개편 4단계: routes/ 신설 + App.jsx 단순화
- routes/pc.jsx: 기존 App.jsx의 Route 정의를 추출 - routes/mobile.jsx: 모바일 placeholder (준비 중 안내) - App.jsx는 디바이스 분기 자리만 남김 (현재 PCRoutes만 렌더) - react-device-detect 도입 준비 완료 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
444cf8cf85
commit
1ad25630bf
3 changed files with 59 additions and 28 deletions
|
|
@ -1,31 +1,5 @@
|
|||
import { Routes, Route } from 'react-router-dom'
|
||||
import Layout from './components/pc/Layout'
|
||||
import Home from './pages/pc/Home'
|
||||
import FeaturePage from './features/FeaturePage'
|
||||
import AdminLayout from './features/admin/pc/AdminLayout'
|
||||
import AdminHome from './features/admin/pc/AdminHome'
|
||||
import AdminImages from './features/admin/pc/AdminImages'
|
||||
import AdminMenuForm from './features/admin/pc/AdminMenuForm'
|
||||
import AdminFeaturePage from './features/admin/pc/AdminFeaturePage'
|
||||
import PCRoutes from './routes/pc'
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<Routes>
|
||||
<Route element={<Layout />}>
|
||||
<Route index element={<Home />} />
|
||||
|
||||
{/* 관리자 */}
|
||||
<Route path="/admin" element={<AdminLayout />}>
|
||||
<Route index element={<AdminHome />} />
|
||||
<Route path="images" element={<AdminImages />} />
|
||||
<Route path="menus/new" element={<AdminMenuForm />} />
|
||||
<Route path="menus/:id" element={<AdminMenuForm />} />
|
||||
<Route path=":slug/*" element={<AdminFeaturePage />} />
|
||||
</Route>
|
||||
|
||||
{/* 동적 기능 페이지 */}
|
||||
<Route path="/:slug/*" element={<FeaturePage />} />
|
||||
</Route>
|
||||
</Routes>
|
||||
)
|
||||
return <PCRoutes />
|
||||
}
|
||||
|
|
|
|||
26
frontend/src/routes/mobile.jsx
Normal file
26
frontend/src/routes/mobile.jsx
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { Routes, Route } from 'react-router-dom'
|
||||
|
||||
/**
|
||||
* 모바일 라우트 (placeholder)
|
||||
* 추후 MobileLayout, 기능별 모바일 페이지 등록 예정
|
||||
*/
|
||||
export default function MobileRoutes() {
|
||||
return (
|
||||
<Routes>
|
||||
<Route
|
||||
path="*"
|
||||
element={
|
||||
<div
|
||||
className="min-h-screen flex items-center justify-center p-6 text-center"
|
||||
style={{ color: 'var(--text-muted)' }}
|
||||
>
|
||||
<div>
|
||||
<div className="text-4xl mb-3 opacity-50">📱</div>
|
||||
<p className="text-sm">모바일 버전은 준비 중입니다</p>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</Routes>
|
||||
)
|
||||
}
|
||||
31
frontend/src/routes/pc.jsx
Normal file
31
frontend/src/routes/pc.jsx
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import { Routes, Route } from 'react-router-dom'
|
||||
import Layout from '../components/pc/Layout'
|
||||
import Home from '../pages/pc/Home'
|
||||
import FeaturePage from '../features/FeaturePage'
|
||||
import AdminLayout from '../features/admin/pc/AdminLayout'
|
||||
import AdminHome from '../features/admin/pc/AdminHome'
|
||||
import AdminImages from '../features/admin/pc/AdminImages'
|
||||
import AdminMenuForm from '../features/admin/pc/AdminMenuForm'
|
||||
import AdminFeaturePage from '../features/admin/pc/AdminFeaturePage'
|
||||
|
||||
export default function PCRoutes() {
|
||||
return (
|
||||
<Routes>
|
||||
<Route element={<Layout />}>
|
||||
<Route index element={<Home />} />
|
||||
|
||||
{/* 관리자 */}
|
||||
<Route path="/admin" element={<AdminLayout />}>
|
||||
<Route index element={<AdminHome />} />
|
||||
<Route path="images" element={<AdminImages />} />
|
||||
<Route path="menus/new" element={<AdminMenuForm />} />
|
||||
<Route path="menus/:id" element={<AdminMenuForm />} />
|
||||
<Route path=":slug/*" element={<AdminFeaturePage />} />
|
||||
</Route>
|
||||
|
||||
{/* 동적 기능 페이지 */}
|
||||
<Route path="/:slug/*" element={<FeaturePage />} />
|
||||
</Route>
|
||||
</Routes>
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue