From 7c9d77f407657bd0fba45c94d14677a06594c3e0 Mon Sep 17 00:00:00 2001 From: christinaroise Date: Fri, 27 Sep 2024 11:04:52 +0200 Subject: [PATCH] add translation to compensation --- studio/schema.ts | 4 +++- studio/schemas/documents/compensations.ts | 16 +++++++++++----- .../objects/compensations/benefitsByLocation.ts | 4 ++-- studio/studioConfig.tsx | 2 +- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/studio/schema.ts b/studio/schema.ts index 763de2a34..0d996b769 100644 --- a/studio/schema.ts +++ b/studio/schema.ts @@ -16,11 +16,12 @@ import socialMediaLinks from "./schemas/documents/siteSettings/socialMediaProfil import customerCasesPage from "./schemas/documents/specialPages/customerCasesPage"; import callToActionField from "./schemas/fields/callToActionFields"; import categories from "./schemas/fields/categories"; +import { richText } from "./schemas/fields/text"; import benefitsByLocation from "./schemas/objects/compensations/benefitsByLocation"; import { footerSection } from "./schemas/objects/footerSection"; import { link } from "./schemas/objects/link"; +import seo from "./schemas/objects/seo"; import { socialMedia } from "./schemas/objects/socialMedia"; -import { richText } from "./schemas/fields/text"; export const schema: { types: SchemaTypeDefinition[] } = { types: [ @@ -45,5 +46,6 @@ export const schema: { types: SchemaTypeDefinition[] } = { brandAssets, languageSettings, richText, + seo, ], }; diff --git a/studio/schemas/documents/compensations.ts b/studio/schemas/documents/compensations.ts index 703567b3b..32ce0e47d 100644 --- a/studio/schemas/documents/compensations.ts +++ b/studio/schemas/documents/compensations.ts @@ -1,11 +1,10 @@ import { defineField, defineType } from "sanity"; -import { title } from "studio/schemas/fields/text"; +import { title, titleID } from "studio/schemas/fields/text"; import { benefitsByLocation } from "studio/schemas/objects/compensations/benefitsByLocation"; import { bonusesByLocation } from "studio/schemas/objects/compensations/bonusesByLocation"; import { pensionPercent } from "studio/schemas/objects/compensations/pension"; import { salariesByLocation } from "studio/schemas/objects/compensations/salariesByLocation"; -import seo from "studio/schemas/objects/seo"; import { titleSlug } from "studio/schemas/schemaTypes/slug"; export const compensationsId = "compensations"; @@ -16,12 +15,16 @@ const compensations = defineType({ title: "Compensations", fields: [ { - ...title, + name: titleID.basic, + type: "internationalizedArrayString", title: "Compensation Page Title", description: "Enter the primary title that will be displayed at the top of the compensation page. This is what users will see when they visit the page.", }, - titleSlug, + { + ...titleSlug, + type: "internationalizedArrayString", + }, defineField({ name: "showSalaryCalculator", title: "Show Salary Calculator", @@ -34,7 +37,10 @@ const compensations = defineType({ bonusesByLocation, benefitsByLocation, salariesByLocation, - seo, + { + name: "seo", + type: "internationalizedArraySeo", + }, ], preview: { select: { diff --git a/studio/schemas/objects/compensations/benefitsByLocation.ts b/studio/schemas/objects/compensations/benefitsByLocation.ts index 59ea99267..64b1d57e4 100644 --- a/studio/schemas/objects/compensations/benefitsByLocation.ts +++ b/studio/schemas/objects/compensations/benefitsByLocation.ts @@ -82,7 +82,7 @@ export const benefitsByLocation = defineField({ BENEFIT_TYPES.find((o) => o.value === type)?.title ?? "Unknown benefit type"; return { - title, + title: title[0]?.value, subtitle, }; }, @@ -109,7 +109,7 @@ export const benefitsByLocation = defineField({ validation: (rule) => rule.custom((benefitsByLocation) => { const isNotDuplicate: boolean = checkForDuplicateLocations( - benefitsByLocation as DocumentWithLocation[] | undefined + benefitsByLocation as DocumentWithLocation[] | undefined, ); return ( isNotDuplicate || diff --git a/studio/studioConfig.tsx b/studio/studioConfig.tsx index 7ed92b063..80865a813 100644 --- a/studio/studioConfig.tsx +++ b/studio/studioConfig.tsx @@ -45,7 +45,7 @@ const config: WorkspaceOptions = { languages: (client) => { return client.fetch(SUPPORTED_LANGUAGES_QUERY); }, - fieldTypes: ["string", "richText"], + fieldTypes: ["string", "richText", "seo"], }), presentationTool({ previewUrl: {