Skip to content

Commit

Permalink
add translation to compensation
Browse files Browse the repository at this point in the history
  • Loading branch information
christinaroise committed Sep 27, 2024
1 parent 1257a27 commit 7c9d77f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
4 changes: 3 additions & 1 deletion studio/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand All @@ -45,5 +46,6 @@ export const schema: { types: SchemaTypeDefinition[] } = {
brandAssets,
languageSettings,
richText,
seo,
],
};
16 changes: 11 additions & 5 deletions studio/schemas/documents/compensations.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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",
Expand All @@ -34,7 +37,10 @@ const compensations = defineType({
bonusesByLocation,
benefitsByLocation,
salariesByLocation,
seo,
{
name: "seo",
type: "internationalizedArraySeo",
},
],
preview: {
select: {
Expand Down
4 changes: 2 additions & 2 deletions studio/schemas/objects/compensations/benefitsByLocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
},
Expand All @@ -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 ||
Expand Down
2 changes: 1 addition & 1 deletion studio/studioConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const config: WorkspaceOptions = {
languages: (client) => {
return client.fetch(SUPPORTED_LANGUAGES_QUERY);
},
fieldTypes: ["string", "richText"],
fieldTypes: ["string", "richText", "seo"],
}),
presentationTool({
previewUrl: {
Expand Down

0 comments on commit 7c9d77f

Please sign in to comment.