Skip to content

Commit

Permalink
Add fields for name and category override to ProjectContent (#2385)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xAurelius authored Sep 16, 2024
1 parent 901119a commit 7c86c89
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
11 changes: 11 additions & 0 deletions carbon-projects/lib/categories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const categories = [
{ title: "Energy Efficiency", value: "Energy Efficiency" },
{ title: "Forestry", value: "Forestry" },
{ title: "Industrial Processing", value: "Industrial Processing" },
{ title: "Renewable Energy", value: "Renewable Energy" },
{ title: "Blue Carbon", value: "Blue Carbon" },
{ title: "Agriculture", value: "Agriculture" },
{ title: "Construction", value: "Construction" },
{ title: "Biochar", value: "Biochar" },
{ title: "Other", value: "Other" },
];
13 changes: 1 addition & 12 deletions carbon-projects/schemas/methodology.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
import { defineField, defineType } from "sanity";

const categories = [
{ title: "Energy Efficiency", value: "Energy Efficiency" },
{ title: "Forestry", value: "Forestry" },
{ title: "Industrial Processing", value: "Industrial Processing" },
{ title: "Renewable Energy", value: "Renewable Energy" },
{ title: "Blue Carbon", value: "Blue Carbon" },
{ title: "Agriculture", value: "Agriculture" },
{ title: "Construction", value: "Construction" },
{ title: "Biochar", value: "Biochar" },
{ title: "Other", value: "Other" },
];
import { categories } from "../lib/categories";

export default defineType({
name: "methodology",
Expand Down
17 changes: 17 additions & 0 deletions carbon-projects/schemas/projectContent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineField, defineType } from "sanity";
import { categories } from "../lib/categories";
import { sdgs } from "../lib/sdgs";

export default defineType({
Expand Down Expand Up @@ -30,6 +31,22 @@ export default defineType({
group: "info",
validation: (r) => r.required(),
}),
defineField({
name: "nameOverride",
description:
"Manually modified name to override the official registry name for the project (used to handle formatting issues)",
group: "info",
type: "string",
}),
defineField({
name: "categoryOverride",
description:
"For this project, override the methodology's normal category with a different one from our predefined ontology of categories",
type: "string",
options: {
list: categories,
},
}),
defineField({
name: "shortDescription",
description:
Expand Down

0 comments on commit 7c86c89

Please sign in to comment.