Separate CP admin panel into independent Vite project at /cp/
- New /cp/ Vite project with own package.json, Dockerfile, tailwind config - Migrated CpLoginPage, CpLayout, AdminDashboard → cp/src/ (self-contained) - cp/src/lib/utils.ts has only what CP needs (cn, PLAN_LABELS, PLAN_COLORS) - cp/src/data/mockData.ts has Hotel/User types and mock data - cp/ builds to nginx static container (hotelsync-cp) - docker-compose.yml: added cp service - nginx: added cp.hotelsync.ru → hotelsync-cp:80 (SSL block ready for certbot) - deploy.yml: builds hotelsync-cp:latest and restarts container on push - Cleaned src/App.tsx: removed IS_CP branch, CpLoginPage/CpLayout/AdminDashboard imports Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
31
cp/src/App.tsx
Normal file
31
cp/src/App.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'
|
||||
import { LoginPage } from './pages/LoginPage'
|
||||
import { CpLayout } from './layouts/CpLayout'
|
||||
import { Dashboard } from './pages/Dashboard'
|
||||
|
||||
function CpGuard({ children }: { children: React.ReactNode }) {
|
||||
const auth = localStorage.getItem('cpAuth')
|
||||
if (!auth) return <Navigate to="/login" replace />
|
||||
return <>{children}</>
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<BrowserRouter>
|
||||
<Routes>
|
||||
<Route path="/login" element={<LoginPage />} />
|
||||
|
||||
<Route element={<CpGuard><CpLayout /></CpGuard>}>
|
||||
<Route path="/" element={<Dashboard />} />
|
||||
<Route path="/hotels" element={<Dashboard />} />
|
||||
<Route path="/cp-users" element={<Dashboard />} />
|
||||
<Route path="/billing" element={<Dashboard />} />
|
||||
<Route path="/monitoring" element={<Dashboard />} />
|
||||
<Route path="/cp-settings" element={<Dashboard />} />
|
||||
</Route>
|
||||
|
||||
<Route path="*" element={<Navigate to="/" replace />} />
|
||||
</Routes>
|
||||
</BrowserRouter>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user