mirror of
https://github.com/vercel/commerce.git
synced 2025-06-01 14:06:58 +00:00
63 lines
1.9 KiB
TypeScript
63 lines
1.9 KiB
TypeScript
import { CartProvider } from 'components/cart/cart-context';
|
|
import { Navbar } from 'components/layout/navbar';
|
|
import { WelcomeToast } from 'components/welcome-toast';
|
|
import { GeistSans } from 'geist/font/sans';
|
|
import { getCart } from 'lib/shopify';
|
|
import { baseUrl } from 'lib/utils';
|
|
import { ReactNode } from 'react';
|
|
import { Toaster } from 'sonner';
|
|
import './globals.css';
|
|
|
|
const { SITE_NAME } = process.env;
|
|
|
|
export const metadata = {
|
|
metadataBase: new URL(baseUrl),
|
|
title: {
|
|
default: SITE_NAME!,
|
|
template: `%s | ${SITE_NAME}`
|
|
},
|
|
robots: {
|
|
follow: true,
|
|
index: true
|
|
}
|
|
};
|
|
|
|
export default async function RootLayout({
|
|
children
|
|
}: {
|
|
children: ReactNode;
|
|
}) {
|
|
if (process.env.ENVIRONMENT === 'production') {
|
|
return (
|
|
<html lang="en" className={GeistSans.variable}>
|
|
<body className="bg-neutral-50 text-black selection:bg-teal-300 dark:bg-neutral-900 dark:text-white dark:selection:bg-pink-500 dark:selection:text-white">
|
|
<div className="min-h-screen flex flex-col items-center justify-center bg-gray-100">
|
|
<div className="text-center p-8 bg-white rounded-lg shadow-lg">
|
|
<h1 className="text-4xl font-bold text-gray-800 mb-4">Under Construction</h1>
|
|
<p className="text-gray-600">We're working on something awesome. Please check back soon!</p>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|
|
|
|
// Don't await the fetch, pass the Promise to the context provider
|
|
const cart = getCart();
|
|
|
|
return (
|
|
<html lang="en" className={GeistSans.variable}>
|
|
<body className="bg-neutral-50 text-black selection:bg-teal-300 dark:bg-neutral-900 dark:text-white dark:selection:bg-pink-500 dark:selection:text-white">
|
|
<CartProvider cartPromise={cart}>
|
|
<Navbar />
|
|
<main>
|
|
{children}
|
|
<Toaster closeButton />
|
|
<WelcomeToast />
|
|
</main>
|
|
</CartProvider>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|