Skip to content

Commit

Permalink
feat: add project details section schemas (#34)
Browse files Browse the repository at this point in the history
* feat: add project details section schemas

* fix: remove third party boolean

* feat: move claims at the project level

* feat: improve preview
  • Loading branch information
flagrede authored May 15, 2023
1 parent e1c7a82 commit 19ec841
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 0 deletions.
8 changes: 8 additions & 0 deletions deskStructure.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')),
]),
),
]);
6 changes: 6 additions & 0 deletions schemas/documents/registry/projectPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
},
],
};
13 changes: 13 additions & 0 deletions schemas/documents/shared/claim.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export default {
title: 'Claim',
name: 'claim',
type: 'document',
fields: [
{
title: 'Description',
name: 'description',
type: 'string',
validation: Rule => Rule.required(),
},
],
};
24 changes: 24 additions & 0 deletions schemas/documents/shared/credibilityCard.js
Original file line number Diff line number Diff line change
@@ -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',
},
],
};
11 changes: 11 additions & 0 deletions schemas/documents/shared/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
},
],
};
25 changes: 25 additions & 0 deletions schemas/objects/sections/projectPage/projectDetails.js
Original file line number Diff line number Diff line change
@@ -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(),
},
],
};
43 changes: 43 additions & 0 deletions schemas/objects/sections/projectPage/projectDetailsCard.js
Original file line number Diff line number Diff line change
@@ -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(', '),
};
},
},
};
8 changes: 8 additions & 0 deletions schemas/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand Down Expand Up @@ -214,7 +218,9 @@ export default [
caseStudyFigureSection,
caseStudyFundingSection,
caseStudyPage,
claim,
climateSection,
credibilityCard,
communityCollaborateSection,
communityCollectiveSection,
communityConnectSection,
Expand Down Expand Up @@ -307,6 +313,8 @@ export default [
presskitTimelineSection,
project,
projectActivity,
projectDetails,
projectDetailsCard,
projectPage,
projectsPage,
regenTeamMember,
Expand Down

0 comments on commit 19ec841

Please sign in to comment.