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
18 changes: 7 additions & 11 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,19 @@ const compensations = defineType({
type: "document",
title: "Compensations",
fields: [
locations,
title,
titleSlug,
seo,
defineField({
name: "showSalaryCalculator",
title: "Show Salary Calculator",
description: "Should the salary calculator be visible on the page?",
type: "boolean",
initialValue: true,
}),
locations,
compensationDetails,
defineField({
christinaroise marked this conversation as resolved.
Show resolved Hide resolved
name: "benefits",
title: "Benefits",
description: "Manage benefits for the compensations page",
title: "Included Benefits",
description:
"Add and manage information on the benefits included with the compensation package, such as health insurance, retirement plans, and paid time off.",
type: "array",
of: [{ type: benefitId }],
}),
seo,
],
preview: {
select: {
Expand Down
41 changes: 41 additions & 0 deletions studio/schemas/objects/compensationData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
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 estimated salary, bonuses, pensions, and other financial benefits.",
type: "object",
options: {
collapsible: true,
collapsed: false,
},
fields: [
{
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,
},
{
name: "replaceMe",
title: "Replace me",
type: "string",
readOnly: ({ parent }) => !parent?.showEstimatedSalary,
},
],
preview: {
select: {
title: "basicTitle",
},
prepare(selection) {
return {
title: selection.title,
};
},
},
});