diff --git a/src/app/(main)/layout.tsx b/src/app/(main)/layout.tsx index 9dfeeed10..2d185883b 100644 --- a/src/app/(main)/layout.tsx +++ b/src/app/(main)/layout.tsx @@ -14,6 +14,8 @@ import SkipToMain from "src/components/skipToMain/SkipToMain"; import { LEGAL_DOCUMENTS_QUERY } from "studio/lib/queries/legalDocuments"; import { LegalDocument } from "studio/lib/payloads/legalDocuments"; import styles from "./layout.module.css"; +import { BRAND_ASSETS_QUERY } from "../../../studio/lib/queries/brandAssets"; +import { BrandAssets } from "../../../studio/lib/payloads/brandAssets"; const hasValidData = (data: any) => data && Object.keys(data).length > 0; @@ -24,13 +26,19 @@ export default async function Layout({ }>) { const { perspective, isDraftMode } = getDraftModeInfo(); - const [initialNav, initialCompanyInfo, initialSoMe, initialLegal] = - await Promise.all([ - loadQuery(NAV_QUERY, {}, { perspective }), - loadQuery(COMPANY_INFO_QUERY, {}, { perspective }), - loadQuery(SOMEPROFILES_QUERY, {}, { perspective }), - loadQuery(LEGAL_DOCUMENTS_QUERY, {}, { perspective }), - ]); + const [ + initialNav, + initialCompanyInfo, + initialSoMe, + initialLegal, + initialBrandAssets, + ] = await Promise.all([ + loadQuery(NAV_QUERY, {}, { perspective }), + loadQuery(COMPANY_INFO_QUERY, {}, { perspective }), + loadQuery(SOMEPROFILES_QUERY, {}, { perspective }), + loadQuery(LEGAL_DOCUMENTS_QUERY, {}, { perspective }), + loadQuery(BRAND_ASSETS_QUERY, {}, { perspective }), + ]); const hasNavData = hasValidData(initialNav.data); const hasCompanyInfoData = hasValidData(initialCompanyInfo.data); @@ -55,13 +63,10 @@ export default async function Layout({ {hasHeaderData && isDraftMode ? ( ) : ( -
+
)}
{children} @@ -70,6 +75,7 @@ export default async function Layout({ ) : ( @@ -77,6 +83,7 @@ export default async function Layout({ navigationData={initialNav.data} legalData={initialLegal.data} companyInfo={initialCompanyInfo.data} + brandAssets={initialBrandAssets.data} soMeData={initialSoMe.data} /> )} diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 27871391b..aade0d64f 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,12 +1,11 @@ import { Darker_Grotesque, Figtree } from "next/font/google"; import { draftMode } from "next/headers"; import LiveVisualEditing from "studio/lib/loaders/AutomaticVisualEditing"; -import { CompanyInfo } from "studio/lib/payloads/companyDetails"; -import { COMPANY_INFO_QUERY } from "studio/lib/queries/companyDetails"; import { Metadata } from "next"; import { loadQuery } from "studio/lib/store"; import "src/styles/global.css"; import { generateMetadataFromSeo } from "src/utils/seo"; +import { DEFAULT_LANGUAGE_QUERY } from "../../studio/lib/queries/languages"; const darkerGrotesque = Darker_Grotesque({ subsets: ["latin"], @@ -31,8 +30,10 @@ export default async function RootLayout({ let siteLang; try { - const { data } = await loadQuery(COMPANY_INFO_QUERY); - siteLang = data.siteMetadata?.defaultLanguage; + const { data } = await loadQuery( + DEFAULT_LANGUAGE_QUERY, + ); + siteLang = data.defaultLanguage; } catch (error) { console.error("Error loading site settings:", error); siteLang = "en"; diff --git a/src/components/navigation/footer/Footer.tsx b/src/components/navigation/footer/Footer.tsx index 999af8c61..49f46d997 100644 --- a/src/components/navigation/footer/Footer.tsx +++ b/src/components/navigation/footer/Footer.tsx @@ -13,10 +13,12 @@ import SoMeLink from "src/components/link/SoMeLink"; import { ReactNode } from "react"; import Text from "src/components/text/Text"; import { LegalDocument } from "studio/lib/payloads/legalDocuments"; +import { BrandAssets } from "studio/lib/payloads/brandAssets"; export interface IFooter { navigationData: Navigation; companyInfo: CompanyInfo; + brandAssets: BrandAssets; soMeData: SocialMediaProfiles; legalData: LegalDocument[]; } @@ -24,11 +26,12 @@ export interface IFooter { const Footer = ({ navigationData, companyInfo, + brandAssets, soMeData, legalData, }: IFooter) => { const renderedLogo = useConvertSanityImageToNextImage( - companyInfo.brandAssets?.secondaryLogo, + brandAssets?.secondaryLogo, ); const currentYear = new Date().getFullYear(); @@ -43,7 +46,7 @@ const Footer = ({
  • - {`© ${currentYear} ${companyInfo.siteMetadata?.siteName}`} + {`© ${currentYear} ${companyInfo.companyName}`}
  • {legalData?.map((legal) => { diff --git a/src/components/navigation/footer/FooterPreview.tsx b/src/components/navigation/footer/FooterPreview.tsx index dac79e00c..d66d56210 100644 --- a/src/components/navigation/footer/FooterPreview.tsx +++ b/src/components/navigation/footer/FooterPreview.tsx @@ -7,6 +7,8 @@ import { COMPANY_INFO_QUERY } from "studio/lib/queries/companyDetails"; import Footer from "./Footer"; import { SocialMediaProfiles } from "studio/lib/payloads/socialMedia"; import { SOMEPROFILES_QUERY } from "studio/lib/queries/socialMediaProfiles"; +import { BrandAssets } from "studio/lib/payloads/brandAssets"; +import { BRAND_ASSETS_QUERY } from "studio/lib/queries/brandAssets"; function useInitialData( query: string, @@ -19,23 +21,28 @@ function useInitialData( export default function FooterPreview({ initialNav, initialCompanyInfo, + initialBrandAssets, initialSoMe, }: { initialNav: QueryResponseInitial; initialCompanyInfo: QueryResponseInitial; + initialBrandAssets: QueryResponseInitial; initialSoMe: QueryResponseInitial; }) { const newNav = useInitialData(NAV_QUERY, initialNav); const newCompanyInfo = useInitialData(COMPANY_INFO_QUERY, initialCompanyInfo); + const newBrandAssets = useInitialData(BRAND_ASSETS_QUERY, initialBrandAssets); const newSoMedata = useInitialData(SOMEPROFILES_QUERY, initialSoMe); // TODO: add legal preview return ( newNav && newCompanyInfo && + newBrandAssets && newSoMedata && (