Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
37fd2cf
register custom widget for variable type resources
interim17 Feb 19, 2026
5e1c540
use resourceDetails in nested fields on resource markdown
interim17 Feb 19, 2026
75fbc17
query new resources collection
interim17 Feb 19, 2026
9f43b2b
Update src/cms/widgets/VariableResourceWidget/copyResourceNameHandler.ts
interim17 Feb 20, 2026
a345633
Update static/admin/config.yml
interim17 Feb 20, 2026
478c946
reference resourceDetails in relational widget
interim17 Feb 20, 2026
e0fd5b2
Merge branch 'main' of https://github.com/AllenCell/idea-board into f…
interim17 Feb 23, 2026
cc336ee
remove redundant fields from config
interim17 Feb 23, 2026
6653ea5
fix typo
interim17 Feb 23, 2026
eb6b692
run format
interim17 Feb 23, 2026
3e89540
Merge branch 'run-format' of https://github.com/AllenCell/idea-board …
interim17 Feb 23, 2026
211c55a
update comment
interim17 Feb 23, 2026
ee27bd4
Merge branch 'feature/resource' of https://github.com/AllenCell/idea-…
interim17 Feb 24, 2026
00d073e
add resources to schema
interim17 Feb 24, 2026
2bdcb98
add pages for resources
interim17 Feb 24, 2026
879d577
format resource template
interim17 Feb 24, 2026
1a50470
add ResourceDetailsField fragment
interim17 Feb 24, 2026
1e1ee25
build resource pages separately from MarkdownRemark
interim17 Feb 24, 2026
079639a
Merge branch 'main' of https://github.com/AllenCell/idea-board into f…
interim17 Feb 25, 2026
f9283a8
format and lint
interim17 Feb 25, 2026
be3ef5c
Merge branch 'feature/resource' of https://github.com/AllenCell/idea-…
interim17 Feb 25, 2026
971039c
import resources path
interim17 Feb 25, 2026
c12a1aa
add a resources index page and a second dev example tool
interim17 Feb 25, 2026
72038d2
make programs an array and next steps a markdown string
interim17 Mar 9, 2026
fc2b31f
Merge branch 'main' of https://github.com/AllenCell/idea-board into f…
interim17 Mar 9, 2026
f793be6
Merge branch 'fix/next-steps' of https://github.com/AllenCell/idea-bo…
interim17 Mar 9, 2026
89d19e2
fix duplicated fields in dev-example
interim17 Mar 9, 2026
a517a79
flatten resource details when building gatsby nodes
interim17 Mar 10, 2026
666a21a
fix typos
interim17 Mar 10, 2026
7369d06
migrate software and dataset markdown content to resources collection
interim17 Mar 11, 2026
d98830e
migrate cell lines to resource markdown
interim17 Mar 11, 2026
6104fb3
bucket resource types in resource index with compsed fragments
interim17 Mar 11, 2026
2e00e4c
use resources collection data in MaterialsAndMethods component
interim17 Mar 11, 2026
10bdf7a
remove materials and methods from markdown, schema and gatsby node api
interim17 Mar 11, 2026
a23a49f
remove data and utilities associated with old multi resourece collect…
interim17 Mar 11, 2026
2c3bf14
patch idea roll component to use resources
interim17 Mar 11, 2026
137179e
add reporter to resource resolver
interim17 Mar 11, 2026
0c37800
update tests to cover resourceQuery
interim17 Mar 11, 2026
8d88a8d
Update gatsby-node.js
interim17 Mar 11, 2026
8264972
remove tags fields from createPages calls
interim17 Mar 11, 2026
0d4765e
Merge branch 'feature/resource-query' of https://github.com/AllenCell…
interim17 Mar 11, 2026
2b14e68
Update gatsby/utils/gatsby-resolver-utils.js
interim17 Mar 11, 2026
2c25a81
Update gatsby/schema/base.gql
interim17 Mar 11, 2026
2127cba
update comments
interim17 Mar 11, 2026
8411c40
remove extra layout
interim17 Mar 11, 2026
8d3b7b9
Merge branch 'feature/resource-query' of https://github.com/AllenCell…
interim17 Mar 11, 2026
1ff999e
Merge branch 'feature/resource-query' of https://github.com/AllenCell…
interim17 Mar 11, 2026
fbe2502
fix authors schema typing
interim17 Mar 11, 2026
23a5c69
Merge branch 'main' of https://github.com/AllenCell/idea-board into f…
interim17 Mar 11, 2026
3febfd8
Merge branch 'feature/resource-query' of https://github.com/AllenCell…
interim17 Mar 11, 2026
5965024
add noopener to NameWithLink util
interim17 Mar 11, 2026
a097dae
Merge branch 'feature/resource-query' of https://github.com/AllenCell…
interim17 Mar 11, 2026
432db80
Merge branch 'migrate-resources-1' of https://github.com/AllenCell/id…
interim17 Mar 11, 2026
7b2f553
don't use constant in resolver tests
interim17 Mar 11, 2026
65ad0e6
add related ideas field to decap config
interim17 Mar 17, 2026
c6d0d75
query and render related ideas
interim17 Mar 17, 2026
4d6d314
working refactor of idea roll to query idea posts instead of markdown…
interim17 Mar 17, 2026
71df358
move idea post to use idea post nodes instead of markdown nodes
interim17 Mar 17, 2026
9aa262d
alphabetize types in schema
interim17 Mar 17, 2026
5fe20c7
Merge branch 'main' of https://github.com/AllenCell/idea-board into l…
interim17 Mar 23, 2026
d4d0817
Update gatsby/resolvers/resolvers.js
interim17 Mar 24, 2026
321cd62
Update src/templates/idea-post.tsx
interim17 Mar 24, 2026
ceb8f95
Update src/components/IdeaRoll.tsx
interim17 Mar 24, 2026
28a3ea1
Merge branch 'main' of https://github.com/AllenCell/idea-board into l…
interim17 Mar 25, 2026
8d5f520
Merge branch 'main' into link-ideas
interim17 Apr 3, 2026
8febdd9
change hint text for related ideas
interim17 Apr 3, 2026
4b2004b
lint and format
interim17 Apr 3, 2026
e9d001d
Apply suggestion from @ShrimpCryptid
interim17 Apr 7, 2026
558376e
reorder schema types
interim17 Apr 7, 2026
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
119 changes: 21 additions & 98 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ const _ = require("lodash");
const fs = require("fs");
const path = require("path");
const { createFilePath } = require("gatsby-source-filesystem");
const {
stringWithDefault,
resolveToArray,
resourceQuery,
} = require("./gatsby/utils/gatsby-resolver-utils");
const { createIdeaPostResolver } = require("./gatsby/resolvers/resolvers");
const {
RESOURCES_GATSBY_NODE_KEY,
MARKDOWN_REMARK_GATSBY_NODE_KEY,
Expand All @@ -26,25 +22,11 @@ const read = (p) => fs.readFileSync(path.join(__dirname, p), "utf8");

const DATA_ONLY_PAGES = [ALLENITE_TEMPLATE_KEY, PROGRAM_TEMPLATE_KEY];

const templateKeysWithNodes = Object.keys(TEMPLATE_KEY_TO_TYPE);

exports.createSchemaCustomization = ({ actions }) => {
const { createTypes } = actions;
const typeDefs = [
`type PreliminaryFindings {
summary: String!
figures: [ImgWithCaption!]!
}

type ImgWithCaption @dontInfer {
type: String!
url: String
file: File @fileByRelativePath
caption: String
}

`,
];
createTypes(read("gatsby/schema/base.gql"));
createTypes(typeDefs);
};

/**
Expand All @@ -61,60 +43,7 @@ exports.createResolvers = ({ reporter, createResolvers }) => {
}),
},
},
Frontmatter: {
description: {
resolve: (source) =>
stringWithDefault(
source.description,
"No description provided.",
),
},
authors: {
resolve: (source) => resolveToArray(source.authors),
},
title: {
resolve: (source) =>
stringWithDefault(source.title, "No title provided."),
},
resources: {
resolve: async (source, _args, context) => {
const names = resolveToArray(source.resources);
const results = await Promise.all(
names.map((name) =>
context.nodeModel.findOne(resourceQuery(name)),
),
);
results.forEach((result, i) => {
if (!result) {
const msg = `Resource "${names[i]}" not found for idea "${source.title}". Check for typos and ensure the resource file exists with the correct templateKey.`;
reporter.error(msg, new Error(msg));
}
});
return results.filter(Boolean);
},
},
nextSteps: {
resolve: (source) => source.nextSteps ?? null,
},
program: {
resolve: (source) => resolveToArray(source.program),
},
preliminaryFindings: {
resolve: (source) => {
const raw = source.preliminaryFindings;
if (!raw || typeof raw !== "object") {
return {
summary: "",
figures: [],
};
}
return {
summary: stringWithDefault(raw.summary, ""),
figures: resolveToArray(raw.figures),
};
},
},
},
IdeaPost: createIdeaPostResolver(reporter),
});
};

Expand All @@ -128,11 +57,10 @@ exports.createPages = ({ actions, graphql }) => {

// Create pages for any markdown files that are configured to have their
// own node type (e.g. Resource) based on their templateKey.
const typedNodePages = Object.keys(TEMPLATE_KEY_TO_TYPE).map(
(templateKey) => {
const nodeKey = TEMPLATE_KEY_TO_TYPE[templateKey];
const allKeyString = `all${nodeKey}`;
return graphql(`
const typedNodePages = templateKeysWithNodes.map((templateKey) => {
const nodeKey = TEMPLATE_KEY_TO_TYPE[templateKey];
const allKeyString = `all${nodeKey}`;
return graphql(`
{
${allKeyString} {
nodes {
Expand All @@ -142,23 +70,20 @@ exports.createPages = ({ actions, graphql }) => {
}
}
`).then((result) => {
if (result.errors) {
result.errors.forEach((e) => console.error(e.toString()));
return Promise.reject(result.errors);
}
if (result.errors) {
result.errors.forEach((e) => console.error(e.toString()));
return Promise.reject(result.errors);
}

result.data[allKeyString].nodes.forEach((node) => {
createPage({
path: node.slug,
component: path.resolve(
`src/templates/${templateKey}.tsx`,
),
context: { id: node.id },
});
result.data[allKeyString].nodes.forEach((node) => {
createPage({
path: node.slug,
component: path.resolve(`src/templates/${templateKey}.tsx`),
context: { id: node.id },
});
});
},
);
});
});

/**
* We make pages from all markdown files that are consumed by gatsby-transformer-remark,
Expand Down Expand Up @@ -198,7 +123,7 @@ exports.createPages = ({ actions, graphql }) => {
// Skip creating pages for data-only pages (software, dataset, etc.)
if (
DATA_ONLY_PAGES.includes(templateKey) ||
templateKey in TEMPLATE_KEY_TO_TYPE
templateKeysWithNodes.includes(templateKey)
) {
return;
}
Expand Down Expand Up @@ -274,9 +199,7 @@ exports.onCreateNode = ({
// in the createPages.
if (
node.frontmatter?.templateKey &&
Object.keys(TEMPLATE_KEY_TO_TYPE).includes(
node.frontmatter?.templateKey,
)
templateKeysWithNodes.includes(node.frontmatter?.templateKey)
) {
const nodeType = TEMPLATE_KEY_TO_TYPE[node.frontmatter.templateKey];

Expand Down
8 changes: 8 additions & 0 deletions gatsby/constants.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
const ALLENITE_TEMPLATE_KEY = `allenite`;
const PROGRAM_TEMPLATE_KEY = `program`;
const RESOURCES_TEMPLATE_KEY = `resource`;
const IDEA_POST_TEMPLATE_KEY = `idea-post`;

const RESOURCES_GATSBY_NODE_KEY = `Resource`;
const IDEA_POST_GATSBY_NODE_KEY = `IdeaPost`;
const MARKDOWN_REMARK_GATSBY_NODE_KEY = `MarkdownRemark`;
const IDEAS_SLUG_DIRECTORY = `ideas`;

/**
* Maps frontmatter templateKey → a distinct GraphQL node type.
Expand All @@ -14,12 +17,17 @@ const MARKDOWN_REMARK_GATSBY_NODE_KEY = `MarkdownRemark`;
*/
const TEMPLATE_KEY_TO_TYPE = {
[RESOURCES_TEMPLATE_KEY]: RESOURCES_GATSBY_NODE_KEY,
[IDEA_POST_TEMPLATE_KEY]: IDEA_POST_GATSBY_NODE_KEY,
};

module.exports = {
ALLENITE_TEMPLATE_KEY,
PROGRAM_TEMPLATE_KEY,
RESOURCES_TEMPLATE_KEY,
MARKDOWN_REMARK_GATSBY_NODE_KEY,
TEMPLATE_KEY_TO_TYPE,
RESOURCES_GATSBY_NODE_KEY,
IDEA_POST_TEMPLATE_KEY,
IDEA_POST_GATSBY_NODE_KEY,
IDEAS_SLUG_DIRECTORY,
};
77 changes: 77 additions & 0 deletions gatsby/resolvers/resolvers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
const {
stringWithDefault,
resolveToArray,
ideaPostQuery,
resourceQuery,
} = require("../utils/gatsby-resolver-utils");

const createIdeaPostResolver = (reporter) => ({
title: {
resolve: (source) =>
stringWithDefault(source.title, "No title provided."),
},
description: {
Comment on lines +1 to +13
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Mostly the same code as our our old frontmatter resolver, just in a new file and with "relatedIdeas" added

resolve: (source) =>
stringWithDefault(source.description, "No description provided."),
},
nextSteps: {
resolve: (source) => source.nextSteps ?? null,
},
relatedIdeas: {
resolve: async (source, _args, context) => {
const names = resolveToArray(source.related_ideas);
const results = await Promise.all(
names.map((name) =>
context.nodeModel.findOne(ideaPostQuery(name)),
),
);
results.forEach((result, i) => {
if (!result) {
const msg = `Idea post "${names[i]}" not found for idea "${source.title}". Check for typos and ensure the idea post file exists with the correct templateKey.`;
reporter.error(msg, new Error(msg));
}
});
return results.filter(Boolean);
},
},
authors: {
resolve: (source) => resolveToArray(source.authors),
},
tags: {
resolve: (source) => resolveToArray(source.tags),
},
program: {
resolve: (source) => resolveToArray(source.program),
},
resources: {
resolve: async (source, _args, context) => {
const names = resolveToArray(source.resources);
const results = await Promise.all(
names.map((name) =>
context.nodeModel.findOne(resourceQuery(name)),
),
);
results.forEach((result, i) => {
if (!result) {
const msg = `Resource "${names[i]}" not found for idea "${source.title}". Check for typos and ensure the resource file exists with the correct templateKey.`;
reporter.error(msg, new Error(msg));
}
});
return results.filter(Boolean);
},
},
preliminaryFindings: {
resolve: (source) => {
const raw = source.preliminaryFindings;
if (!raw || typeof raw !== "object") {
return { summary: "", figures: [] };
}
return {
summary: stringWithDefault(raw.summary, ""),
figures: resolveToArray(raw.figures),
};
},
},
});

module.exports = { createIdeaPostResolver };
52 changes: 37 additions & 15 deletions gatsby/schema/base.gql
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,16 @@ type MarkdownRemarkFields {
}

type MarkdownRemark implements Node {
frontmatter: Frontmatter!
fields: MarkdownRemarkFields!
frontmatter: Frontmatter!
}

# Shared frontmatter fields for idea posts (and other markdown).
type Frontmatter {
date: Date @dateformat
title: String!
description: String
draft: Boolean
tags: [String!]
authors: [String!]!
nextSteps: String
program: [String!]
publication: String
introduction: String
resources: [Resource!]!
title: String!
}

type ResourceLink {
Expand All @@ -29,15 +22,44 @@ type ResourceLink {
}

type Resource implements Node {
slug: String!
name: String
type: String
date: Date @dateformat
description: String
draft: Boolean
file: String
name: String
links: [ResourceLink!]
readmeLink: String
file: String
slug: String!
status: String
date: Date @dateformat
tags: [String!]
type: String
}

type PreliminaryFindings {
figures: [ImgWithCaption!]!
summary: String!
}

type ImgWithCaption @dontInfer {
caption: String
file: File @fileByRelativePath
type: String!
url: String
}

type IdeaPost implements Node {
authors: [String!]!
date: Date @dateformat
description: String
draft: Boolean
}
introduction: String
nextSteps: String
preliminaryFindings: PreliminaryFindings
program: [String!]!
publication: String
relatedIdeas: [IdeaPost!]!
resources: [Resource!]!
slug: String!
tags: [String!]!
title: String!
}
12 changes: 12 additions & 0 deletions gatsby/utils/gatsby-resolver-utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const {
RESOURCES_TEMPLATE_KEY,
TEMPLATE_KEY_TO_TYPE,
IDEA_POST_TEMPLATE_KEY,
IDEAS_SLUG_DIRECTORY,
} = require("../constants");
const slugify = require("slugify");

Expand Down Expand Up @@ -61,9 +63,19 @@ const resourceQuery = (name) => {
};
};

const ideaPostQuery = (name) => {
const slug = resolveSlug(name, IDEAS_SLUG_DIRECTORY);
if (!slug) return null;
return {
query: { filter: { slug: { eq: slug } } },
type: TEMPLATE_KEY_TO_TYPE[IDEA_POST_TEMPLATE_KEY],
};
};

module.exports = {
stringWithDefault,
resolveToArray,
resolveSlug,
resourceQuery,
ideaPostQuery,
};
Loading
Loading