Merge branch 'release-stable' of github.com:KieIO/grocery-vercel-commerce into feature/m2-add-product-to-cart

This commit is contained in:
DatNguyen
2021-10-18 10:54:29 +07:00
64 changed files with 1276 additions and 199 deletions

10
pages/forgot-password.tsx Normal file
View File

@@ -0,0 +1,10 @@
import { FormForgot, Layout } from 'src/components/common'
export default function NotFound() {
return (
<div>
<FormForgot/>
</div>
)
}
NotFound.Layout = Layout

View File

@@ -6,22 +6,24 @@ import { GetStaticPropsContext } from 'next';
import { Layout } from 'src/components/common';
import { FeaturedProductsCarousel, FreshProducts, HomeBanner, HomeCategories, HomeCollection, HomeCTA, HomeFeature, HomeRecipe, HomeSubscribe, HomeVideo } from 'src/components/modules/home';
import HomeSpice from 'src/components/modules/home/HomeSpice/HomeSpice';
import { FACET } from 'src/utils/constanst.utils';
import { COLLECTION_SLUG_SPICE, FACET } from 'src/utils/constanst.utils';
import { FilterOneVatiant, getFacetIdByName } from 'src/utils/funtion.utils';
import { CODE_FACET_DISCOUNT, CODE_FACET_FEATURED } from 'src/utils/constanst.utils';
import { getAllFacetValueIdsByParentCode, getAllFacetValuesForFeatuedProducts, getAllPromies, getFreshFacetId } from 'src/utils/funtion.utils';
import { PromiseWithKey } from 'src/utils/types.utils';
interface Props {
featuredAndDiscountFacetsValue: FacetValue[],
freshProducts: ProductCard[],
featuredProducts: ProductCard[],
collections: Collection[]
veggie: ProductCard[],
featuredAndDiscountFacetsValue: FacetValue[],
freshProducts: ProductCard[],
featuredProducts: ProductCard[],
collections: Collection[]
spiceProducts:ProductCard[],
veggie: ProductCard[],
}
export default function Home({ featuredAndDiscountFacetsValue,
freshProducts, featuredProducts, veggie,
collections }: Props) {
collections,spiceProducts }: Props) {
return (
<>
<HomeBanner />
@@ -30,7 +32,7 @@ export default function Home({ featuredAndDiscountFacetsValue,
<HomeCollection data = {veggie}/>
<FreshProducts data={freshProducts} collections={collections} />
<HomeVideo />
<HomeSpice />
{spiceProducts.length>0 && <HomeSpice data={spiceProducts}/>}
<FeaturedProductsCarousel data={featuredProducts} featuredFacetsValue={featuredAndDiscountFacetsValue} />
<HomeCTA />
<HomeRecipe />
@@ -115,16 +117,24 @@ export async function getStaticProps({
})
promisesWithKey.push({ key: 'collections', promise: collectionsPromise, keyResult: 'collections' })
// spiceProducts
const spiceProducts = commerce.getAllProducts({
variables: {
collectionSlug: COLLECTION_SLUG_SPICE,
},
config,
preview,
})
promisesWithKey.push({ key: 'spiceProducts', promise: spiceProducts, keyResult: 'products' })
try {
const promises = getAllPromies(promisesWithKey)
const rs = await Promise.all(promises)
promisesWithKey.map((item, index) => {
props[item.key] = item.keyResult ? FilterOneVatiant(rs[index][item.keyResult]) : rs[index]
return null
})
return {
props,
revalidate: 60,

View File

@@ -12,7 +12,7 @@ import { PromiseWithKey } from 'src/utils/types.utils'
export default function Slug({ product, relevantProducts, collections }: InferGetStaticPropsType<typeof getStaticProps>) {
return <>
<ProductInfoDetail />
<ProductInfoDetail productDetail={product} collections={collections}/>
<RecipeDetail ingredients={INGREDIENT_DATA_TEST} />
<RecommendedRecipes data={RECIPE_DATA_TEST} />
<ReleventProducts data={relevantProducts} collections={collections}/>

10
pages/reset-password.tsx Normal file
View File

@@ -0,0 +1,10 @@
import { FormResetPassword, Layout } from 'src/components/common'
export default function NotFound() {
return (
<div>
<FormResetPassword/>
</div>
)
}
NotFound.Layout = Layout

View File

@@ -1,11 +1,12 @@
import commerce from '@lib/api/commerce';
import { GetStaticPropsContext } from 'next';
import { ProductCard } from '@commerce/types/product';
import { Layout, ListProductCardSkeleton } from 'src/components/common';
interface Props {
products: any
productDetail: ProductCard[],
}
export default function Home({ products }: Props) {
export default function Home({ productDetail }: Props) {
return (
<>
{/* <ListProductCardSkeleton /> */}