Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add featured projects to registry home #49

Merged
merged 2 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion schemas/documents/registry/homePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default {
},
{
name: 'projectsSection',
type: 'titleCustomBody',
type: 'homePageProjectsSection',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a side note that this is breaking and leads to the following error on https://dev.app.regen.network/ and all deploy previews that do not include your code from regen-network/regen-web#2191 until this is merged
image

so it might be best to make use of sanity graphql tagged endpoints: https://www.sanity.io/docs/graphql#e2e900be2233

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't aware we could create additional tags like that, will make more use of that in the future if needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll create an issue to add a note in the README about that

title: 'Projects Section',
validation: Rule => Rule.required(),
},
Expand Down
6 changes: 2 additions & 4 deletions schemas/documents/shared/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,21 @@ export default {
validation: Rule => Rule.required(),
},
{
title: 'Project id',
title: 'Project id, uuid or slug',
name: 'projectId',
type: 'string',
description: 'on-chain project id',
description: 'on-chain project id, off-chain uuid or slug',
validation: Rule => Rule.required(),
},
{
title: 'Project Image',
name: 'image',
type: 'customImage',
validation: Rule => Rule.required(),
},
{
title: 'Project Location',
name: 'location',
type: 'string',
validation: Rule => Rule.required(),
},
{
title: 'Area',
Expand Down
24 changes: 24 additions & 0 deletions schemas/objects/sections/homePage/homePageProjectsSection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export default {
type: 'object',
name: 'homePageProjectsSection',
title: 'Home Page Projects Section',
fields: [
{
name: 'titleCustomBody',
type: 'titleCustomBody',
title: 'Title and Body',
validation: Rule => Rule.required(),
},
{
title: 'Featured Projects',
name: 'projects',
type: 'array',
of: [
{
type: 'reference',
to: [{ type: 'project' }],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we don't necessarily want a reference to an existing project in Sanity because this means the editor will need to provide project image, location, etc. if the project doesn't already exist while we can easily get this from the marketplace app (contrary to the website at this point), so I guess just a list of strings could be sufficient.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a list of strings here would prevent editors from reusing previously used IDs. Searching a project by name is also a better experience in sanity than having to input an ID manually. By doing so we also capitalize on a single source of truth for a project that could be helpful elsewhere.
There are currently 4 mandatory fields for the project entity in sanity, among those I think we could only keep name and id as mandatory making the project creation almost the same effort as using an id directly but with additional benefits.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah then if we only make name and id required, I agree that works better

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's done

},
],
},
],
};
2 changes: 2 additions & 0 deletions schemas/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ import infoCard from './objects/cards/infoCard';
import homeWebPartnersSection from './objects/sections/homePageWeb/partnersSection';
import homeWebEcologicalCreditCardsSection from './objects/sections/homePageWeb/ecologicalCreditCardsSection';
import homeWebStatsSection from './objects/sections/homePageWeb/statsSection';
import homePageProjectsSection from './objects/sections/homePage/homePageProjectsSection';

export default [
actionCard,
Expand Down Expand Up @@ -273,6 +274,7 @@ export default [
homeFoldSection,
homePage,
homePageTopSection,
homePageProjectsSection,
homePageWeb,
homeValuesSection,
homeWebEcologicalCreditCardsSection,
Expand Down