-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
Showing
12 changed files
with
298 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(), | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
schemas/documents/shared/projectPrefinanceTimelineStatus.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(), | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.' | ||
}, | ||
], | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters