Skip to content

Commit

Permalink
feat: project prefinancing (#56)
Browse files Browse the repository at this point in the history
* feat: add project prefinancing related docs and objects

* feat: add content for prefinance projects tab on projects page

* lint: rm new line

* fix: timeline item currentStatus

* chore: rename projectPrefinancing
  • Loading branch information
blushi authored Feb 22, 2024
1 parent 45c162d commit 001ea16
Show file tree
Hide file tree
Showing 12 changed files with 298 additions and 15 deletions.
8 changes: 8 additions & 0 deletions deskStructure.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,14 @@ export default S =>
.title('Project')
.schemaType('project')
.child(S.documentTypeList('project').title('Project')),
S.listItem()
.title('Credit Class Prefinance Timeline Status')
.schemaType('classPrefinanceTimelineStatus')
.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')),
S.listItem()
.title('Featured Project Card')
.schemaType('featuredProjectCard')
Expand Down
6 changes: 6 additions & 0 deletions sanity.cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@ export default defineCliConfig({
projectId: process.env.SANITY_STUDIO_PROJECT_ID,
dataset: process.env.SANITY_STUDIO_DATASET,
},
graphql: [
{
id: "default",
workspace: "default-workspace",
},
],
});
6 changes: 6 additions & 0 deletions schemas/documents/registry/projectsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,11 @@ export default {
title: 'Resources for Getting Started Section',
validation: Rule => Rule.required(),
},
{
name: 'prefinanceProjects',
type: 'prefinanceProjects',
title: 'Prefinance Projects',
description: 'This will appear under the Prefinance projects tab',
},
],
};
19 changes: 19 additions & 0 deletions schemas/documents/shared/classPrefinanceTimelineStatus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export default {
name: 'classPrefinanceTimelineStatus',
title: 'Credit Class Prefinance Timeline Status',
type: 'document',
fields: [
{
title: 'Description',
name: 'description',
type: 'string',
validation: Rule => Rule.required(),
},
{
title: 'Icon',
name: 'icon',
type: 'customImage',
validation: Rule => Rule.required(),
},
],
};
35 changes: 20 additions & 15 deletions schemas/documents/shared/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,31 @@ export default {
type: 'document',
fields: [
{
title: 'Project name',
name: 'projectName',
title: 'Project id, uuid or slug',
name: 'projectId',
type: 'string',
description: 'on-chain project id, off-chain uuid or slug',
validation: Rule => Rule.required(),
},
{
title: 'Project id, uuid or slug',
name: 'projectId',
title: 'Project Pre-Financing',
name: 'projectPrefinancing',
type: 'projectPrefinancing',
},
{
title: 'Credibility Cards',
name: 'credibilityCards',
type: 'array',
of: [
{
type: 'detailsCard',
},
],
},
{
title: 'Project name',
name: 'projectName',
type: 'string',
description: 'on-chain project id, off-chain uuid or slug',
validation: Rule => Rule.required(),
},
{
Expand All @@ -39,15 +54,5 @@ export default {
list: ['hectares', 'acres'],
},
},
{
title: 'Credibility Cards',
name: 'credibilityCards',
type: 'array',
of: [
{
type: 'detailsCard',
},
],
},
],
};
19 changes: 19 additions & 0 deletions schemas/documents/shared/projectPrefinanceTimelineStatus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export default {
name: 'projectPrefinanceTimelineStatus',
title: 'Project Prefinance Timeline Status',
type: 'document',
fields: [
{
title: 'Description',
name: 'description',
type: 'string',
validation: Rule => Rule.required(),
},
{
title: 'Icon',
name: 'icon',
type: 'customImage',
validation: Rule => Rule.required(),
},
],
};
24 changes: 24 additions & 0 deletions schemas/objects/classPrefinanceTimelineItem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { prefinanceTimelineItemPreview } from './projectPrefinanceTimelineItem';

export default {
title: 'Class Prefinance Timeline Item',
name: 'classPrefinanceTimelineItem',
type: 'object',
fields: [
{
title: 'Status',
name: 'status',
type: 'reference',
to: [{ type: 'classPrefinanceTimelineStatus' }],
validate: Rule => Rule.required(),
},
{
title: 'Date(s) and current status',
name: 'prefinanceTimelineItem',
type: 'prefinanceTimelineItem',
validate: Rule => Rule.required(),
},
],
preview: prefinanceTimelineItemPreview,
};

18 changes: 18 additions & 0 deletions schemas/objects/prefinanceProjects.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export default {
title: 'Prefinance Projects',
name: 'prefinanceProjects',
type: 'object',
fields: [
{
title: 'Description',
name: 'description',
type: 'customPortableText',
validation: Rule => Rule.required(),
},
{
title: 'Learn more link',
name: 'learnMore',
type: 'url',
},
],
};
34 changes: 34 additions & 0 deletions schemas/objects/prefinanceTimelineItem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
export default {
title: 'Prefinance Timeline Item',
name: 'prefinanceTimelineItem',
type: 'object',
fields: [
{
title: 'Single date or start date',
name: 'date',
type: 'date',
description: 'optional',
},
{
title: 'End date',
name: 'endDate',
type: 'date',
description: 'optional if single date',
},
{
title: 'Current status',
name: 'currentStatus',
type: 'string',
options: {
list: [
{ title: "Projected", value: "projected" },
{ title: "Done", value: "done" }
],
layout: "radio",
},
validate: Rule => Rule.required(),
description: 'Timeline items that are done will be written in black text on the timeline while projected items are greyed out. The most recent done item will show up as the current status on the project page.'
},
],
};

