mirror of
https://github.com/vercel/commerce.git
synced 2025-07-26 19:51:23 +00:00
Merge branch 'main' of https://github.com/vercel/commerce into vercel-main
This commit is contained in:
35
pages/404.tsx
Normal file
35
pages/404.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
import type { GetStaticPropsContext } from 'next'
|
||||
import commerce from '@lib/api/commerce'
|
||||
import { Layout } from '@components/common'
|
||||
import { Text } from '@components/ui'
|
||||
|
||||
export async function getStaticProps({
|
||||
preview,
|
||||
locale,
|
||||
locales,
|
||||
}: GetStaticPropsContext) {
|
||||
const config = { locale, locales }
|
||||
const { pages } = await commerce.getAllPages({ config, preview })
|
||||
const { categories, brands } = await commerce.getSiteInfo({ config, preview })
|
||||
return {
|
||||
props: {
|
||||
pages,
|
||||
categories,
|
||||
brands,
|
||||
},
|
||||
revalidate: 200,
|
||||
}
|
||||
}
|
||||
|
||||
export default function NotFound() {
|
||||
return (
|
||||
<div className="max-w-2xl mx-8 sm:mx-auto py-20 flex flex-col items-center justify-center fit">
|
||||
<Text variant="heading">Not Found</Text>
|
||||
<Text className="">
|
||||
The requested page doesn't exist or you don't have access to it.
|
||||
</Text>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
NotFound.Layout = Layout
|
@@ -1,12 +1,11 @@
|
||||
import '@assets/main.css'
|
||||
import 'keen-slider/keen-slider.min.css'
|
||||
import '@assets/chrome-bug.css'
|
||||
import 'keen-slider/keen-slider.min.css'
|
||||
|
||||
import { FC, useEffect } from 'react'
|
||||
import type { AppProps } from 'next/app'
|
||||
|
||||
import { ManagedUIContext } from '@components/ui/context'
|
||||
import { Head } from '@components/common'
|
||||
import { ManagedUIContext } from '@components/ui/context'
|
||||
|
||||
const Noop: FC = ({ children }) => <>{children}</>
|
||||
|
||||
|
@@ -1,3 +0,0 @@
|
||||
import cartApi from '@framework/api/cart'
|
||||
|
||||
export default cartApi()
|
@@ -1,3 +0,0 @@
|
||||
import catalogProductsApi from '@framework/api/catalog/products'
|
||||
|
||||
export default catalogProductsApi()
|
@@ -1,3 +0,0 @@
|
||||
import checkoutApi from '@framework/api/checkout'
|
||||
|
||||
export default checkoutApi()
|
@@ -1,3 +0,0 @@
|
||||
import customersApi from '@framework/api/customers'
|
||||
|
||||
export default customersApi()
|
@@ -1,3 +0,0 @@
|
||||
import loginApi from '@framework/api/customers/login'
|
||||
|
||||
export default loginApi()
|
@@ -1,3 +0,0 @@
|
||||
import logoutApi from '@framework/api/customers/logout'
|
||||
|
||||
export default logoutApi()
|
@@ -1,3 +0,0 @@
|
||||
import signupApi from '@framework/api/customers/signup'
|
||||
|
||||
export default signupApi()
|
@@ -1,3 +0,0 @@
|
||||
import wishlistApi from '@framework/api/wishlist'
|
||||
|
||||
export default wishlistApi()
|
4
pages/api/cart.ts
Normal file
4
pages/api/cart.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import cartApi from '@framework/api/endpoints/cart'
|
||||
import commerce from '@lib/api/commerce'
|
||||
|
||||
export default cartApi(commerce)
|
4
pages/api/catalog/products.ts
Normal file
4
pages/api/catalog/products.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import productsApi from '@framework/api/endpoints/catalog/products'
|
||||
import commerce from '@lib/api/commerce'
|
||||
|
||||
export default productsApi(commerce)
|
4
pages/api/checkout.ts
Normal file
4
pages/api/checkout.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import checkoutApi from '@framework/api/endpoints/checkout'
|
||||
import commerce from '@lib/api/commerce'
|
||||
|
||||
export default checkoutApi(commerce)
|
4
pages/api/customer.ts
Normal file
4
pages/api/customer.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import customerApi from '@framework/api/endpoints/customer'
|
||||
import commerce from '@lib/api/commerce'
|
||||
|
||||
export default customerApi(commerce)
|
4
pages/api/login.ts
Normal file
4
pages/api/login.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import loginApi from '@framework/api/endpoints/login'
|
||||
import commerce from '@lib/api/commerce'
|
||||
|
||||
export default loginApi(commerce)
|
4
pages/api/logout.ts
Normal file
4
pages/api/logout.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import logoutApi from '@framework/api/endpoints/logout'
|
||||
import commerce from '@lib/api/commerce'
|
||||
|
||||
export default logoutApi(commerce)
|
4
pages/api/signup.ts
Normal file
4
pages/api/signup.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import singupApi from '@framework/api/endpoints/signup'
|
||||
import commerce from '@lib/api/commerce'
|
||||
|
||||
export default singupApi(commerce)
|
4
pages/api/wishlist.ts
Normal file
4
pages/api/wishlist.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import wishlistApi from '@framework/api/endpoints/wishlist'
|
||||
import commerce from '@lib/api/commerce'
|
||||
|
||||
export default wishlistApi(commerce)
|
@@ -1,2 +1,94 @@
|
||||
|
||||
//this is just a pointer to the catch-all route and logic for all CMS driven pages (i.e. even rootpage is dynamic from the CMS)
|
||||
export { default, getStaticProps } from './[...slug]';
|
||||
export { default, getStaticProps } from './[...slug]';
|
||||
|
||||
// import commerce from '@lib/api/commerce'
|
||||
// import { Layout } from '@components/common'
|
||||
// import { ProductCard } from '@components/product'
|
||||
// import { Grid, Marquee, Hero } from '@components/ui'
|
||||
// // import HomeAllProductsGrid from '@components/common/HomeAllProductsGrid'
|
||||
// import type { GetStaticPropsContext, InferGetStaticPropsType } from 'next'
|
||||
|
||||
// export async function getStaticProps({
|
||||
// preview,
|
||||
// locale,
|
||||
// locales,
|
||||
// }: GetStaticPropsContext) {
|
||||
// const config = { locale, locales }
|
||||
// const productsPromise = commerce.getAllProducts({
|
||||
// variables: { first: 6 },
|
||||
// config,
|
||||
// preview,
|
||||
// // Saleor provider only
|
||||
// ...({ featured: true } as any),
|
||||
// })
|
||||
// const pagesPromise = commerce.getAllPages({ config, preview })
|
||||
// const siteInfoPromise = commerce.getSiteInfo({ config, preview })
|
||||
// const { products } = await productsPromise
|
||||
// const { pages } = await pagesPromise
|
||||
// const { categories, brands } = await siteInfoPromise
|
||||
|
||||
// return {
|
||||
// props: {
|
||||
// products,
|
||||
// categories,
|
||||
// brands,
|
||||
// pages,
|
||||
// },
|
||||
// revalidate: 60,
|
||||
// }
|
||||
// }
|
||||
|
||||
// export default function Home({
|
||||
// products,
|
||||
// }: InferGetStaticPropsType<typeof getStaticProps>) {
|
||||
// return (
|
||||
// <>
|
||||
// <Grid variant="filled">
|
||||
// {products.slice(0, 3).map((product: any, i: number) => (
|
||||
// <ProductCard
|
||||
// key={product.id}
|
||||
// product={product}
|
||||
// imgProps={{
|
||||
// width: i === 0 ? 1080 : 540,
|
||||
// height: i === 0 ? 1080 : 540,
|
||||
// }}
|
||||
// />
|
||||
// ))}
|
||||
// </Grid>
|
||||
// <Marquee variant="secondary">
|
||||
// {products.slice(0, 3).map((product: any, i: number) => (
|
||||
// <ProductCard key={product.id} product={product} variant="slim" />
|
||||
// ))}
|
||||
// </Marquee>
|
||||
// <Hero
|
||||
// headline=" Dessert dragée halvah croissant."
|
||||
// description="Cupcake ipsum dolor sit amet lemon drops pastry cotton candy. Sweet carrot cake macaroon bonbon croissant fruitcake jujubes macaroon oat cake. Soufflé bonbon caramels jelly beans. Tiramisu sweet roll cheesecake pie carrot cake. "
|
||||
// />
|
||||
// <Grid layout="B" variant="filled">
|
||||
// {products.slice(0, 3).map((product: any, i: number) => (
|
||||
// <ProductCard
|
||||
// key={product.id}
|
||||
// product={product}
|
||||
// imgProps={{
|
||||
// width: i === 0 ? 1080 : 540,
|
||||
// height: i === 0 ? 1080 : 540,
|
||||
// }}
|
||||
// />
|
||||
// ))}
|
||||
// </Grid>
|
||||
// <Marquee>
|
||||
// {products.slice(3).map((product: any, i: number) => (
|
||||
// <ProductCard key={product.id} product={product} variant="slim" />
|
||||
// ))}
|
||||
// </Marquee>
|
||||
// {/* <HomeAllProductsGrid
|
||||
// newestProducts={products}
|
||||
// categories={categories}
|
||||
// brands={brands}
|
||||
// /> */}
|
||||
// </>
|
||||
// )
|
||||
// }
|
||||
|
||||
// Home.Layout = Layout
|
||||
|
16
pages/search/[category].tsx
Normal file
16
pages/search/[category].tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import { getSearchStaticProps } from '@lib/search-props'
|
||||
import type { GetStaticPathsResult, GetStaticPropsContext } from 'next'
|
||||
import Search from '@components/search'
|
||||
|
||||
export async function getStaticProps(context: GetStaticPropsContext) {
|
||||
return getSearchStaticProps(context)
|
||||
}
|
||||
|
||||
export function getStaticPaths(): GetStaticPathsResult {
|
||||
return {
|
||||
paths: [],
|
||||
fallback: 'blocking',
|
||||
}
|
||||
}
|
||||
|
||||
export default Search
|
16
pages/search/designers/[name].tsx
Normal file
16
pages/search/designers/[name].tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import { getSearchStaticProps } from '@lib/search-props'
|
||||
import type { GetStaticPathsResult, GetStaticPropsContext } from 'next'
|
||||
import Search from '@components/search'
|
||||
|
||||
export async function getStaticProps(context: GetStaticPropsContext) {
|
||||
return getSearchStaticProps(context)
|
||||
}
|
||||
|
||||
export function getStaticPaths(): GetStaticPathsResult {
|
||||
return {
|
||||
paths: [],
|
||||
fallback: 'blocking',
|
||||
}
|
||||
}
|
||||
|
||||
export default Search
|
16
pages/search/designers/[name]/[category].tsx
Normal file
16
pages/search/designers/[name]/[category].tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import { getSearchStaticProps } from '@lib/search-props'
|
||||
import type { GetStaticPathsResult, GetStaticPropsContext } from 'next'
|
||||
import Search from '@components/search'
|
||||
|
||||
export async function getStaticProps(context: GetStaticPropsContext) {
|
||||
return getSearchStaticProps(context)
|
||||
}
|
||||
|
||||
export function getStaticPaths(): GetStaticPathsResult {
|
||||
return {
|
||||
paths: [],
|
||||
fallback: 'blocking',
|
||||
}
|
||||
}
|
||||
|
||||
export default Search
|
Reference in New Issue
Block a user