Skip to content

Commit

Permalink
fix(FooterPreview): include legal data in footer preview
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiazom committed Sep 27, 2024
1 parent d247dcb commit 17849fd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/app/(main)/[lang]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ export default async function Layout({
initialCompanyInfo={initialCompanyInfo}
initialBrandAssets={initialBrandAssets}
initialSoMe={initialSoMe}
initialLegal={initialLegal}
language={params.lang}
/>
) : (
<Footer
Expand Down
15 changes: 14 additions & 1 deletion src/components/navigation/footer/FooterPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import { QueryResponseInitial, useQuery } from "@sanity/react-loader";

import { BrandAssets } from "studio/lib/interfaces/brandAssets";
import { CompanyInfo } from "studio/lib/interfaces/companyDetails";
import { LegalDocument } from "studio/lib/interfaces/legalDocuments";
import { Navigation } from "studio/lib/interfaces/navigation";
import { SocialMediaProfiles } from "studio/lib/interfaces/socialMedia";
import { BRAND_ASSETS_QUERY } from "studio/lib/queries/brandAssets";
import { COMPANY_INFO_QUERY } from "studio/lib/queries/companyDetails";
import { LEGAL_DOCUMENTS_BY_LANG_QUERY } from "studio/lib/queries/legalDocuments";
import { NAV_QUERY } from "studio/lib/queries/navigation";
import { SOMEPROFILES_QUERY } from "studio/lib/queries/socialMediaProfiles";

Expand All @@ -25,26 +27,37 @@ export default function FooterPreview({
initialCompanyInfo,
initialBrandAssets,
initialSoMe,
initialLegal,
language,
}: {
initialNav: QueryResponseInitial<Navigation>;
initialCompanyInfo: QueryResponseInitial<CompanyInfo>;
initialBrandAssets: QueryResponseInitial<BrandAssets>;
initialSoMe: QueryResponseInitial<SocialMediaProfiles | null>;
initialLegal: QueryResponseInitial<LegalDocument[] | null>;
language: string;
}) {
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);
const { data: newLegal } = useQuery(
LEGAL_DOCUMENTS_BY_LANG_QUERY,
{ language },
{ initial: initialLegal },
);
return (
newNav &&
newCompanyInfo &&
newBrandAssets &&
newSoMedata && (
newSoMedata &&
newLegal && (
<Footer
navigationData={newNav}
companyInfo={newCompanyInfo}
brandAssets={newBrandAssets}
soMeData={newSoMedata}
legalData={newLegal}
/>
)
);
Expand Down

0 comments on commit 17849fd

Please sign in to comment.