From 19ec8419dccf56c36aca7c86f2c7754e8fafe889 Mon Sep 17 00:00:00 2001 From: Florent Lagrede Date: Mon, 15 May 2023 10:42:30 +0200 Subject: [PATCH] feat: add project details section schemas (#34) * feat: add project details section schemas * fix: remove third party boolean * feat: move claims at the project level * feat: improve preview --- deskStructure.js | 8 ++++ schemas/documents/registry/projectPage.js | 6 +++ schemas/documents/shared/claim.js | 13 ++++++ schemas/documents/shared/credibilityCard.js | 24 +++++++++++ schemas/documents/shared/project.js | 11 +++++ .../sections/projectPage/projectDetails.js | 25 +++++++++++ .../projectPage/projectDetailsCard.js | 43 +++++++++++++++++++ schemas/schema.js | 8 ++++ 8 files changed, 138 insertions(+) create mode 100644 schemas/documents/shared/claim.js create mode 100644 schemas/documents/shared/credibilityCard.js create mode 100644 schemas/objects/sections/projectPage/projectDetails.js create mode 100644 schemas/objects/sections/projectPage/projectDetailsCard.js diff --git a/deskStructure.js b/deskStructure.js index 0c35c43..7aac666 100644 --- a/deskStructure.js +++ b/deskStructure.js @@ -269,6 +269,14 @@ export default S => .title('Stat Card') .schemaType('statCard') .child(S.documentTypeList('statCard').title('Stat Card')), + S.listItem() + .title('Claim') + .schemaType('claim') + .child(S.documentTypeList('claim').title('Claim')), + S.listItem() + .title('Credibility Card') + .schemaType('credibilityCard') + .child(S.documentTypeList('credibilityCard').title('Credibility Card')), ]), ), ]); diff --git a/schemas/documents/registry/projectPage.js b/schemas/documents/registry/projectPage.js index 8be5574..bdd63c2 100644 --- a/schemas/documents/registry/projectPage.js +++ b/schemas/documents/registry/projectPage.js @@ -11,5 +11,11 @@ export default { title: 'Resources for Getting Started Section', validation: Rule => Rule.required(), }, + { + name: 'projectDetailsSection', + type: 'projectDetailsSection', + title: 'Project Details Section', + validation: Rule => Rule.required(), + }, ], }; diff --git a/schemas/documents/shared/claim.js b/schemas/documents/shared/claim.js new file mode 100644 index 0000000..9205345 --- /dev/null +++ b/schemas/documents/shared/claim.js @@ -0,0 +1,13 @@ +export default { + title: 'Claim', + name: 'claim', + type: 'document', + fields: [ + { + title: 'Description', + name: 'description', + type: 'string', + validation: Rule => Rule.required(), + }, + ], +}; diff --git a/schemas/documents/shared/credibilityCard.js b/schemas/documents/shared/credibilityCard.js new file mode 100644 index 0000000..4067f12 --- /dev/null +++ b/schemas/documents/shared/credibilityCard.js @@ -0,0 +1,24 @@ +export default { + title: 'Credibility Card', + name: 'credibilityCard', + type: 'document', + fields: [ + { + title: 'Title', + name: 'title', + type: 'string', + validation: Rule => Rule.required(), + }, + { + title: 'Description', + name: 'description', + type: 'customPortableText', + validation: Rule => Rule.required(), + }, + { + title: 'Icon', + name: 'icon', + type: 'image', + }, + ], +}; diff --git a/schemas/documents/shared/project.js b/schemas/documents/shared/project.js index 7d3d750..fdf8218 100644 --- a/schemas/documents/shared/project.js +++ b/schemas/documents/shared/project.js @@ -17,5 +17,16 @@ export default { description: 'on-chain project id', validation: Rule => Rule.required(), }, + { + title: 'Credibility Cards', + name: 'credibilityCards', + type: 'array', + of: [ + { + type: 'projectDetailsCard', + }, + ], + validation: Rule => Rule.required(), + }, ], }; diff --git a/schemas/objects/sections/projectPage/projectDetails.js b/schemas/objects/sections/projectPage/projectDetails.js new file mode 100644 index 0000000..9b82e49 --- /dev/null +++ b/schemas/objects/sections/projectPage/projectDetails.js @@ -0,0 +1,25 @@ +export default { + type: 'object', + title: 'Project Details Section', + name: 'projectDetailsSection', + fields: [ + { + title: 'Label', + name: 'label', + type: 'string', + validation: Rule => Rule.required(), + }, + { + title: 'Title', + name: 'title', + type: 'string', + validation: Rule => Rule.required(), + }, + { + title: 'Description', + name: 'description', + type: 'customPortableText', + validation: Rule => Rule.required(), + }, + ], +}; diff --git a/schemas/objects/sections/projectPage/projectDetailsCard.js b/schemas/objects/sections/projectPage/projectDetailsCard.js new file mode 100644 index 0000000..466208b --- /dev/null +++ b/schemas/objects/sections/projectPage/projectDetailsCard.js @@ -0,0 +1,43 @@ +export default { + type: 'object', + title: 'Project Details Card', + name: 'projectDetailsCard', + fields: [ + { + title: 'Credibility Card', + name: 'credibilityCard', + type: 'reference', + to: [{ type: 'credibilityCard' }], + validation: Rule => Rule.required(), + }, + { + title: 'Claims', + name: 'claims', + type: 'array', + of: [ + { + type: 'reference', + to: [{ type: 'claim' }], + }, + ], + validation: Rule => Rule.required(), + }, + ], + preview: { + select: { + credibilityCardTitle: 'credibilityCard.title', + claim0: 'claims.0.description', + claim1: 'claims.1.description', + claim2: 'claims.2.description', + }, + prepare(selection) { + const { credibilityCardTitle, claim0, claim1, claim2 } = selection; + const claims = [claim0, claim1, claim2].filter(Boolean); + + return { + title: credibilityCardTitle, + subtitle: claims.join(', '), + }; + }, + }, +}; diff --git a/schemas/schema.js b/schemas/schema.js index 3fbc036..2d458b5 100644 --- a/schemas/schema.js +++ b/schemas/schema.js @@ -38,6 +38,8 @@ import project from './documents/shared/project'; import featuredProjectCard from './documents/shared/featuredProjectCard'; import partner from './documents/shared/partner'; import statCard from './documents/shared/statCard'; +import claim from './documents/shared/claim'; +import credibilityCard from './documents/shared/credibilityCard'; // Object types import heroSection from './objects/sections/heroSection'; @@ -53,6 +55,8 @@ import dualImageSection from './objects/sections/dualImageSection'; import practicesOutcomesSection from './objects/sections/practicesOutcomesSection'; import timelineSection from './objects/sections/timelineSection'; import imageGridSection from './objects/sections/imageGridSection'; +import projectDetails from './objects/sections/projectPage/projectDetails'; +import projectDetailsCard from './objects/sections/projectPage/projectDetailsCard'; import stepCard from './objects/stepCard'; import bottomBanner from './objects/bottomBanner'; @@ -214,7 +218,9 @@ export default [ caseStudyFigureSection, caseStudyFundingSection, caseStudyPage, + claim, climateSection, + credibilityCard, communityCollaborateSection, communityCollectiveSection, communityConnectSection, @@ -307,6 +313,8 @@ export default [ presskitTimelineSection, project, projectActivity, + projectDetails, + projectDetailsCard, projectPage, projectsPage, regenTeamMember,