From 7cb9aeb667c45da99b363f3924c6e84d0767af5e Mon Sep 17 00:00:00 2001 From: Ane Date: Mon, 2 Sep 2024 08:35:31 +0200 Subject: [PATCH 1/7] add offices field in companyInfo --- studio/schemas/deskStructure.ts | 1 - studio/schemas/documents/companyInfo.ts | 53 +++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/studio/schemas/deskStructure.ts b/studio/schemas/deskStructure.ts index 2f19b3bcd..39b0d5002 100644 --- a/studio/schemas/deskStructure.ts +++ b/studio/schemas/deskStructure.ts @@ -13,7 +13,6 @@ import { } from "@sanity/icons"; import { soMeLinksID } from "./documents/socialMediaProfiles"; import { companyInfoID } from "./documents/companyInfo"; -import { postId } from "./documents/post"; import { legalDocumentID } from "./documents/legalDocuments"; import { compensationsId } from "./documents/compensations"; diff --git a/studio/schemas/documents/companyInfo.ts b/studio/schemas/documents/companyInfo.ts index 3108ed8c9..d90d98cd2 100644 --- a/studio/schemas/documents/companyInfo.ts +++ b/studio/schemas/documents/companyInfo.ts @@ -73,6 +73,59 @@ const companyInfo = defineType({ }), ], }, + { + name: "offices", + type: "object", + title: "Offices", + description: "Add all your office locations here.", + fields: [ + defineField({ + name: "officeLocations", + type: "array", + title: "Office Locations", + of: [ + { + type: "object", + fields: [ + defineField({ + name: "name", + type: "string", + title: "Office Name", + description: "The name of the office location.", + validation: (Rule) => Rule.required(), + }), + defineField({ + name: "address", + type: "object", + title: "Address", + description: "The address of the office location.", + fields: [ + { + name: "streetName", + type: "string", + title: "Street name", + validation: (Rule) => Rule.required(), + }, + { + name: "streetNumber", + type: "string", + title: "Street number", + validation: (Rule) => Rule.required(), + }, + { + name: "city", + type: "string", + title: "City", + validation: (Rule) => Rule.required(), + }, + ], + }), + ], + }, + ], + }), + ], + }, { // TODO: deprecated, drop support once important deployments have updated deprecated: { From 7f523f3afcd0e1a2336974ce3e08781a43eff1de Mon Sep 17 00:00:00 2001 From: Ane Date: Mon, 2 Sep 2024 08:41:30 +0200 Subject: [PATCH 2/7] Change "name" to "office" --- studio/schemas/documents/companyInfo.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/studio/schemas/documents/companyInfo.ts b/studio/schemas/documents/companyInfo.ts index d90d98cd2..945bdbc34 100644 --- a/studio/schemas/documents/companyInfo.ts +++ b/studio/schemas/documents/companyInfo.ts @@ -88,7 +88,7 @@ const companyInfo = defineType({ type: "object", fields: [ defineField({ - name: "name", + name: "office", type: "string", title: "Office Name", description: "The name of the office location.", From 782be1a3cb613c1bbd6ace9141a091da80408f59 Mon Sep 17 00:00:00 2001 From: Ane Date: Mon, 2 Sep 2024 09:16:31 +0200 Subject: [PATCH 3/7] use officeobject in companyInfo --- studio/schemas/documents/companyInfo.ts | 37 +------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/studio/schemas/documents/companyInfo.ts b/studio/schemas/documents/companyInfo.ts index 945bdbc34..e5774df2f 100644 --- a/studio/schemas/documents/companyInfo.ts +++ b/studio/schemas/documents/companyInfo.ts @@ -85,42 +85,7 @@ const companyInfo = defineType({ title: "Office Locations", of: [ { - type: "object", - fields: [ - defineField({ - name: "office", - type: "string", - title: "Office Name", - description: "The name of the office location.", - validation: (Rule) => Rule.required(), - }), - defineField({ - name: "address", - type: "object", - title: "Address", - description: "The address of the office location.", - fields: [ - { - name: "streetName", - type: "string", - title: "Street name", - validation: (Rule) => Rule.required(), - }, - { - name: "streetNumber", - type: "string", - title: "Street number", - validation: (Rule) => Rule.required(), - }, - { - name: "city", - type: "string", - title: "City", - validation: (Rule) => Rule.required(), - }, - ], - }), - ], + type: "office", }, ], }), From 69e3cb0a115937db4d22421f1d18ae070ae41f1c Mon Sep 17 00:00:00 2001 From: Ane Date: Mon, 2 Sep 2024 11:06:57 +0200 Subject: [PATCH 4/7] add office as own section --- studio/schemas/deskStructure.ts | 24 +++++++++++++++++++----- studio/schemas/documents/companyInfo.ts | 18 ------------------ 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/studio/schemas/deskStructure.ts b/studio/schemas/deskStructure.ts index 39b0d5002..dce45ba6f 100644 --- a/studio/schemas/deskStructure.ts +++ b/studio/schemas/deskStructure.ts @@ -8,6 +8,7 @@ import { ControlsIcon, ProjectsIcon, StackCompactIcon, + InfoOutlineIcon, HeartIcon, CaseIcon, } from "@sanity/icons"; @@ -21,13 +22,26 @@ export default (S: StructureBuilder) => .title("Content") .items([ S.listItem() - .title("Company Information") + .title("Organization Details") .icon(CaseIcon) .child( - S.document() - .schemaType(companyInfoID) - .documentId(companyInfoID) - .title("Company Information"), + S.list() + .title("Organization Details") + .items([ + S.listItem() + .title("Company Information") + .icon(InfoOutlineIcon) + .child( + S.document() + .schemaType(companyInfoID) + .documentId(companyInfoID) + .title("Company Information"), + ), + S.listItem() + .title("Offices") + .icon(CaseIcon) + .child(S.documentTypeList("office").title("Offices")), + ]), ), S.listItem() .title("Legal Documents") diff --git a/studio/schemas/documents/companyInfo.ts b/studio/schemas/documents/companyInfo.ts index e5774df2f..3108ed8c9 100644 --- a/studio/schemas/documents/companyInfo.ts +++ b/studio/schemas/documents/companyInfo.ts @@ -73,24 +73,6 @@ const companyInfo = defineType({ }), ], }, - { - name: "offices", - type: "object", - title: "Offices", - description: "Add all your office locations here.", - fields: [ - defineField({ - name: "officeLocations", - type: "array", - title: "Office Locations", - of: [ - { - type: "office", - }, - ], - }), - ], - }, { // TODO: deprecated, drop support once important deployments have updated deprecated: { From 0dab9dbed8fb895d606648d303a6be32007b059a Mon Sep 17 00:00:00 2001 From: Ane Date: Mon, 2 Sep 2024 11:15:46 +0200 Subject: [PATCH 5/7] update companyinfo name --- studio/schemas/deskStructure.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/studio/schemas/deskStructure.ts b/studio/schemas/deskStructure.ts index dce45ba6f..f1df4fb3a 100644 --- a/studio/schemas/deskStructure.ts +++ b/studio/schemas/deskStructure.ts @@ -22,11 +22,11 @@ export default (S: StructureBuilder) => .title("Content") .items([ S.listItem() - .title("Organization Details") + .title("Company Details") .icon(CaseIcon) .child( S.list() - .title("Organization Details") + .title("Company Details") .items([ S.listItem() .title("Company Information") From d7fae5a1c8bf5ca662eee2c5f7c5e904244b45b5 Mon Sep 17 00:00:00 2001 From: anemne <63043552+anemne@users.noreply.github.com> Date: Mon, 2 Sep 2024 13:11:26 +0200 Subject: [PATCH 6/7] Update studio/schemas/deskStructure.ts --- studio/schemas/deskStructure.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/studio/schemas/deskStructure.ts b/studio/schemas/deskStructure.ts index f1df4fb3a..f939d7a86 100644 --- a/studio/schemas/deskStructure.ts +++ b/studio/schemas/deskStructure.ts @@ -11,6 +11,7 @@ import { InfoOutlineIcon, HeartIcon, CaseIcon, + HomeIcon, } from "@sanity/icons"; import { soMeLinksID } from "./documents/socialMediaProfiles"; import { companyInfoID } from "./documents/companyInfo"; From a41f96c32541120dc856f1583d571095fe2775b7 Mon Sep 17 00:00:00 2001 From: anemne <63043552+anemne@users.noreply.github.com> Date: Mon, 2 Sep 2024 13:11:33 +0200 Subject: [PATCH 7/7] Update studio/schemas/deskStructure.ts --- studio/schemas/deskStructure.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/studio/schemas/deskStructure.ts b/studio/schemas/deskStructure.ts index f939d7a86..b90be0168 100644 --- a/studio/schemas/deskStructure.ts +++ b/studio/schemas/deskStructure.ts @@ -40,7 +40,7 @@ export default (S: StructureBuilder) => ), S.listItem() .title("Offices") - .icon(CaseIcon) + .icon(HomeIcon) .child(S.documentTypeList("office").title("Offices")), ]), ),