Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup compensation and add the start of bonus #569

Merged
merged 10 commits into from
Sep 4, 2024
20 changes: 13 additions & 7 deletions studio/schemas/documents/compensations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import seo from "../objects/seo";
import locations from "../objects/locations";
import { title } from "../fields/text";
import { benefitId } from "./benefit";
import { compensationDetails } from "../objects/compensationData";

// maximum number of locations to display in the preview without truncating
const LOCATIONS_PREVIEW_CUTOFF = 3;
Expand All @@ -15,24 +16,29 @@ const compensations = defineType({
type: "document",
title: "Compensations",
fields: [
locations,
title,
titleSlug,
seo,
locations,
defineField({
name: "showSalaryCalculator",
title: "Show Salary Calculator",
description: "Should the salary calculator be visible on the page?",
type: "boolean",
initialValue: true,
...compensationDetails,
readOnly: ({ parent }) => !parent?.showEstimatedSalary,
christinaroise marked this conversation as resolved.
Show resolved Hide resolved
}),
{
name: "showEstimatedSalary",
title: "Show Estimated Salary",
type: "boolean",
description:
"Toggle this option to show or hide the estimated salary for the locations you've selected. Disable this if the feature isn't ready or if you prefer not to display salary details at this time.",
initialValue: false,
},
defineField({
christinaroise marked this conversation as resolved.
Show resolved Hide resolved
name: "benefits",
title: "Benefits",
description: "Manage benefits for the compensations page",
type: "array",
of: [{ type: benefitId }],
}),
seo,
],
preview: {
select: {
Expand Down
32 changes: 32 additions & 0 deletions studio/schemas/objects/compensationData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { defineField } from "sanity";

export const compensationDetailsID = "compensationDetails";

export const compensationDetails = defineField({
name: compensationDetailsID,
title: "Compensation Details",
description:
"Add and manage detailed information on compensation elements like salary, bonuses, pensions, and other financial benefits.",
type: "object",
options: {
collapsible: true,
collapsed: true,
},
fields: [
{
name: "replaceMe",
title: "Replace me",
type: "string",
},
],
preview: {
select: {
title: "basicTitle",
},
prepare(selection) {
return {
title: selection.title,
};
},
},
});