diff --git a/src/app/@modal/default.tsx b/src/app/@modal/default.tsx index 52d3cd6..b6b97f6 100644 --- a/src/app/@modal/default.tsx +++ b/src/app/@modal/default.tsx @@ -1,9 +1,5 @@ +import { DiscNotFound } from "@components"; + export default function Default() { - return ( -
-
-

Disc not found!

-
-
- ); + return ; } diff --git a/src/components/DiscDetail.tsx b/src/components/DiscDetail.tsx index 8b3c6a2..8bb19b7 100644 --- a/src/components/DiscDetail.tsx +++ b/src/components/DiscDetail.tsx @@ -45,9 +45,11 @@ export const DiscDetail = ({ name_slug }: DiscDetailProps) => { {fade} -
- {name} -
+ {pic && ( +
+ {name} +
+ )} ); diff --git a/src/components/DiscNotFound.tsx b/src/components/DiscNotFound.tsx new file mode 100644 index 0000000..bc57a5d --- /dev/null +++ b/src/components/DiscNotFound.tsx @@ -0,0 +1,19 @@ +"use client"; + +import { useParams } from "next/navigation"; +import { useContext } from "react"; + +import { DiscContext } from "@components"; + +export const DiscNotFound = () => { + const { name_slug } = useParams(); + const { discs } = useContext(DiscContext); + if (!name_slug || discs.find(disc => disc.name_slug === name_slug)) return null; + return ( +
+
+
Disc not found!
+
+
+ ); +}; diff --git a/src/components/index.ts b/src/components/index.ts index 27f54a6..1d5a602 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -5,6 +5,7 @@ export * from "./DiscCount"; export * from "./DiscDetail"; export * from "./DiscGrid"; export * from "./DiscModal"; +export * from "./DiscNotFound"; export * from "./Filters"; export * from "./Header"; export * from "./Home";