mirror of
https://github.com/vercel/commerce.git
synced 2025-05-18 23:46:58 +00:00
filtering products to display only live products
This commit is contained in:
parent
6af647043e
commit
cd7005a13a
13
app/page.tsx
13
app/page.tsx
@ -1,6 +1,8 @@
|
|||||||
import { Carousel } from 'components/carousel';
|
import { Carousel } from 'components/carousel';
|
||||||
import { ThreeItemGrid } from 'components/grid/three-items';
|
import Grid from 'components/grid';
|
||||||
import Footer from 'components/layout/footer';
|
import Footer from 'components/layout/footer';
|
||||||
|
import ProductGridItems from 'components/layout/product-grid-items';
|
||||||
|
import { getProducts } from 'lib/shopify';
|
||||||
import { Suspense } from 'react';
|
import { Suspense } from 'react';
|
||||||
|
|
||||||
export const runtime = 'edge';
|
export const runtime = 'edge';
|
||||||
@ -13,11 +15,18 @@ export const metadata = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default async function HomePage() {
|
export default async function HomePage() {
|
||||||
|
const products = await getProducts({});
|
||||||
|
const liveProducts = products.filter((product) => !product.tags.includes('hidden-product'))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ThreeItemGrid />
|
|
||||||
<Suspense>
|
<Suspense>
|
||||||
<Carousel />
|
<Carousel />
|
||||||
|
{liveProducts.length > 0 ? (
|
||||||
|
<Grid className="grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 m-6">
|
||||||
|
<ProductGridItems products={products} />
|
||||||
|
</Grid>
|
||||||
|
) : null}
|
||||||
<Suspense>
|
<Suspense>
|
||||||
<Footer />
|
<Footer />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user