Skip to content

Commit e0bfd77

Browse files
committed
Added a 404 page to handle routing to questions not in the database..
1 parent 70ab5ab commit e0bfd77

File tree

5 files changed

+46
-1
lines changed

5 files changed

+46
-1
lines changed
133 KB
Binary file not shown.

src/app/globals.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@tailwind base;
22
@tailwind components;
33
@tailwind utilities;
4-
4+
@import url("https://fonts.googleapis.com/css2?family=Sedgwick+Ave+Display&display=swap");
55
html,
66
body {
77
padding: 0;
@@ -23,6 +23,10 @@ a {
2323
font-family: "burtons";
2424
src: url("../../public/Burtons.otf");
2525
}
26+
@font-face {
27+
font-family: "Sedgwick Ave Display";
28+
src: url("../../public/SedgwickAveDisplay-Regular.ttf");
29+
}
2630

2731
p {
2832
margin-bottom: 1rem;
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
"use client";
2+
import { Chip } from "@material-tailwind/react";
3+
import Image from "next/image";
4+
import Link from "next/link";
5+
import { AiFillHome } from "react-icons/ai";
6+
7+
export default function FourOhFour() {
8+
return (
9+
<div className="flex-col w-full mx-auto box-border min-h-[100vh] items-center text-center justify-center">
10+
<div>
11+
<div className="px-4 mx-auto">
12+
<div className="mt-[10em] -mx-4 relative min-h-[1px] px-4">
13+
<div class="flex min-h-[1px] px-4 justify-center items-center mx-auto mb-4">
14+
<strong className="font-sedgwick text-9xl">404</strong>
15+
</div>
16+
17+
<div class="min-h-[1px] px-4 msg">
18+
<h2>
19+
<strong>Page Not Found</strong>
20+
</h2>
21+
<p>Sorry, but that question has not yet been developed...</p>
22+
<br />
23+
<Link href="/" className="text-center">
24+
<Chip
25+
value="Back to Questions"
26+
className="text-primary-800 dark:text-primary-100 bg-inherit border-[#ccc]"
27+
icon={
28+
<AiFillHome className="text-primary-800 dark:text-primary-100 text-lg" />
29+
}
30+
/>
31+
</Link>
32+
</div>
33+
</div>
34+
</div>
35+
</div>
36+
</div>
37+
);
38+
}

src/app/questions/[qid]/page.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ import { getQuestion, getSimilarQuestions } from "@/utils/controllers";
22
import QuestionNavigator from "./QuestionNavigator";
33
import { QuestionBody } from "./QuestionBody";
44
import { SolutionWrapper } from "./SolutionWrapper";
5+
import { notFound } from "next/navigation";
56

67
export default async function QuestionsPage({ params: { qid } }) {
78
const { data } = await getQuestion(qid);
9+
if (data.length === 0) notFound();
810
const { data: similarQuestions } = await getSimilarQuestions(qid);
911
return (
1012
<div className="flex-col w-full mx-auto">

tailwind.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ module.exports = withMT({
1414
extend: {
1515
fontFamily: {
1616
burtons: "burtons",
17+
sedgwick: "Sedgwick Ave Display",
1718
},
1819
colors: {
1920
primary: {

0 commit comments

Comments
 (0)