From 50c5981b136126d990b4014c18bb5eda8abb72cc Mon Sep 17 00:00:00 2001 From: Florent Lagrede Date: Tue, 1 Oct 2024 10:10:05 +0200 Subject: [PATCH] feat: add Tebu Banner schema (#67) * feat: add tebu banner schema * feat: make all fields configurable --- deskStructure.js | 25 ++++++++++++++++++++++-- schemas/documents/terrasos/tebuBanner.js | 25 ++++++++++++++++++++++++ schemas/objects/linkItem.js | 18 +++++++++++++++++ schemas/schema.js | 4 ++++ 4 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 schemas/documents/terrasos/tebuBanner.js create mode 100644 schemas/objects/linkItem.js diff --git a/deskStructure.js b/deskStructure.js index d4f1944..523ac90 100644 --- a/deskStructure.js +++ b/deskStructure.js @@ -286,11 +286,19 @@ export default S => S.listItem() .title('Credit Class Prefinance Timeline Status') .schemaType('classPrefinanceTimelineStatus') - .child(S.documentTypeList('classPrefinanceTimelineStatus').title('Credit Class Prefinance Timeline Status')), + .child( + S.documentTypeList('classPrefinanceTimelineStatus').title( + 'Credit Class Prefinance Timeline Status', + ), + ), S.listItem() .title('Project Class Prefinance Timeline Status') .schemaType('projectPrefinanceTimelineStatus') - .child(S.documentTypeList('projectPrefinanceTimelineStatus').title('Project Class Prefinance Timeline Status')), + .child( + S.documentTypeList('projectPrefinanceTimelineStatus').title( + 'Project Class Prefinance Timeline Status', + ), + ), S.listItem() .title('Featured Project Card') .schemaType('featuredProjectCard') @@ -325,4 +333,17 @@ export default S => .child(S.documentTypeList('program').title('Program')), ]), ), + // Terrasos + S.listItem() + .title('Terrasos') + .child( + S.list() + .title('Terrasos') + .items([ + S.listItem() + .title('Tebu Banner') + .schemaType('tebuBanner') + .child(S.document().schemaType('tebuBanner')), + ]), + ), ]); diff --git a/schemas/documents/terrasos/tebuBanner.js b/schemas/documents/terrasos/tebuBanner.js new file mode 100644 index 0000000..12a0c7c --- /dev/null +++ b/schemas/documents/terrasos/tebuBanner.js @@ -0,0 +1,25 @@ +export default { + name: 'tebuBanner', + type: 'document', + title: 'Tebu Banner', + fields: [ + { + title: 'Content', + name: 'content', + type: 'customPortableText', + validation: Rule => Rule.required(), + }, + { + title: 'Learn more link', + name: 'learnMoreLink', + type: 'linkItem', + validation: Rule => Rule.required(), + }, + { + title: 'Logo', + name: 'logo', + type: 'customImage', + validation: Rule => Rule.required(), + }, + ], +}; diff --git a/schemas/objects/linkItem.js b/schemas/objects/linkItem.js new file mode 100644 index 0000000..585de20 --- /dev/null +++ b/schemas/objects/linkItem.js @@ -0,0 +1,18 @@ +export default { + type: 'object', + name: 'linkItem', + title: 'Link Item', + fields: [ + { + title: 'Href', + name: 'href', + type: 'url', + }, + { + title: 'Text', + name: 'text', + type: 'string', + validation: Rule => Rule.required(), + }, + ], +}; diff --git a/schemas/schema.js b/schemas/schema.js index 205161d..336e774 100644 --- a/schemas/schema.js +++ b/schemas/schema.js @@ -64,6 +64,7 @@ import tokenPage from './documents/www/tokenPage'; import walletAddressRegistrationPage from './documents/www/walletAddressRegistrationPage'; import nctPage from './documents/www/nctPage'; import creditCategory from './documents/shared/creditCategory'; +import tebuBanner from './documents/terrasos/tebuBanner'; export const documentsSchemas = [ homePage, @@ -129,6 +130,7 @@ export const documentsSchemas = [ walletAddressRegistrationPage, nctPage, creditCategory, + tebuBanner, ]; // Object types @@ -268,6 +270,7 @@ import prefinanceTimelineItem from './objects/prefinanceTimelineItem'; import prefinanceProjects from './objects/prefinanceProjects'; import createProjectPagePopup from './objects/createProjectPagePopup'; import sellOrderPrice from './objects/sellOrderPrice'; +import linkItem from './objects/linkItem'; export const objectSchemas = [ heroSection, @@ -406,6 +409,7 @@ export const objectSchemas = [ prefinanceProjects, createProjectPagePopup, sellOrderPrice, + linkItem, ]; export default [