Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a not found page #593

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@ import './index.css';
import MainRoutes from './containers/Routes';
import LandingPage from './pages/Home';
import { TraineesProvider } from './hook/useTraineesData';
import NotFound from './components/NotFoundPage';

function App() {
return (
<div className="min-h-screen">

<TicketsProvider>
<TraineesProvider>
<Router>
<ScrollToTop>
<Routes>
<Route path="/" element={<LandingPage />} />
<Route path="/*" element={<MainRoutes />} />
<Route path="*" element={<NotFound />} />
</Routes>
</ScrollToTop>
</Router>
Expand Down
19 changes: 19 additions & 0 deletions src/components/NotFoundPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

import React from 'react';
import { Link } from 'react-router-dom';

const NotFound=() => {
return (
<div className="flex items-center justify-center h-screen bg-gray-100">
<div className="text-center">
<h1 className="text-4xl font-bold text-red-600">404</h1>
<p className="text-lg text-gray-700 mt-4">Page not found</p>
<Link to="/" className="mt-6 inline-block px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600">
Go Back Home
</Link>
</div>
</div>
);
};

export default NotFound;
2 changes: 2 additions & 0 deletions src/containers/DashRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import PrivateRoute from '../utils/PrivateRoute';
import Square from '../Skeletons/Square';
import MenuProvider, { MenuContext } from '../hook/menuProvider';
import CheckRole from '../utils/CheckRoles';
import NotFound from '../components/NotFoundPage';

const Dashboard = React.lazy(() => import('../pages/Dashboard'));
const Settings = React.lazy(() => import('../pages/Settings'));
Expand Down Expand Up @@ -166,6 +167,7 @@ function DashRoutes() {
<Route path="/team-cards" element={<ManagersCards />} />
<Route path="/teams/cards" element={<CoordinatorCards />} />
<Route path="/ttl-trainees" element={<TtlTraineeDashboard />} />
<Route path="*" element={<NotFound />} />
</Routes>
</Suspense>
</main>
Expand Down
3 changes: 2 additions & 1 deletion src/containers/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import ProtectedRoutes from '../ProtectedRoute';
import RemoveTokenPage from '../utils/RemoveTokenPage';
import PrivateRoute from '../utils/PrivateRoute'
import CalendarConfirmation from '../components/CalendarConfirmation';
import NotFound from '../components/NotFoundPage';

function MainRoutes() {
return (
Expand Down Expand Up @@ -170,7 +171,7 @@ function MainRoutes() {
}>
</Route>
</Route>
<Route path="*" element={<Error />} />
<Route path="*" element={<NotFound />} />
</Routes>
</Suspense>
</div>
Expand Down
Loading