mirror of
https://github.com/vercel/commerce.git
synced 2025-07-25 11:11:24 +00:00
Merged main into revalidate
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
// Next
|
||||
import type { Metadata } from 'next';
|
||||
import { draftMode } from 'next/headers';
|
||||
// Sanity
|
||||
import PreviewSuspense from 'components/preview-suspense';
|
||||
import getQueryFromSlug from 'helpers/getQueryFromSlug';
|
||||
import { docQuery } from 'lib/sanity/queries';
|
||||
import { client } from 'lib/sanity/sanity.client';
|
||||
import type { Metadata } from 'next';
|
||||
import { draftMode } from 'next/headers';
|
||||
import { clientFetch } from 'lib/sanity/sanity.client';
|
||||
// Pages.
|
||||
import CategoryPage from './category-page';
|
||||
import CategoryPagePreview from './category-page-preview';
|
||||
import HomePage from './home-page';
|
||||
@@ -23,7 +26,7 @@ export default async function Page({ params }: { params: { slug: string[]; local
|
||||
|
||||
const { query = '', queryParams, docType } = getQueryFromSlug(slug, locale);
|
||||
|
||||
const pageData = await client.fetch(query, queryParams);
|
||||
const pageData = await clientFetch(query, queryParams);
|
||||
|
||||
const data = filterDataToSingleItem(pageData, isEnabled);
|
||||
|
||||
@@ -55,7 +58,7 @@ export default async function Page({ params }: { params: { slug: string[]; local
|
||||
* Get paths for each page.
|
||||
*/
|
||||
export async function generateStaticParams() {
|
||||
const paths = await client.fetch(docQuery);
|
||||
const paths = await clientFetch(docQuery);
|
||||
|
||||
return paths.map((path: { slug: string; locale: string }) => ({
|
||||
slug: path.slug.split('/').filter((p) => p),
|
||||
@@ -95,7 +98,7 @@ export async function generateMetadata({
|
||||
|
||||
const { query = '', queryParams } = getQueryFromSlug(slug, locale);
|
||||
|
||||
const pageData = await client.fetch(query, queryParams);
|
||||
const pageData = await clientFetch(query, queryParams);
|
||||
|
||||
const data = filterDataToSingleItem(pageData, false);
|
||||
|
||||
|
@@ -6,12 +6,12 @@ import { notFound } from 'next/navigation';
|
||||
import { ReactNode } from 'react';
|
||||
import './globals.css';
|
||||
|
||||
const SITE_NAME = "KM Storefront"
|
||||
const SITE_DESCRIPTION = "Webb och digitalbyrå från Göteborg"
|
||||
const TWITTER_CREATOR = "@kodamera.se"
|
||||
const TWITTER_SITE = "https://kodamera.se"
|
||||
const OG_IMAGE_URL = "/og-image.jpg"
|
||||
const OG_IMAGE_ALT = "Kodamera"
|
||||
const SITE_NAME = 'KM Storefront';
|
||||
const SITE_DESCRIPTION = 'Webb och digitalbyrå från Göteborg';
|
||||
const TWITTER_CREATOR = '@kodamera.se';
|
||||
const TWITTER_SITE = 'https://kodamera.se';
|
||||
const OG_IMAGE_URL = '/og-image.jpg';
|
||||
const OG_IMAGE_ALT = 'Kodamera';
|
||||
|
||||
export const metadata = {
|
||||
title: {
|
||||
@@ -26,8 +26,8 @@ export const metadata = {
|
||||
width: 1200,
|
||||
height: 630,
|
||||
alt: OG_IMAGE_ALT
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
},
|
||||
robots: {
|
||||
follow: true,
|
||||
@@ -48,40 +48,36 @@ const inter = Inter({
|
||||
display: 'swap',
|
||||
variable: '--font-inter'
|
||||
});
|
||||
|
||||
|
||||
export function generateStaticParams() {
|
||||
return [{locale: 'sv'}, {locale: 'en'}];
|
||||
return [{ locale: 'sv' }, { locale: 'en' }];
|
||||
}
|
||||
|
||||
interface LocaleLayoutProps {
|
||||
children: ReactNode
|
||||
children: ReactNode;
|
||||
params: {
|
||||
locale: string
|
||||
}
|
||||
locale: string;
|
||||
};
|
||||
}
|
||||
|
||||
export default async function LocaleLayout({children, params: {locale}}: LocaleLayoutProps) {
|
||||
|
||||
export default async function LocaleLayout({ children, params: { locale } }: LocaleLayoutProps) {
|
||||
let messages;
|
||||
|
||||
|
||||
try {
|
||||
messages = (await import(`../../messages/${locale}.json`)).default;
|
||||
} catch (error) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<html lang={locale} className={inter.variable}>
|
||||
<body className="flex flex-col min-h-screen">
|
||||
<body className="flex min-h-screen flex-col">
|
||||
<NextIntlClientProvider locale={locale} messages={messages}>
|
||||
<Header />
|
||||
<main className="flex-1">
|
||||
{children}
|
||||
</main>
|
||||
<main className="flex-1">{children}</main>
|
||||
<Footer />
|
||||
</NextIntlClientProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user