Skip to content

Commit

Permalink
feat: add credit category and update credit type (#58)
Browse files Browse the repository at this point in the history
* feat: add credit category doc type and update credit type

* feat: use customPortableText for unitDefinition

* fix: update credit type to category in ecologicalCreditCard displayed on website homepage

* fix: category naming

* fix: rename creditCategory
  • Loading branch information
blushi authored Mar 25, 2024
1 parent 0067791 commit 29a9387
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 11 deletions.
4 changes: 4 additions & 0 deletions deskStructure.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ export default S =>
.title('Sold out projects')
.schemaType('soldOutProjects')
.child(S.documentTypeList('soldOutProjects').title('Sold out projects')),
S.listItem()
.title('Credit Category')
.schemaType('creditCategory')
.child(S.documentTypeList('creditCategory').title('Credit Category')),
S.listItem()
.title('Credit Type')
.schemaType('creditType')
Expand Down
27 changes: 27 additions & 0 deletions schemas/documents/shared/creditCategory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export default {
title: 'Credit Category',
name: 'creditCategory',
type: 'document',
fields: [
{
title: 'Name',
name: 'name',
type: 'string',
validation: Rule => Rule.required(),
},
{
title: 'Icon',
name: 'icon',
type: 'image',
description: 'This icon will appear on the credit class cards with credit type belonging to this category',
validation: Rule => Rule.required(),
},
{
title: 'Large Image',
name: 'largeImage',
type: 'image',
description: `This image will appear on the credit class pages with credit type belonging to this category, unless there's already one specified for the credit type`,
validation: Rule => Rule.required(),
},
],
};
27 changes: 19 additions & 8 deletions schemas/documents/shared/creditType.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,30 @@ export default {
type: 'string',
validation: Rule => Rule.required(),
},
{
title: 'Image',
name: 'image',
type: 'image',
description: 'This image will appear on the credit class cards of this type',
validation: Rule => Rule.required(),
},
{
title: 'Large Image',
name: 'largeImage',
type: 'image',
description: 'This image will appear on the credit class pages of this type',
description: 'This image will appear on the credit class pages of this type. If none specified, the image from the credit category will be shown.',
},
{
title: 'Category',
name: 'category',
type: 'reference',
to: [{ type: 'creditCategory' }],
validation: Rule => Rule.required(),
},
{
title: 'Unit',
name: 'unit',
type: 'string',
description: 'This overrides the on-chain unit',
},
{
title: 'Unit definition',
name: 'unitDefinition',
type: 'customPortableText',
description: '"Learn more" about the credit unit',
},
],
};
6 changes: 3 additions & 3 deletions schemas/documents/shared/ecologicalCreditCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ export default {
validation: Rule => Rule.required(),
},
{
title: 'Type',
name: 'type',
title: 'Credit Category',
name: 'creditCategory',
type: 'reference',
to: [{ type: 'creditType' }],
to: [{ type: 'creditCategory' }],
validation: Rule => Rule.required(),
},
{
Expand Down
2 changes: 2 additions & 0 deletions schemas/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ import projectPrefinanceTimelineItem from './objects/projectPrefinanceTimelineIt
import classPrefinanceTimelineItem from './objects/classPrefinanceTimelineItem';
import prefinanceTimelineItem from './objects/prefinanceTimelineItem';
import prefinanceProjects from './objects/prefinanceProjects';
import creditCategory from './documents/shared/creditCategory';

export default [
actionCard,
Expand Down Expand Up @@ -248,6 +249,7 @@ export default [
createCreditClassPage,
createMethodologyPage,
createMethodologyStepCardSection,
creditCategory,
creditCertification,
creditClass,
creditClassPage,
Expand Down

0 comments on commit 29a9387

Please sign in to comment.