From c83fcdaa4a067196d95dc555b538351ce5181201 Mon Sep 17 00:00:00 2001 From: w3bdesign <45217974+w3bdesign@users.noreply.github.com> Date: Thu, 13 Feb 2025 03:57:17 +0100 Subject: [PATCH 1/2] Prettier --- .../Product/ProductCard.component.tsx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/components/Product/ProductCard.component.tsx b/src/components/Product/ProductCard.component.tsx index 77f535b57..03cbf2903 100644 --- a/src/components/Product/ProductCard.component.tsx +++ b/src/components/Product/ProductCard.component.tsx @@ -1,5 +1,6 @@ import Link from 'next/link'; import Image from 'next/image'; + import { paddedPrice } from '@/utils/functions/functions'; interface ProductCardProps { @@ -27,8 +28,12 @@ const ProductCard = ({ }: ProductCardProps) => { // Add padding/empty character after currency symbol const formattedPrice = price ? paddedPrice(price, 'kr') : price; - const formattedRegularPrice = regularPrice ? paddedPrice(regularPrice, 'kr') : regularPrice; - const formattedSalePrice = salePrice ? paddedPrice(salePrice, 'kr') : salePrice; + const formattedRegularPrice = regularPrice + ? paddedPrice(regularPrice, 'kr') + : regularPrice; + const formattedSalePrice = salePrice + ? paddedPrice(salePrice, 'kr') + : salePrice; return (
@@ -134,7 +125,7 @@ const DisplayProducts = ({ products }: IDisplayProductsProps) => (
{name}
diff --git a/src/pages/produkt/[slug].tsx b/src/pages/produkt/[slug].tsx
index 711da637c..d1971373f 100644
--- a/src/pages/produkt/[slug].tsx
+++ b/src/pages/produkt/[slug].tsx
@@ -9,19 +9,18 @@ import Layout from '@/components/Layout/Layout.component';
import client from '@/utils/apollo/ApolloClient';
// Types
-import type {
- NextPage,
- GetServerSideProps,
- InferGetServerSidePropsType,
-} from 'next';
+import type { NextPage, GetServerSideProps, InferGetServerSidePropsType } from 'next';
// GraphQL
import { GET_SINGLE_PRODUCT } from '@/utils/gql/GQL_QUERIES';
/**
- * Display a single product with dynamic pretty urls
+ * Display a single product with dynamic pretty URLs.
+ * This implementation removes unnecessary query parameters for SEO purposes,
+ * and uses the product slug to search for the product. If an "id" is present in the query,
+ * it redirects to a URL without the id.
* @function Produkt
- * @param {InferGetServerSidePropsType