From 2c70feccad6f4c59863c4e8e3633f0c83b2c55f1 Mon Sep 17 00:00:00 2001 From: Ane Date: Fri, 27 Sep 2024 10:16:22 +0200 Subject: [PATCH] Move all admin related queries into admin.ts --- src/app/(main)/[slug]/page.tsx | 2 +- src/app/(main)/layout.tsx | 6 ++++-- src/app/(main)/legal/[id]/page.tsx | 2 +- src/compensations/CompensationsPreview.tsx | 2 +- src/components/navigation/footer/FooterPreview.tsx | 2 +- src/utils/seo.ts | 2 +- studio/lib/queries/{legalDocuments.ts => admin.ts} | 9 +++++++++ studio/lib/queries/companyDetails.ts | 7 ------- 8 files changed, 18 insertions(+), 14 deletions(-) rename studio/lib/queries/{legalDocuments.ts => admin.ts} (50%) delete mode 100644 studio/lib/queries/companyDetails.ts diff --git a/src/app/(main)/[slug]/page.tsx b/src/app/(main)/[slug]/page.tsx index fe3494a52..9f058a5c1 100644 --- a/src/app/(main)/[slug]/page.tsx +++ b/src/app/(main)/[slug]/page.tsx @@ -15,7 +15,7 @@ import { CompanyLocation } from "studio/lib/interfaces/companyDetails"; import { CompensationsPage } from "studio/lib/interfaces/compensations"; import { BlogPage, PageBuilder, Post } from "studio/lib/interfaces/pages"; import { CustomerCasePage } from "studio/lib/interfaces/specialPages"; -import { COMPANY_LOCATIONS_QUERY } from "studio/lib/queries/companyDetails"; +import { COMPANY_LOCATIONS_QUERY } from "studio/lib/queries/admin"; import { BLOG_PAGE_QUERY, POSTS_QUERY, diff --git a/src/app/(main)/layout.tsx b/src/app/(main)/layout.tsx index 9efaac746..d45a44a3a 100644 --- a/src/app/(main)/layout.tsx +++ b/src/app/(main)/layout.tsx @@ -9,9 +9,11 @@ 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, + LEGAL_DOCUMENTS_BY_LANG_QUERY, +} from "studio/lib/queries/admin"; 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"; import { loadStudioQuery } from "studio/lib/store"; diff --git a/src/app/(main)/legal/[id]/page.tsx b/src/app/(main)/legal/[id]/page.tsx index efeda4d0f..0925758d3 100644 --- a/src/app/(main)/legal/[id]/page.tsx +++ b/src/app/(main)/legal/[id]/page.tsx @@ -2,7 +2,7 @@ import Legal from "src/blog/components/legal/Legal"; import LegalPreview from "src/blog/components/legal/LegalPreview"; import { getDraftModeInfo } from "src/utils/draftmode"; import { LegalDocument } from "studio/lib/interfaces/legalDocuments"; -import { LEGAL_DOCUMENTS_BY_SLUG_AND_LANG_QUERY } from "studio/lib/queries/legalDocuments"; +import { LEGAL_DOCUMENTS_BY_SLUG_AND_LANG_QUERY } from "studio/lib/queries/admin"; import { loadStudioQuery } from "studio/lib/store"; export const dynamic = "force-dynamic"; diff --git a/src/compensations/CompensationsPreview.tsx b/src/compensations/CompensationsPreview.tsx index 7e7fb6a03..872a1534f 100644 --- a/src/compensations/CompensationsPreview.tsx +++ b/src/compensations/CompensationsPreview.tsx @@ -5,7 +5,7 @@ import { Suspense } from "react"; import { CompanyLocation } from "studio/lib/interfaces/companyDetails"; import { CompensationsPage } from "studio/lib/interfaces/compensations"; -import { COMPANY_LOCATIONS_QUERY } from "studio/lib/queries/companyDetails"; +import { COMPANY_LOCATIONS_QUERY } from "studio/lib/queries/admin"; import { COMPENSATIONS_PAGE_QUERY } from "studio/lib/queries/specialPages"; import Compensations from "./Compensations"; diff --git a/src/components/navigation/footer/FooterPreview.tsx b/src/components/navigation/footer/FooterPreview.tsx index 709a9cc96..81e28700e 100644 --- a/src/components/navigation/footer/FooterPreview.tsx +++ b/src/components/navigation/footer/FooterPreview.tsx @@ -5,8 +5,8 @@ import { BrandAssets } from "studio/lib/interfaces/brandAssets"; import { CompanyInfo } from "studio/lib/interfaces/companyDetails"; import { Navigation } from "studio/lib/interfaces/navigation"; import { SocialMediaProfiles } from "studio/lib/interfaces/socialMedia"; +import { COMPANY_INFO_QUERY } from "studio/lib/queries/admin"; import { BRAND_ASSETS_QUERY } from "studio/lib/queries/brandAssets"; -import { COMPANY_INFO_QUERY } from "studio/lib/queries/companyDetails"; import { NAV_QUERY } from "studio/lib/queries/navigation"; import { SOMEPROFILES_QUERY } from "studio/lib/queries/socialMediaProfiles"; diff --git a/src/utils/seo.ts b/src/utils/seo.ts index b63a0c6f1..a26f660cb 100644 --- a/src/utils/seo.ts +++ b/src/utils/seo.ts @@ -7,8 +7,8 @@ import { urlFor } from "studio/lib/image"; import { BrandAssets } from "studio/lib/interfaces/brandAssets"; import { CompanyInfo } from "studio/lib/interfaces/companyDetails"; import { DefaultSeo } from "studio/lib/interfaces/defaultSeo"; +import { COMPANY_INFO_QUERY } from "studio/lib/queries/admin"; import { BRAND_ASSETS_QUERY } from "studio/lib/queries/brandAssets"; -import { COMPANY_INFO_QUERY } from "studio/lib/queries/companyDetails"; import { DEFAULT_SEO_QUERY } from "studio/lib/queries/seo"; import { loadStudioQuery } from "studio/lib/store"; diff --git a/studio/lib/queries/legalDocuments.ts b/studio/lib/queries/admin.ts similarity index 50% rename from studio/lib/queries/legalDocuments.ts rename to studio/lib/queries/admin.ts index a0aca6b31..5f0f44601 100644 --- a/studio/lib/queries/legalDocuments.ts +++ b/studio/lib/queries/admin.ts @@ -1,5 +1,14 @@ import { groq } from "next-sanity"; +import { companyInfoID } from "studio/schemas/documents/admin/companyInfo"; + +//Parent Company +export const COMPANY_INFO_QUERY = groq`*[_type == "${companyInfoID}"][0]`; + +//Company Locations +export const COMPANY_LOCATIONS_QUERY = groq`*[_type == "companyLocation"]`; + +//Legal Documents export const LEGAL_DOCUMENTS_BY_LANG_QUERY = groq`*[_type == "legalDocument" && language == $language]`; export const LEGAL_DOCUMENTS_BY_SLUG_AND_LANG_QUERY = groq`*[_type == "legalDocument" && language == $language && slug.current == $slug][0]`; diff --git a/studio/lib/queries/companyDetails.ts b/studio/lib/queries/companyDetails.ts deleted file mode 100644 index 4faf273b6..000000000 --- a/studio/lib/queries/companyDetails.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { groq } from "next-sanity"; - -import { companyInfoID } from "studio/schemas/documents/admin/companyInfo"; - -export const COMPANY_INFO_QUERY = groq`*[_type == "${companyInfoID}"][0]`; - -export const COMPANY_LOCATIONS_QUERY = groq`*[_type == "companyLocation"]`;