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

v3 - singular form of company location id #582

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions studio/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import posts from "./schemas/documents/post";
import categories from "./schemas/fields/categories";
import legalDocument from "./schemas/documents/legalDocuments";
import benefit from "./schemas/documents/benefit";
import companyLocations from "./schemas/documents/companyLocations";
import companyLocation from "./schemas/documents/companyLocation";
import compensations from "./schemas/documents/compensations";
import siteSettings from "./schemas/documents/siteSettings";

Expand All @@ -33,6 +33,6 @@ export const schema: { types: SchemaTypeDefinition[] } = {
legalDocument,
compensations,
benefit,
companyLocations,
companyLocation,
],
};
4 changes: 2 additions & 2 deletions studio/schemas/deskStructure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { soMeLinksID } from "./documents/socialMediaProfiles";
import { companyInfoID } from "./documents/companyInfo";
import { legalDocumentID } from "./documents/legalDocuments";
import { compensationsId } from "./documents/compensations";
import { companyLocationsID } from "./documents/companyLocations";
import { companyLocationID } from "./documents/companyLocation";

export default (S: StructureBuilder) =>
S.list()
Expand All @@ -43,7 +43,7 @@ export default (S: StructureBuilder) =>
.title("Company Locations")
.icon(PinIcon)
.child(
S.documentTypeList(companyLocationsID).title(
S.documentTypeList(companyLocationID).title(
"Company Locations",
),
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { defineField, defineType } from "sanity";

export const companyLocationsID = "companyLocations";
export const companyLocationID = "companyLocation";
export const companyLocationNameID = "companyLocationName";

const companyLocations = defineType({
name: companyLocationsID,
const companyLocation = defineType({
name: companyLocationID,
type: "document",
title: "Location",
description: "Content related to an individual location within the company",
fields: [
defineField({
name: companyLocationID,
name: companyLocationNameID,
type: "string",
title: "Location",
}),
],
});

export default companyLocations;
export default companyLocation;
4 changes: 2 additions & 2 deletions studio/schemas/objects/compensations/bonusesByLocation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineField } from "sanity";
import { location, locationID } from "../locations";
import { companyLocationID } from "studio/schemas/documents/companyLocations";
import { companyLocationNameID } from "studio/schemas/documents/companyLocation";

export const bonusesByLocation = defineField({
name: "bonusesByLocation",
Expand Down Expand Up @@ -37,7 +37,7 @@ export const bonusesByLocation = defineField({
preview: {
select: {
averageBonus: "averageBonus",
location: `${locationID}.${companyLocationID}`,
location: `${locationID}.${companyLocationNameID}`,
},
prepare({ averageBonus, location }) {
return {
Expand Down
4 changes: 2 additions & 2 deletions studio/schemas/objects/locations.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineField } from "sanity";
import { companyLocationsID } from "../documents/companyLocations";
import { companyLocationID } from "../documents/companyLocation";

export const locationsID = "locations";
export const locationID = "location";
Expand All @@ -10,7 +10,7 @@ export const location = defineField({
title: "Select a location",
description:
"Select the office location this content applies to. If it applies to all locations, you can leave this field empty.",
to: [{ type: companyLocationsID }],
to: [{ type: companyLocationID }],
options: {
disableNew: true,
},
Expand Down