Skip to content

Commit 6d95df7

Browse files
authored
Merge pull request #164 from sathwikhbhat/issue-162-add-404-page
feat: add custom 404 NotFound component and route (fixes #162)
2 parents 066b17e + fe773be commit 6d95df7

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

frontend/src/App.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import TransactionsPage from './pages/TransactionsPage';
99
import ReceiptsPage from './pages/ReceiptsPage';
1010
import WelcomePage from './pages/WelcomePage';
1111
import SettingsPage from './pages/SettingsPage';
12+
import NotFound from './pages/NotFound';
1213
import Budgets from './pages/Budgets';
1314
import ContactUs from './pages/ContactUs';
1415
import Layout from './components/Layout';
@@ -52,6 +53,7 @@ function App() {
5253
element={<RecurringTransactions />}
5354
/>
5455
</Route>
56+
<Route path="*" element={<NotFound />} />
5557
</Routes>
5658
<ToastContainer />
5759
</>

frontend/src/pages/NotFound.jsx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import React from 'react';
2+
import { Link } from 'react-router-dom';
3+
import ThemeToggle from '../components/ThemeToggle';
4+
5+
export default function NotFound() {
6+
return (
7+
<div className="min-h-screen bg-gray-50 dark:bg-gray-900 text-gray-800 dark:text-gray-200 font-montserrat">
8+
<header className="py-4 px-8 flex justify-between items-center bg-white dark:bg-gray-800 shadow-md">
9+
<Link to="/" className="text-2xl font-bold text-blue-600 dark:text-blue-400">Paisable</Link>
10+
<div className="flex items-center gap-4">
11+
<ThemeToggle />
12+
</div>
13+
</header>
14+
15+
<main className="flex items-center justify-center px-4 py-20">
16+
<div className="max-w-3xl w-full text-center">
17+
<div className="inline-flex items-center justify-center w-28 h-28 rounded-full bg-gradient-to-br from-pink-100 via-sky-100 to-purple-100 mx-auto mb-8">
18+
<svg className="w-16 h-16 text-pink-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
19+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M9.75 9.75l4.5 4.5M14.25 9.75l-4.5 4.5" />
20+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M12 21c4.97 0 9-4.03 9-9s-4.03-9-9-9-9 4.03-9 9 4.03 9 9 9z" />
21+
</svg>
22+
</div>
23+
24+
<h1 className="text-4xl md:text-5xl font-extrabold mb-4">Page not found</h1>
25+
<p className="text-lg md:text-xl text-gray-600 dark:text-gray-300 mb-8">
26+
Oops — the page you're looking for doesn't exist or has been moved.
27+
</p>
28+
29+
<div className="flex flex-col sm:flex-row items-center justify-center gap-4">
30+
<Link to="/" className="inline-block bg-blue-600 text-white px-6 py-3 rounded-lg font-semibold hover:bg-blue-700">
31+
Go to Homepage
32+
</Link>
33+
<Link to="/contact" className="inline-block text-gray-700 dark:text-gray-200 px-4 py-2 rounded-lg hover:underline">
34+
Contact Support
35+
</Link>
36+
</div>
37+
</div>
38+
</main>
39+
</div>
40+
);
41+
}

0 commit comments

Comments
 (0)