mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
fix: Add promoted item to cart
This commit is contained in:
@@ -2,7 +2,8 @@ import Footer from 'components/layout/footer';
|
||||
import { SupportedLocale } from 'components/layout/navbar/language-control';
|
||||
|
||||
import Navbar from 'components/layout/navbar';
|
||||
import { getCart, getPage } from 'lib/shopify';
|
||||
import { getCart, getPage, getProduct } from 'lib/shopify';
|
||||
import { Product } from 'lib/shopify/types';
|
||||
import { cookies } from 'next/headers';
|
||||
import { Suspense } from 'react';
|
||||
import AboutNaraiDetail from './about-narai-detail';
|
||||
@@ -26,11 +27,16 @@ export default async function Page({ params }: { params: { locale?: SupportedLoc
|
||||
cart = await getCart(cartId);
|
||||
}
|
||||
|
||||
const promotedItem: Product | undefined = await getProduct({
|
||||
handle: 'gift-bag-and-postcard-set',
|
||||
language: params?.locale?.toUpperCase()
|
||||
});
|
||||
|
||||
const awardsPage = await getPage({ handle: 'awards', language: params?.locale?.toUpperCase() });
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Navbar cart={cart} locale={params?.locale} compact />
|
||||
<Navbar cart={cart} locale={params?.locale} compact promotedItem={promotedItem} />
|
||||
<div className="pt-24 md:pt-32">
|
||||
<AboutNaraiDetail awards={awardsPage.body} />
|
||||
</div>
|
||||
|
@@ -2,7 +2,8 @@ import Footer from 'components/layout/footer';
|
||||
import { SupportedLocale } from 'components/layout/navbar/language-control';
|
||||
|
||||
import Navbar from 'components/layout/navbar';
|
||||
import { getCart } from 'lib/shopify';
|
||||
import { getCart, getProduct } from 'lib/shopify';
|
||||
import { Product } from 'lib/shopify/types';
|
||||
import { cookies } from 'next/headers';
|
||||
import { Suspense } from 'react';
|
||||
import SagyobarDetail from './sagyobar-detail';
|
||||
@@ -28,9 +29,14 @@ export default async function Page({ params }: { params: { locale?: SupportedLoc
|
||||
cart = await getCart(cartId);
|
||||
}
|
||||
|
||||
const promotedItem: Product | undefined = await getProduct({
|
||||
handle: 'gift-bag-and-postcard-set',
|
||||
language: params?.locale?.toUpperCase()
|
||||
});
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Navbar cart={cart} locale={params?.locale} compact />
|
||||
<Navbar cart={cart} locale={params?.locale} compact promotedItem={promotedItem} />
|
||||
<div className="pt-12">
|
||||
<SagyobarDetail />
|
||||
</div>
|
||||
|
@@ -2,7 +2,8 @@ import Footer from 'components/layout/footer';
|
||||
import { SupportedLocale } from 'components/layout/navbar/language-control';
|
||||
|
||||
import Navbar from 'components/layout/navbar';
|
||||
import { getCart } from 'lib/shopify';
|
||||
import { getCart, getProduct } from 'lib/shopify';
|
||||
import { Product } from 'lib/shopify/types';
|
||||
import { cookies } from 'next/headers';
|
||||
import { Suspense } from 'react';
|
||||
import CompanyDetail from './company-detail';
|
||||
@@ -28,9 +29,14 @@ export default async function Page({ params }: { params: { locale?: SupportedLoc
|
||||
cart = await getCart(cartId);
|
||||
}
|
||||
|
||||
const promotedItem: Product | undefined = await getProduct({
|
||||
handle: 'gift-bag-and-postcard-set',
|
||||
language: params?.locale?.toUpperCase()
|
||||
});
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Navbar cart={cart} locale={params?.locale} compact />
|
||||
<Navbar cart={cart} locale={params?.locale} compact promotedItem={promotedItem} />
|
||||
<div className="pt-12">
|
||||
<CompanyDetail />
|
||||
</div>
|
||||
|
@@ -2,7 +2,8 @@ import Footer from 'components/layout/footer';
|
||||
import { SupportedLocale } from 'components/layout/navbar/language-control';
|
||||
|
||||
import Navbar from 'components/layout/navbar';
|
||||
import { getCart } from 'lib/shopify';
|
||||
import { getCart, getProduct } from 'lib/shopify';
|
||||
import { Product } from 'lib/shopify/types';
|
||||
import { cookies } from 'next/headers';
|
||||
import { Suspense } from 'react';
|
||||
import ConceptDetail from './concept-detail';
|
||||
@@ -28,9 +29,14 @@ export default async function Page({ params }: { params: { locale?: SupportedLoc
|
||||
cart = await getCart(cartId);
|
||||
}
|
||||
|
||||
const promotedItem: Product | undefined = await getProduct({
|
||||
handle: 'gift-bag-and-postcard-set',
|
||||
language: params?.locale?.toUpperCase()
|
||||
});
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Navbar cart={cart} locale={params?.locale} compact />
|
||||
<Navbar cart={cart} locale={params?.locale} compact promotedItem={promotedItem} />
|
||||
<div className="pt-12">
|
||||
<ConceptDetail />
|
||||
</div>
|
||||
|
@@ -2,7 +2,8 @@ import Footer from 'components/layout/footer';
|
||||
import { SupportedLocale } from 'components/layout/navbar/language-control';
|
||||
|
||||
import Navbar from 'components/layout/navbar';
|
||||
import { getCart } from 'lib/shopify';
|
||||
import { getCart, getProduct } from 'lib/shopify';
|
||||
import { Product } from 'lib/shopify/types';
|
||||
import { cookies } from 'next/headers';
|
||||
import { Suspense } from 'react';
|
||||
import Disclosures from './disclosures';
|
||||
@@ -32,9 +33,14 @@ export default async function DisclosuresPage({
|
||||
cart = await getCart(cartId);
|
||||
}
|
||||
|
||||
const promotedItem: Product | undefined = await getProduct({
|
||||
handle: 'gift-bag-and-postcard-set',
|
||||
language: locale?.toUpperCase()
|
||||
});
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Navbar cart={cart} locale={locale} compact />
|
||||
<Navbar cart={cart} locale={locale} compact promotedItem={promotedItem} />
|
||||
<div className="py-24 md:py-48">
|
||||
<Disclosures />
|
||||
</div>
|
||||
|
@@ -151,7 +151,7 @@ export default async function HomePage({
|
||||
</div>
|
||||
|
||||
<Suspense>
|
||||
<Footer cart={cart} />
|
||||
<Footer cart={cart} promotedItem={promotedItem} />
|
||||
</Suspense>
|
||||
</div>
|
||||
);
|
||||
|
@@ -2,7 +2,8 @@ import Footer from 'components/layout/footer';
|
||||
import { SupportedLocale } from 'components/layout/navbar/language-control';
|
||||
|
||||
import Navbar from 'components/layout/navbar';
|
||||
import { getCart } from 'lib/shopify';
|
||||
import { getCart, getProduct } from 'lib/shopify';
|
||||
import { Product } from 'lib/shopify/types';
|
||||
import { cookies } from 'next/headers';
|
||||
import { Suspense } from 'react';
|
||||
import PrivacyPolicy from './privacy-policy';
|
||||
@@ -32,9 +33,14 @@ export default async function PrivacyPage({
|
||||
cart = await getCart(cartId);
|
||||
}
|
||||
|
||||
const promotedItem: Product | undefined = await getProduct({
|
||||
handle: 'gift-bag-and-postcard-set',
|
||||
language: locale?.toUpperCase()
|
||||
});
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Navbar cart={cart} locale={locale} compact />
|
||||
<Navbar cart={cart} locale={locale} compact promotedItem={promotedItem} />
|
||||
<div className="py-24 md:py-48">
|
||||
<PrivacyPolicy />
|
||||
</div>
|
||||
|
@@ -3,7 +3,8 @@ import { SupportedLocale } from 'components/layout/navbar/language-control';
|
||||
|
||||
import { ProductGrid } from 'components/grid/product-grid';
|
||||
import Navbar from 'components/layout/navbar';
|
||||
import { getCart } from 'lib/shopify';
|
||||
import { getCart, getProduct } from 'lib/shopify';
|
||||
import { Product } from 'lib/shopify/types';
|
||||
import { cookies } from 'next/headers';
|
||||
import { Suspense } from 'react';
|
||||
|
||||
@@ -32,9 +33,14 @@ export default async function ProductPage({
|
||||
cart = await getCart(cartId);
|
||||
}
|
||||
|
||||
const promotedItem: Product | undefined = await getProduct({
|
||||
handle: 'gift-bag-and-postcard-set',
|
||||
language: locale?.toUpperCase()
|
||||
});
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Navbar cart={cart} locale={locale} compact />
|
||||
<Navbar cart={cart} locale={locale} compact promotedItem={promotedItem} />
|
||||
<div className="py-24 md:py-48">
|
||||
<ProductGrid lang={locale} />
|
||||
</div>
|
||||
|
@@ -4,7 +4,8 @@ import Footer from 'components/layout/footer';
|
||||
import Navbar from 'components/layout/navbar';
|
||||
import { SupportedLocale } from 'components/layout/navbar/language-control';
|
||||
import Prose from 'components/prose';
|
||||
import { getCart, getPage } from 'lib/shopify';
|
||||
import { getCart, getPage, getProduct } from 'lib/shopify';
|
||||
import { Product } from 'lib/shopify/types';
|
||||
import { cookies } from 'next/headers';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { Suspense } from 'react';
|
||||
@@ -46,9 +47,14 @@ export default async function Page({ params }: { params: { locale?: SupportedLoc
|
||||
|
||||
if (!page) return notFound();
|
||||
|
||||
const promotedItem: Product | undefined = await getProduct({
|
||||
handle: 'gift-bag-and-postcard-set',
|
||||
language: params?.locale?.toUpperCase()
|
||||
});
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Navbar cart={cart} locale={params?.locale} compact showTop />
|
||||
<Navbar cart={cart} locale={params?.locale} compact showTop promotedItem={promotedItem} />
|
||||
<div className="mx-auto max-w-xl px-6 pb-24 pt-12 md:pb-48 md:pt-24">
|
||||
<div className="pb-12">
|
||||
<ShopsNav />
|
||||
|
@@ -2,7 +2,8 @@ import Footer from 'components/layout/footer';
|
||||
import { SupportedLocale } from 'components/layout/navbar/language-control';
|
||||
|
||||
import Navbar from 'components/layout/navbar';
|
||||
import { getCart } from 'lib/shopify';
|
||||
import { getCart, getProduct } from 'lib/shopify';
|
||||
import { Product } from 'lib/shopify/types';
|
||||
import { cookies } from 'next/headers';
|
||||
import { ReactNode, Suspense } from 'react';
|
||||
|
||||
@@ -31,9 +32,14 @@ export default async function BlogLayout({
|
||||
cart = await getCart(cartId);
|
||||
}
|
||||
|
||||
const promotedItem: Product | undefined = await getProduct({
|
||||
handle: 'gift-bag-and-postcard-set',
|
||||
language: locale?.toUpperCase()
|
||||
});
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Navbar cart={cart} locale={locale} compact />
|
||||
<Navbar cart={cart} locale={locale} compact promotedItem={promotedItem} />
|
||||
{children}
|
||||
<Suspense>
|
||||
<Footer cart={cart} />
|
||||
|
@@ -4,7 +4,8 @@ import { SupportedLocale } from 'components/layout/navbar/language-control';
|
||||
import Navbar from 'components/layout/navbar';
|
||||
import StoriesDetail from 'components/layout/stories-detail';
|
||||
import { BLOG_HANDLE } from 'lib/constants';
|
||||
import { getCart } from 'lib/shopify';
|
||||
import { getCart, getProduct } from 'lib/shopify';
|
||||
import { Product } from 'lib/shopify/types';
|
||||
import { cookies } from 'next/headers';
|
||||
import { Suspense } from 'react';
|
||||
|
||||
@@ -31,9 +32,14 @@ export default async function StoriesPage({
|
||||
cart = await getCart(cartId);
|
||||
}
|
||||
|
||||
const promotedItem: Product | undefined = await getProduct({
|
||||
handle: 'gift-bag-and-postcard-set',
|
||||
language: locale?.toUpperCase()
|
||||
});
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Navbar cart={cart} locale={locale} compact />
|
||||
<Navbar cart={cart} locale={locale} compact promotedItem={promotedItem} />
|
||||
<div className="py-24 md:py-48">
|
||||
<StoriesDetail handle={BLOG_HANDLE} locale={locale} />
|
||||
</div>
|
||||
|
@@ -2,7 +2,8 @@ import Footer from 'components/layout/footer';
|
||||
import { SupportedLocale } from 'components/layout/navbar/language-control';
|
||||
|
||||
import Navbar from 'components/layout/navbar';
|
||||
import { getCart } from 'lib/shopify';
|
||||
import { getCart, getProduct } from 'lib/shopify';
|
||||
import { Product } from 'lib/shopify/types';
|
||||
import { cookies } from 'next/headers';
|
||||
import { Suspense } from 'react';
|
||||
import TermsOfUse from './terms-of-use';
|
||||
@@ -30,9 +31,14 @@ export default async function TermsPage({
|
||||
cart = await getCart(cartId);
|
||||
}
|
||||
|
||||
const promotedItem: Product | undefined = await getProduct({
|
||||
handle: 'gift-bag-and-postcard-set',
|
||||
language: locale?.toUpperCase()
|
||||
});
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Navbar cart={cart} locale={locale} compact />
|
||||
<Navbar cart={cart} locale={locale} compact promotedItem={promotedItem} />
|
||||
<div className="py-24 md:py-48">
|
||||
<TermsOfUse />
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user