From b40d0aedb443a2c56db91c5ede48866bc076fe39 Mon Sep 17 00:00:00 2001 From: Tim Howitz Date: Thu, 22 May 2025 17:59:48 +0100 Subject: [PATCH] Fixed a few small things --- src/app/our-mission/page.tsx | 8 ++++---- src/app/shop/page.tsx | 4 ++-- src/types/StoreModel.ts | 2 +- src/utils/maths.ts | 5 +++++ src/utils/parsingUtils.ts | 7 +++++++ src/utils/prisma.ts | 4 ++-- 6 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 src/utils/maths.ts create mode 100644 src/utils/parsingUtils.ts diff --git a/src/app/our-mission/page.tsx b/src/app/our-mission/page.tsx index 5fb10e1..3116340 100644 --- a/src/app/our-mission/page.tsx +++ b/src/app/our-mission/page.tsx @@ -1,11 +1,11 @@ "use client"; import Image from "next/image"; -const OurMission = () => { +function OurMission() { return (
{/* Overlay for Readability */}
@@ -55,5 +55,5 @@ const OurMission = () => {
); -}; +} export default OurMission; diff --git a/src/app/shop/page.tsx b/src/app/shop/page.tsx index d325b74..363d1e1 100644 --- a/src/app/shop/page.tsx +++ b/src/app/shop/page.tsx @@ -214,7 +214,7 @@ export default function Shop() { if (currentPage > 1) setCurrentPage((prev) => prev - 1); }; - function ArtefactCard({ artefact }: { artefact: Artefact }) { + function ArtefactCard({ artefact }: { artefact: ExtendedArtefact }) { return (
); } - function Modal({ artefact }: { artefact: Artefact }) { + function Modal({ artefact }: { artefact: ExtendedArtefact }) { if (!artefact) return null; const handleOverlayClick = (e: React.MouseEvent) => { if (e.target === e.currentTarget) setSelectedArtefact(null); diff --git a/src/types/StoreModel.ts b/src/types/StoreModel.ts index 3f1041b..ae98ddd 100644 --- a/src/types/StoreModel.ts +++ b/src/types/StoreModel.ts @@ -1,5 +1,5 @@ import { Action } from "easy-peasy"; -// import type { User } from "@prisma/client"; +// import type { User } from "@prismaclient"; import { User } from "@appTypes/Prisma"; type Currency = "GBP" | "USD" | "EUR"; diff --git a/src/utils/maths.ts b/src/utils/maths.ts new file mode 100644 index 0000000..3a9d0b2 --- /dev/null +++ b/src/utils/maths.ts @@ -0,0 +1,5 @@ +function getRandomNumber(min: number, max: number): number { + return Math.floor(Math.random() * (max - min + 1)) + min; +} + +export { getRandomNumber }; diff --git a/src/utils/parsingUtils.ts b/src/utils/parsingUtils.ts new file mode 100644 index 0000000..0cb211d --- /dev/null +++ b/src/utils/parsingUtils.ts @@ -0,0 +1,7 @@ +function stringToBool(val: string | undefined, defaultValue: boolean = false): boolean { + if (!val) return defaultValue; + const normalized = val.trim().toLowerCase(); + return normalized === "true" || normalized === "yes"; +} + +export { stringToBool }; diff --git a/src/utils/prisma.ts b/src/utils/prisma.ts index 93754e1..1ca360b 100644 --- a/src/utils/prisma.ts +++ b/src/utils/prisma.ts @@ -1,9 +1,9 @@ -import { PrismaClient } from "@prisma/client"; +import { PrismaClient } from "@prismaclient"; declare global { var prisma: PrismaClient | undefined; } -const prisma = process.env.NODE_ENV === "production" ? new PrismaClient() : global.prisma ?? (global.prisma = new PrismaClient()); +const prisma = new PrismaClient(); export { prisma };