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

Added error page when link is not found #97

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions client/src/containers/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import BasicModal from "../components/PeopleComponents/PopupModal";
import MyInfoHome from "./MyInfoHome";
import ReportsMain from "../components/reports/ReportsMain"
import { EmployeeProvider } from '../components/myinfo/EmployeeContext';
import ErrorPage from "../../../src/components/Error/ErrorPage";
lakshmi0605 marked this conversation as resolved.
Show resolved Hide resolved

export default function Dashboard(props) {
const { email } = props;
Expand Down Expand Up @@ -78,6 +79,7 @@ export default function Dashboard(props) {
<Route path="/reporting" element={<ReportsMain title={"Reporting page"} />} />
<Route path="/settings" element={<Home title={"Settings page"} />} />
<Route path="/support" element={<Home title={"Support page"} />} />
<Route path="*" element={<ErrorPage />} />
lakshmi0605 marked this conversation as resolved.
Show resolved Hide resolved
</Routes>
</Box>
</Stack>
Expand Down
58 changes: 58 additions & 0 deletions src/components/Error/ErrorPage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import React from 'react';
import Button from '@mui/material/Button';
import { useNavigate } from 'react-router-dom';


const ErrorPage = () => {
const navigate = useNavigate();

const handleClick = () => {
navigate('/'); // Change to dashboard
};

return (
<div style={{
display:"flex",
alignItems:"center",
justifyContent:"center",
flexDirection:"column",
height: '100vh',
}}>
lakshmi0605 marked this conversation as resolved.
Show resolved Hide resolved
<p style={{
fontSize: "16px",
fontWeight: "600",
lineHeight: "38px",
textAlign: "left",
margin:"5px 0px",
}}>We cannot find this page</p>
<p style={{
fontSize: "13px",
fontWeight: "400",
lineHeight: "23px",
margin:"10px 0px",
}}>Either the URL doesn't exist, or you don't have access to it</p>
lakshmi0605 marked this conversation as resolved.
Show resolved Hide resolved
<Button
onClick={handleClick}
sx={{
width: "214px",
height: "34px",
border: "1px solid #7F56D9",
backgroundColor: "#7F56D9",
color:"#FFFFFF",
fontSize: 13,
fontWeight: 400,
textTransform: "none",
padding:"10px auto",
boxShadow: '0px 1px 2px 0px #1018280D',
margin:"45px 0px",
"&:hover": {
backgroundColor: "#602ece",
border: "1px solid #602ece",
},
}}
>Go to the main dashboard</Button>
lakshmi0605 marked this conversation as resolved.
Show resolved Hide resolved
</div>
)
}

export default ErrorPage