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 f1f771a commit d0b457d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/app/(main)/[lang]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ export default async function Layout({
initialCompanyInfo={initialCompanyInfo}
initialBrandAssets={initialBrandAssets}
initialSoMe={initialSoMe}
initialLegal={initialLegal}
language={params.lang}
/>
) : (
<Footer
Expand Down
19 changes: 17 additions & 2 deletions src/components/navigation/footer/FooterPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ 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 { COMPANY_INFO_QUERY } from "studio/lib/queries/admin";
import {
COMPANY_INFO_QUERY,
LEGAL_DOCUMENTS_BY_LANG_QUERY,
} from "studio/lib/queries/admin";
import {
BRAND_ASSETS_QUERY,
NAV_QUERY,
Expand All @@ -27,26 +31,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(SOME_PROFILES_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 d0b457d

Please sign in to comment.