admin dashboard
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"files": {
|
||||
"main.css": "/static/css/main.d82e9c4b.css",
|
||||
"main.js": "/static/js/main.38102cbe.js",
|
||||
"main.css": "/static/css/main.b06c2c93.css",
|
||||
"main.js": "/static/js/main.3d4be770.js",
|
||||
"index.html": "/index.html",
|
||||
"main.d82e9c4b.css.map": "/static/css/main.d82e9c4b.css.map",
|
||||
"main.38102cbe.js.map": "/static/js/main.38102cbe.js.map"
|
||||
"main.b06c2c93.css.map": "/static/css/main.b06c2c93.css.map",
|
||||
"main.3d4be770.js.map": "/static/js/main.3d4be770.js.map"
|
||||
},
|
||||
"entrypoints": [
|
||||
"static/css/main.d82e9c4b.css",
|
||||
"static/js/main.38102cbe.js"
|
||||
"static/css/main.b06c2c93.css",
|
||||
"static/js/main.3d4be770.js"
|
||||
]
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/images/logo.png" type="image/png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#8B4513"/><meta name="description" content="The Old Vine Hotel - Luxury accommodation with exceptional service and elegant amenities"/><meta name="keywords" content="hotel, luxury, accommodation, booking, old vine hotel, hospitality"/><meta property="og:title" content="The Old Vine Hotel - Luxury Accommodation"/><meta property="og:description" content="Experience luxury and elegance at The Old Vine Hotel. Book your perfect stay with us."/><meta property="og:type" content="website"/><meta property="og:url" content="https://oldvinehotel.com"/><meta property="og:image" content="/og-image.jpg"/><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=Calistoga&family=Montserrat:ital,wght@0,300;0,400;0,500;0,600;0,700;1,700&display=swap" rel="stylesheet"><link rel="apple-touch-icon" href="/images/logo.png"/><link rel="manifest" href="/manifest.json"/><title>The Old Vine Hotel - Luxury Accommodation</title><script defer="defer" src="/static/js/main.38102cbe.js"></script><link href="/static/css/main.d82e9c4b.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/images/logo.png" type="image/png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#8B4513"/><meta name="description" content="The Old Vine Hotel - Luxury accommodation with exceptional service and elegant amenities"/><meta name="keywords" content="hotel, luxury, accommodation, booking, old vine hotel, hospitality"/><meta property="og:title" content="The Old Vine Hotel - Luxury Accommodation"/><meta property="og:description" content="Experience luxury and elegance at The Old Vine Hotel. Book your perfect stay with us."/><meta property="og:type" content="website"/><meta property="og:url" content="https://oldvinehotel.com"/><meta property="og:image" content="/og-image.jpg"/><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=Calistoga&family=Montserrat:ital,wght@0,300;0,400;0,500;0,600;0,700;1,700&display=swap" rel="stylesheet"><link rel="apple-touch-icon" href="/images/logo.png"/><link rel="manifest" href="/manifest.json"/><title>The Old Vine Hotel - Luxury Accommodation</title><script defer="defer" src="/static/js/main.3d4be770.js"></script><link href="/static/css/main.b06c2c93.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
3
client/build/static/js/main.3d4be770.js
Normal file
3
client/build/static/js/main.3d4be770.js
Normal file
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
||||
import React, { Suspense } from 'react';
|
||||
import { Routes, Route } from 'react-router-dom';
|
||||
import { Routes, Route, Navigate } from 'react-router-dom';
|
||||
import { Box, CircularProgress } from '@mui/material';
|
||||
import { motion } from 'framer-motion';
|
||||
|
||||
@@ -93,6 +93,9 @@ function App() {
|
||||
</ProtectedRoute>
|
||||
}
|
||||
>
|
||||
{/* NEW: redirect /admin -> /admin/dashboard */}
|
||||
<Route index element={<Navigate to="dashboard" replace />} />
|
||||
|
||||
<Route path="dashboard" element={<DashboardMain />} />
|
||||
<Route path="content" element={<ContentManagement />} />
|
||||
<Route path="rooms" element={<RoomManagement />} />
|
||||
@@ -100,6 +103,8 @@ function App() {
|
||||
<Route path="blog" element={<BlogManagement />} />
|
||||
<Route path="media" element={<MediaManagement />} />
|
||||
<Route path="settings" element={<SettingsManagement />} />
|
||||
|
||||
{/* Optional fallback: keep if you want unknown admin routes to land on dashboard */}
|
||||
<Route path="*" element={<DashboardMain />} />
|
||||
</Route>
|
||||
</Routes>
|
||||
@@ -108,4 +113,4 @@ function App() {
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
export default App;
|
||||
|
||||
61
client/src/pages/admin/AdminApp.js
Normal file
61
client/src/pages/admin/AdminApp.js
Normal file
@@ -0,0 +1,61 @@
|
||||
import React from "react";
|
||||
import { Routes, Route, Navigate, Outlet, useLocation } from "react-router-dom";
|
||||
import { Box, CircularProgress } from "@mui/material";
|
||||
import { useAuth } from "../../context/AuthContext";
|
||||
|
||||
import Login from "./Login";
|
||||
import DashboardMain from "./DashboardMain";
|
||||
import ContentManagement from "./ContentManagement";
|
||||
import RoomManagement from "./RoomManagement";
|
||||
import BookingManagement from "./BookingManagement";
|
||||
import MediaManagement from "./MediaManagement";
|
||||
import BlogManagement from "./BlogManagement";
|
||||
import SettingsManagement from "./SettingsManagement";
|
||||
|
||||
function RequireAdmin({ children }) {
|
||||
const { isAuthenticated, initializing } = useAuth();
|
||||
const location = useLocation();
|
||||
|
||||
if (initializing) {
|
||||
return (
|
||||
<Box sx={{ minHeight: "60vh", display: "grid", placeItems: "center" }}>
|
||||
<CircularProgress />
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
if (!isAuthenticated) {
|
||||
return <Navigate to="/admin/login" replace state={{ from: location }} />;
|
||||
}
|
||||
|
||||
return children;
|
||||
}
|
||||
|
||||
function AdminShell() {
|
||||
return <Outlet />;
|
||||
}
|
||||
|
||||
export default function AdminApp() {
|
||||
return (
|
||||
<Routes>
|
||||
<Route path="login" element={<Login />} />
|
||||
|
||||
<Route
|
||||
element={
|
||||
<RequireAdmin>
|
||||
<AdminShell />
|
||||
</RequireAdmin>
|
||||
}
|
||||
>
|
||||
<Route index element={<Navigate to="dashboard" replace />} />
|
||||
<Route path="dashboard" element={<DashboardMain />} />
|
||||
<Route path="content" element={<ContentManagement />} />
|
||||
<Route path="rooms" element={<RoomManagement />} />
|
||||
<Route path="bookings" element={<BookingManagement />} />
|
||||
<Route path="media" element={<MediaManagement />} />
|
||||
<Route path="blog" element={<BlogManagement />} />
|
||||
<Route path="settings" element={<SettingsManagement />} />
|
||||
</Route>
|
||||
</Routes>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user