From 1294cacaaff91bdd8d788996a19f9fb6e7b62aa3 Mon Sep 17 00:00:00 2001 From: Pratham271 Date: Fri, 4 Oct 2024 14:17:47 +0530 Subject: [PATCH 1/3] added the custom not found page --- app/not-found.tsx | 94 ++++++++++++++++++++ pages/404.tsx | 34 ------- pages/view/[linkId]/index.tsx | 2 +- pages/view/domains/[domain]/[slug]/index.tsx | 2 +- 4 files changed, 96 insertions(+), 36 deletions(-) create mode 100644 app/not-found.tsx delete mode 100644 pages/404.tsx diff --git a/app/not-found.tsx b/app/not-found.tsx new file mode 100644 index 000000000..5215f6051 --- /dev/null +++ b/app/not-found.tsx @@ -0,0 +1,94 @@ +'use client' + +import { useState } from 'react' +import Link from 'next/link' +import { motion } from 'framer-motion' +import { Search, Home, Book, Users } from 'lucide-react' + +export default function NotFound() { + const [searchQuery, setSearchQuery] = useState('') + + const handleSearch = (e: React.FormEvent) => { + e.preventDefault() + // Implement search functionality here + // console.log('Searching for:', searchQuery) + } + + const paperVariants = { + initial: { y: -100, opacity: 0 }, + animate: { y: 0, opacity: 1, transition: { type: 'spring', stiffness: 100 } }, + } + + return ( +
+ + + + + + + +

404

+

Page Not Found

+ +
+
+ setSearchQuery(e.target.value)} + className="w-full px-4 py-2 rounded-full border-2 border-blue-300 focus:outline-none focus:border-blue-500 pr-10" + /> + +
+
+ +
+ + + Home + + + + Documents + + + + Settings + +
+ +

+ We couldn't find the page you were looking for. It might have been removed, renamed, or doesn't exist. +

+ +
+

© {new Date().getFullYear()} Papermark.io. All rights reserved.

+
+
+ ) +} \ No newline at end of file diff --git a/pages/404.tsx b/pages/404.tsx deleted file mode 100644 index 3d4cc6832..000000000 --- a/pages/404.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import Link from "next/link"; - -export default function NotFound({ message }: { message?: string }) { - return ( - <> -
-
-
-
-

- 404 error -

-

- Page not found. -

-

- {message || - "Sorry, we couldn’t find the page you’re looking for."} -

-
- - Go back home - -
-
-
-
-
- - ); -} diff --git a/pages/view/[linkId]/index.tsx b/pages/view/[linkId]/index.tsx index be2f90f40..5be6d6f21 100644 --- a/pages/view/[linkId]/index.tsx +++ b/pages/view/[linkId]/index.tsx @@ -3,7 +3,7 @@ import { useRouter } from "next/router"; import { useEffect, useState } from "react"; -import NotFound from "@/pages/404"; +import NotFound from "@/app/not-found"; import { Brand, DataroomBrand } from "@prisma/client"; import Cookies from "js-cookie"; import { useSession } from "next-auth/react"; diff --git a/pages/view/domains/[domain]/[slug]/index.tsx b/pages/view/domains/[domain]/[slug]/index.tsx index 9f20fb0d7..16e779f4c 100644 --- a/pages/view/domains/[domain]/[slug]/index.tsx +++ b/pages/view/domains/[domain]/[slug]/index.tsx @@ -3,7 +3,7 @@ import { useRouter } from "next/router"; import { useEffect, useState } from "react"; -import NotFound from "@/pages/404"; +import NotFound from "@/app/not-found"; import { Brand, DataroomBrand } from "@prisma/client"; import Cookies from "js-cookie"; import { useSession } from "next-auth/react"; From 7abc5d427c07d6ca1aa7a0f9dec6f1f2c207edc4 Mon Sep 17 00:00:00 2001 From: Pratham271 Date: Fri, 11 Oct 2024 14:36:12 +0530 Subject: [PATCH 2/3] solved the bug for view and other pages directory --- app/not-found.tsx | 5 ++- pages/404.tsx | 95 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+), 2 deletions(-) create mode 100644 pages/404.tsx diff --git a/app/not-found.tsx b/app/not-found.tsx index 5215f6051..8bc51b9c7 100644 --- a/app/not-found.tsx +++ b/app/not-found.tsx @@ -5,7 +5,7 @@ import Link from 'next/link' import { motion } from 'framer-motion' import { Search, Home, Book, Users } from 'lucide-react' -export default function NotFound() { +export default function NotFound({ message }: { message?: string }) { const [searchQuery, setSearchQuery] = useState('') const handleSearch = (e: React.FormEvent) => { @@ -83,7 +83,8 @@ export default function NotFound() {

- We couldn't find the page you were looking for. It might have been removed, renamed, or doesn't exist. + {message || + "Sorry, we couldn’t find the page you’re looking for."}

) -} \ No newline at end of file +}