Task not found page
This commit is contained in:
1 parent
e5e565430c
commit
84d1382cb4
2 files changed
+33
-1
No files matched your search
@@ -13,6 +13,7 @@ import {
|
|||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { UserContext } from "../contexts/userContext";
|
import { UserContext } from "../contexts/userContext";
|
||||||
import type { User } from "../utils/types";
|
import type { User } from "../utils/types";
|
||||||
|
import TaskNotFound from "./TaskNotFound";
|
||||||
|
|
||||||
const TaskDetail: React.FC = () => {
|
const TaskDetail: React.FC = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -26,7 +27,7 @@ const TaskDetail: React.FC = () => {
|
|||||||
|
|
||||||
const taskInQuestion = tasks.find((task) => task.id === numerizedTaskId);
|
const taskInQuestion = tasks.find((task) => task.id === numerizedTaskId);
|
||||||
|
|
||||||
if (!taskInQuestion) return <div>Task not found</div>;
|
if (!taskInQuestion) return <TaskNotFound/>;
|
||||||
|
|
||||||
let userInQuestion: User | undefined;
|
let userInQuestion: User | undefined;
|
||||||
if (users && !loading) {
|
if (users && !loading) {
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Card,
|
||||||
|
CardContent,
|
||||||
|
CardHeader,
|
||||||
|
Stack,
|
||||||
|
Typography,
|
||||||
|
} from "@mui/material";
|
||||||
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
|
|
||||||
|
const TaskNotFound: React.FC = () => {
|
||||||
|
const { taskId } = useParams();
|
||||||
|
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card>
|
||||||
|
<CardHeader title="Not found!" />
|
||||||
|
<CardContent>
|
||||||
|
<Stack spacing={2}>
|
||||||
|
<Typography>Task #{taskId} not found</Typography>
|
||||||
|
<Button variant="outlined" onClick={() => navigate("/")}>
|
||||||
|
Go back home
|
||||||
|
</Button>
|
||||||
|
</Stack>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default TaskNotFound;
|
||||||
Reference in new issue
Block a user