Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .yarn/install-state.gz
Binary file not shown.
105 changes: 54 additions & 51 deletions next/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,67 +1,70 @@
import React from 'react'
import React from "react";

import { Metadata } from 'next';
import { Inter } from 'next/font/google';
import { generateMetadataObject } from '@/lib/shared/metadata';
import { Metadata } from "next";
import { Inter } from "next/font/google";
import { generateMetadataObject } from "@/lib/shared/metadata";

import { Footer } from '@/components/footer';
import { Navbar } from '@/components/navbar';
import { CartProvider } from '@/context/cart-context';
import { cn } from '@/lib/utils';
import { ViewTransitions } from 'next-view-transitions';
import fetchContentType from '@/lib/strapi/fetchContentType';
import { Footer } from "@/components/footer";
import { Navbar } from "@/components/navbar";
import { CartProvider } from "@/context/cart-context";
import { cn } from "@/lib/utils";
import { ViewTransitions } from "next-view-transitions";
import fetchContentType from "@/lib/strapi/fetchContentType";

const inter = Inter({
subsets: ["latin"],
display: "swap",
weight: ["400", "500", "600", "700", "800", "900"],
subsets: ["latin"],
display: "swap",
weight: ["400", "500", "600", "700", "800", "900"],
});

// Default Global SEO for pages without them
export async function generateMetadata({
params,
params,
}: {
params: { locale: string; slug: string };
params: { locale: string; slug: string };
}): Promise<Metadata> {
const pageData = await fetchContentType(
'global',
{
filters: { locale: params.locale },
populate: "seo.metaImage",
},
true
);
const pageData = await fetchContentType(
"global",
{
filters: { locale: params.locale },
populate: "seo.metaImage",
},
true
);

const seo = pageData?.seo;
const metadata = generateMetadataObject(seo);
return metadata;
const seo = pageData?.seo;
const metadata = generateMetadataObject(seo);
return metadata;
}

export default async function LocaleLayout({
children,
params: { locale }
children,
params: { locale },
}: {
children: React.ReactNode;
params: { locale: string };
children: React.ReactNode;
params: { locale: string };
}) {

const pageData = await fetchContentType('global', { filters: { locale } }, true);
return (
<html lang={locale}>
<ViewTransitions>
<CartProvider>
<body
className={cn(
inter.className,
"bg-charcoal antialiased h-full w-full"
)}
>
<Navbar data={pageData.navbar} locale={locale} />
{children}
<Footer data={pageData.footer} locale={locale} />
</body>
</CartProvider>
</ViewTransitions>
</html>
);
}
const pageData = await fetchContentType(
"global",
{ filters: { locale } },
true
);
return (
<div lang={locale}>
<ViewTransitions>
<CartProvider>
<div
className={cn(
inter.className,
"bg-charcoal antialiased h-full w-full"
)}
>
<Navbar data={pageData.navbar} locale={locale} />
{children}
<Footer data={pageData.footer} locale={locale} />
</div>
</CartProvider>
</ViewTransitions>
</div>
);
}
Loading