Skip to content

Commit b8b0905

Browse files
authored
Merge pull request #89 from ungdev:feat/page-404
feat(frontend): add 404 page layout
2 parents c3a37c9 + 3c0677c commit b8b0905

2 files changed

Lines changed: 62 additions & 0 deletions

File tree

frontend/src/App.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import { PlanningsPage } from './pages/plannings';
4040
import { Roadbook } from './pages/roadbook';
4141
import { PrivacyPage } from './pages/privacy';
4242
import { LegalsPage } from './pages/legals';
43+
import { NotFoundPage } from './pages/notFound';
4344

4445

4546
const App: React.FC = () => {
@@ -107,6 +108,9 @@ const App: React.FC = () => {
107108
<Route path="/admin/games" element={<AdminRoute><AdminPageGames /></AdminRoute>} />
108109
<Route path="/admin/tent" element={<AdminRoute><AdminPageTent /></AdminRoute>} />
109110
<Route path="/admin/bus" element={<AdminRoute><AdminPageBus /></AdminRoute>} />
111+
112+
{/* Fallback */}
113+
<Route path="*" element={<NotFoundPage />} />
110114
</Routes>
111115
</Router>
112116

frontend/src/pages/notFound.tsx

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import { Link } from "react-router-dom";
2+
import { Navbar } from "../components/navbar";
3+
import { Footer } from "../components/footer";
4+
import { getToken } from "../services/requests/auth.service";
5+
import { Card, CardContent, CardHeader, CardTitle } from "../components/ui/card";
6+
7+
export const NotFoundPage = () => {
8+
const isAuthenticated = Boolean(getToken());
9+
10+
return (
11+
<div className="min-h-screen flex flex-col">
12+
<Navbar />
13+
14+
<main
15+
className="relative flex-1 flex items-center justify-center bg-no-repeat bg-cover bg-center px-4"
16+
style={{ backgroundImage: "url('img/bg_25.jpg')" }}
17+
>
18+
<div className="absolute inset-0 bg-black/55" aria-hidden="true"></div>
19+
20+
<Card className="relative z-10 w-full max-w-xl text-center shadow-lg">
21+
<CardHeader>
22+
<p className="text-sm font-semibold text-blue-700">Erreur 404</p>
23+
<CardTitle className="mt-2 text-3xl font-bold text-gray-900">
24+
Page introuvable
25+
</CardTitle>
26+
</CardHeader>
27+
28+
<CardContent>
29+
<p className="text-gray-600">
30+
Oups, la page que tu cherches n'existe pas ou a été déplacée.
31+
</p>
32+
33+
<div className="mt-8 flex justify-center gap-3">
34+
35+
{isAuthenticated ? (
36+
<Link
37+
to="/home"
38+
className="rounded-md bg-blue-600 px-5 py-2.5 font-medium text-white transition hover:bg-blue-700"
39+
>
40+
Retour à l'accueil
41+
</Link>
42+
) : (
43+
<Link
44+
to="/"
45+
className="rounded-md bg-blue-600 px-5 py-2.5 font-medium text-white transition hover:bg-blue-700"
46+
>
47+
Se connecter
48+
</Link>
49+
)}
50+
</div>
51+
</CardContent>
52+
</Card>
53+
</main>
54+
55+
<Footer />
56+
</div>
57+
);
58+
};

0 commit comments

Comments
 (0)