From 0f4f5a79df41e03462740b567f9689788883ebdc Mon Sep 17 00:00:00 2001 From: olivermrbl Date: Mon, 1 May 2023 14:46:17 +0200 Subject: [PATCH 01/34] Initial commit --- app/[page]/page.tsx | 7 +- app/product/[handle]/page.tsx | 6 +- app/sitemap.ts | 10 +- components/grid/three-items.tsx | 6 +- components/layout/footer.tsx | 4 +- components/layout/navbar/index.tsx | 4 +- lib/shopify/index.ts | 335 +++++------------------------ 7 files changed, 68 insertions(+), 304 deletions(-) diff --git a/app/[page]/page.tsx b/app/[page]/page.tsx index 7e0defed3..37ebb0b04 100644 --- a/app/[page]/page.tsx +++ b/app/[page]/page.tsx @@ -1,7 +1,6 @@ import type { Metadata } from 'next'; import Prose from 'components/prose'; -import { getPage } from 'lib/shopify'; import { notFound } from 'next/navigation'; export const runtime = 'edge'; @@ -13,7 +12,8 @@ export async function generateMetadata({ }: { params: { page: string }; }): Promise { - const page = await getPage(params.page); + console.log(params); + const page: any = null; if (!page) return notFound(); @@ -36,7 +36,8 @@ export async function generateMetadata({ } export default async function Page({ params }: { params: { page: string } }) { - const page = await getPage(params.page); + console.log(params); + const page: any = null; if (!page) return notFound(); diff --git a/app/product/[handle]/page.tsx b/app/product/[handle]/page.tsx index 612cd0236..1b1eb4821 100644 --- a/app/product/[handle]/page.tsx +++ b/app/product/[handle]/page.tsx @@ -10,7 +10,7 @@ import { Gallery } from 'components/product/gallery'; import { VariantSelector } from 'components/product/variant-selector'; import Prose from 'components/prose'; import { HIDDEN_PRODUCT_TAG } from 'lib/constants'; -import { getProduct, getProductRecommendations } from 'lib/shopify'; +import { getProduct } from 'lib/shopify'; import { Image } from 'lib/shopify/types'; export const runtime = 'edge'; @@ -97,7 +97,9 @@ export default async function ProductPage({ params }: { params: { handle: string } async function RelatedProducts({ id }: { id: string }) { - const relatedProducts = await getProductRecommendations(id); + console.log(id); + // const relatedProducts = await getProductRecommendations(id); + const relatedProducts: any[] = []; if (!relatedProducts.length) return null; diff --git a/app/sitemap.ts b/app/sitemap.ts index 1a0fd8232..f4745dbc9 100644 --- a/app/sitemap.ts +++ b/app/sitemap.ts @@ -1,4 +1,4 @@ -import { getCollections, getPages, getProducts } from 'lib/shopify'; +import { getCollections, getProducts } from 'lib/shopify'; import { MetadataRoute } from 'next'; const baseUrl = process.env.NEXT_PUBLIC_VERCEL_URL @@ -23,11 +23,5 @@ export default async function sitemap(): Promise ({ - url: `${baseUrl}/${page.handle}`, - lastModified: page.updatedAt - })); - - return [...routesMap, ...collectionsMap, ...productsMap, ...pagesMap]; + return [...routesMap, ...collectionsMap, ...productsMap]; } diff --git a/components/grid/three-items.tsx b/components/grid/three-items.tsx index 6814a171a..f4d99df80 100644 --- a/components/grid/three-items.tsx +++ b/components/grid/three-items.tsx @@ -41,13 +41,13 @@ export async function ThreeItemGrid() { if (!homepageItems[0] || !homepageItems[1] || !homepageItems[2]) return null; - const [firstProduct, secondProduct, thirdProduct] = homepageItems; + // const [firstProduct, secondProduct, thirdProduct] = homepageItems; return (
- + {/* - + */}
); } diff --git a/components/layout/footer.tsx b/components/layout/footer.tsx index 72e9e03fc..6d80c8fbc 100644 --- a/components/layout/footer.tsx +++ b/components/layout/footer.tsx @@ -3,7 +3,6 @@ import Link from 'next/link'; import GitHubIcon from 'components/icons/github'; import LogoIcon from 'components/icons/logo'; import VercelIcon from 'components/icons/vercel'; -import { getMenu } from 'lib/shopify'; import { Menu } from 'lib/shopify/types'; const { SITE_NAME } = process.env; @@ -11,7 +10,8 @@ const { SITE_NAME } = process.env; export default async function Footer() { const currentYear = new Date().getFullYear(); const copyrightDate = 2023 + (currentYear > 2023 ? `-${currentYear}` : ''); - const menu = await getMenu('next-js-frontend-footer-menu'); + // const menu = await getMenu('next-js-frontend-footer-menu'); + const menu: any[] = []; return (