39 changes: 39 additions & 0 deletions schemas/objects/projectPrefinanceTimelineItem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
export const prefinanceTimelineItemPreview = {
select: {
description: 'status.description',
date: 'prefinanceTimelineItem.date',
endDate: 'prefinanceTimelineItem.endDate',
currentStatus: 'prefinanceTimelineItem.currentStatus',
},
prepare(selection) {
const { description, date, endDate, currentStatus } = selection;
return {
title: description,
subtitle: `${currentStatus} ${date || ''} ${endDate ? ` - ${endDate}` : ''}`,
};
},
};

export default {
title: 'Project Prefinance Timeline Item',
name: 'projectPrefinanceTimelineItem',
type: 'object',
fields: [
{
title: 'Status',
name: 'status',
type: 'reference',
to: [{ type: 'projectPrefinanceTimelineStatus' }],
validate: Rule => Rule.required(),
},
{
title: 'Date(s) and current status',
name: 'prefinanceTimelineItem',
type: 'prefinanceTimelineItem',
validate: Rule => Rule.required(),
},
],
preview: prefinanceTimelineItemPreview,
};


91 changes: 91 additions & 0 deletions schemas/objects/projectPrefinancing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
export default {
title: 'Project Prefinancing',
name: 'projectPrefinancing',
type: 'object',
fields: [
{
title: 'Is a prefinance project',
name: 'isPrefinanceProject',
type: 'boolean',
},
{
title: 'Price',
name: 'price',
type: 'number',
description: 'in USD',
validation: (Rule) => validation(Rule).positive(),
},
{
title: 'Estimated Issuance',
name: 'estimatedIssuance',
type: 'number',
description: 'estimated number of credits that will be issued',
validation: (Rule) => validation(Rule).positive(),
},
{
title: 'Stripe payment link',
name: 'stripePaymentLink',
type: 'url',
validation,
},
{
title: 'Project prefinance terms',
name: 'prefinanceTerms',
type: 'customPortableText',
validation,
},
{
title: 'Link to purchase agreement',
name: 'purchaseAgreementLink',
type: 'url',
validation,
},
{
title: 'Projected credit delivery date',
name: 'projectedCreditDeliveryDate',
type: 'date',
validation,
},
{
title: 'Project timeline',
name: 'projectTimeline',
type: 'array',
of: [
{
type: 'projectPrefinanceTimelineItem',
},
],
},
{
title: 'Credit class timeline',
name: 'classTimeline',
type: 'array',
of: [
{
type: 'classPrefinanceTimelineItem',
},
],
},
{
title: 'What supporting this project enables',
name: 'supportEnables',
type: 'array',
of: [
{
type: 'text',
},
],
validation,
},
],
};

function validation(Rule) {
return Rule.custom((value, context) => {
if (context.parent.isPrefinanceProject && !value) {
return 'Required for pre-finance projects';
}
return true;
});
}

14 changes: 14 additions & 0 deletions schemas/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ import claim from './documents/shared/claim';
import credibilityCard from './documents/shared/credibilityCard';
import person from './documents/shared/person';
import program from './documents/shared/program';
import classPrefinanceTimelineStatus from './documents/shared/classPrefinanceTimelineStatus';
import projectPrefinanceTimelineStatus from './documents/shared/projectPrefinanceTimelineStatus';

// Object types
import heroSection from './objects/sections/heroSection';
Expand Down Expand Up @@ -143,6 +145,7 @@ import titleImageLink from './objects/templates/titleImageLink';
import presskitTimelineItem from './objects/presskitTimelineItem';
import presskitTimelineSection from './objects/sections/presskit/presskitTimelineSection';
import presskitTeamSection from './objects/sections/presskit/presskitTeamSection';
import projectPrefinancing from './objects/projectPrefinancing';
import nameTitleImage from './objects/templates/nameTitleImage';
import presskitLogosSection from './objects/sections/presskit/presskitLogosSection';
import presskitPhotosSection from './objects/sections/presskit/presskitPhotosSection';
Expand Down Expand Up @@ -189,6 +192,10 @@ import homeWebPartnersSection from './objects/sections/homePageWeb/partnersSecti
import homeWebEcologicalCreditCardsSection from './objects/sections/homePageWeb/ecologicalCreditCardsSection';
import homeWebStatsSection from './objects/sections/homePageWeb/statsSection';
import homePageProjectsSection from './objects/sections/homePage/homePageProjectsSection';
import projectPrefinanceTimelineItem from './objects/projectPrefinanceTimelineItem';
import classPrefinanceTimelineItem from './objects/classPrefinanceTimelineItem';
import prefinanceTimelineItem from './objects/prefinanceTimelineItem';
import prefinanceProjects from './objects/prefinanceProjects';

export default [
actionCard,
Expand Down Expand Up @@ -226,6 +233,8 @@ export default [
caseStudyFundingSection,
caseStudyPage,
claim,
classPrefinanceTimelineItem,
classPrefinanceTimelineStatus,
climateSection,
credibilityCard,
communityCollaborateSection,
Expand Down Expand Up @@ -315,6 +324,8 @@ export default [
person,
program,
practicesOutcomesSection,
prefinanceProjects,
prefinanceTimelineItem,
presskitAwardsSection,
presskitFeaturedSection,
presskitLogosSection,
Expand All @@ -326,6 +337,9 @@ export default [
project,
projectActivity,
projectEcosystem,
projectPrefinancing,
projectPrefinanceTimelineItem,
projectPrefinanceTimelineStatus,
detailsSection,
detailsCard,
projectPage,
Expand Down

0 comments on commit 001ea16

Please sign in to comment.