From 84d1382cb4486c501848eb29d86e260be29fbae1 Mon Sep 17 00:00:00 2001 From: Thastertyn Date: Mon, 23 Jun 2025 09:20:37 +0200 Subject: [PATCH] Task not found page --- src/components/TaskDetail.tsx | 3 ++- src/components/TaskNotFound.tsx | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/components/TaskNotFound.tsx diff --git a/src/components/TaskDetail.tsx b/src/components/TaskDetail.tsx index 1323b75..c19bba5 100644 --- a/src/components/TaskDetail.tsx +++ b/src/components/TaskDetail.tsx @@ -13,6 +13,7 @@ import { } from "@mui/material"; import { UserContext } from "../contexts/userContext"; import type { User } from "../utils/types"; +import TaskNotFound from "./TaskNotFound"; const TaskDetail: React.FC = () => { const navigate = useNavigate(); @@ -26,7 +27,7 @@ const TaskDetail: React.FC = () => { const taskInQuestion = tasks.find((task) => task.id === numerizedTaskId); - if (!taskInQuestion) return
Task not found
; + if (!taskInQuestion) return ; let userInQuestion: User | undefined; if (users && !loading) { diff --git a/src/components/TaskNotFound.tsx b/src/components/TaskNotFound.tsx new file mode 100644 index 0000000..00a24b8 --- /dev/null +++ b/src/components/TaskNotFound.tsx @@ -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 ( + + + + + Task #{taskId} not found + + + + + ); +}; + +export default TaskNotFound;