45 | {`This document was last updated on ${new Intl.DateTimeFormat(undefined, { 46 | year: 'numeric', 47 | month: 'long', 48 | day: 'numeric' 49 | }).format(new Date(page.updatedAt))}.`} 50 |
51 | > 52 | ); 53 | } 54 | -------------------------------------------------------------------------------- /app/api/revalidate/route.ts: -------------------------------------------------------------------------------- 1 | import { revalidate } from 'lib/medusa'; 2 | import { NextRequest, NextResponse } from 'next/server'; 3 | 4 | export const runtime = 'edge'; 5 | 6 | export async function POST(req: NextRequest): Promise8 | There was an issue with our storefront. This could be a temporary issue, please try your 9 | action again. 10 |
11 | 17 |{`No products found in this collection`}
42 | ) : ( 43 |28 | {products.length === 0 29 | ? 'There are no products that match ' 30 | : `Showing ${products.length} ${resultsText} for `} 31 | "{searchValue}" 32 |
33 | ) : null} 34 | {products.length > 0 ? ( 35 |{title}
23 |15 | {`${new Intl.NumberFormat(undefined, { 16 | style: 'currency', 17 | currency: currencyCode, 18 | currencyDisplay: 'narrowSymbol' 19 | }).format(parseFloat(amount))}`} 20 | {`${currencyCode}`} 21 |
22 | ); 23 | 24 | export default Price; 25 | -------------------------------------------------------------------------------- /components/product/gallery.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | import { ArrowLeftIcon, ArrowRightIcon } from '@heroicons/react/24/outline'; 4 | import { GridTileImage } from 'components/grid/tile'; 5 | import { createUrl } from 'lib/utils'; 6 | import Image from 'next/image'; 7 | import Link from 'next/link'; 8 | import { usePathname, useSearchParams } from 'next/navigation'; 9 | 10 | export function Gallery({ images }: { images: { src: string; altText: string }[] }) { 11 | const pathname = usePathname(); 12 | const searchParams = useSearchParams(); 13 | const imageSearchParam = searchParams.get('image'); 14 | const imageIndex = imageSearchParam ? parseInt(imageSearchParam) : 0; 15 | 16 | const nextSearchParams = new URLSearchParams(searchParams.toString()); 17 | const nextImageIndex = imageIndex + 1 < images.length ? imageIndex + 1 : 0; 18 | nextSearchParams.set('image', nextImageIndex.toString()); 19 | const nextUrl = createUrl(pathname, nextSearchParams); 20 | 21 | const previousSearchParams = new URLSearchParams(searchParams.toString()); 22 | const previousImageIndex = imageIndex === 0 ? images.length - 1 : imageIndex - 1; 23 | previousSearchParams.set('image', previousImageIndex.toString()); 24 | const previousUrl = createUrl(pathname, previousSearchParams); 25 | 26 | const buttonClassName = 27 | 'h-full px-6 transition-all ease-in-out hover:scale-110 hover:text-black dark:hover:text-white flex items-center justify-center'; 28 | 29 | return ( 30 | <> 31 |