Skip to content
Open
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
14 changes: 11 additions & 3 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,21 @@ exports.createSchemaCustomization = ({ actions, schema }) => {
"""
type MaterialsAndMethods {
dataset: MarkdownRemark @link(by: "frontmatter.name")
protocols: [ProtocolItem!]!
protocols: [Protocol!]!
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

In the CMS config, protocols is marked required: false, but the schema declares protocols: [Protocol!]! (non-null). If a markdown entry omits materialsAndMethods.protocols, Gatsby schema/query resolution can fail at build time. Consider making this field nullable (e.g., [Protocol!]) or making the CMS field required so the data always exists.

Suggested change
protocols: [Protocol!]!
protocols: [Protocol!]

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have a resolver to handle this case and provide an empty array in that case.

cellLines: [CellLineItem!]!
software: [SoftwareTool!]!
}

type ProtocolItem {
protocol: String!
"""
The front end and CMS assume that you enter EITHER a url OR a file which
this type doesn't strictly enforce. Directly entering data into markdown
with both fields populated may lead to unexpected behavior.
"""
type Protocol @dontInfer {
type: String!
name: String!
url: String
file: File @fileByRelativePath
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This and the query are where I think we could get a little more into the weeds with graphql especially if we had more complex varied types, but this is fine for now IMHO.

}

type CellLineItem {
Expand Down
34 changes: 20 additions & 14 deletions src/components/MaterialsAndMethods.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const MaterialsAndMethodsComponent: React.FC<MaterialsAndMethods> = ({
return cellLine.name;
}
return (
<a href={cellLine.link} target="_blank" rel="noreferrer">
<a href={cellLine.link} target="_blank" rel="noreferrer noopener">
{cellLine.name}
</a>
);
Expand All @@ -34,7 +34,7 @@ export const MaterialsAndMethodsComponent: React.FC<MaterialsAndMethods> = ({
const title = link ? (
<p>
<strong>{`Name: `}</strong>
<a href={link} target="_blank" rel="noreferrer">
<a href={link} target="_blank" rel="noreferrer noopener">
{name}
</a>
</p>
Expand Down Expand Up @@ -72,7 +72,7 @@ export const MaterialsAndMethodsComponent: React.FC<MaterialsAndMethods> = ({
<a
href={datasetFm.link}
target="_blank"
rel="noreferrer"
rel="noreferrer noopener"
>
{datasetFm.name}
</a>
Expand All @@ -98,17 +98,23 @@ export const MaterialsAndMethodsComponent: React.FC<MaterialsAndMethods> = ({
label: "Protocols",
children: (
<ul>
{protocols.map((item, index) => (
<li key={index}>
<a
href={item.protocol}
target="_blank"
rel="noreferrer"
>
{item.protocol.split("/").pop()}
</a>
</li>
))}
{protocols.map((item, index) => {
const href =
item.type === "protocolLink"
? item.url
: item.file?.publicURL;
return (
<li key={index}>
<a
href={href ?? "#"}
target="_blank"
rel="noreferrer noopener"
>
{item.name}
</a>
</li>
);
})}
</ul>
),
});
Expand Down
8 changes: 6 additions & 2 deletions src/pages/ideas/dev-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ preliminaryFindings:
materialsAndMethods:
dataset: Released EMT dataset
protocols:
# - protocol: /protocols/emt_junction_segmentation.pdf
# - protocol: /protocols/emt_tracking_qc.pdf
- type: protocolLink
name: Culture And Freezing Methods
url: https://cell-catalog.allencell.org/pdf/AICS_WTC_cell_culture_protocol.pdf
- type: protocolFile
name: Cell culture protocol
file: /img/cell_culture_protocol.pdf
Comment on lines +30 to +35
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The type field is created by Decap when you use a variable type widget.

Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

The schema uses file: File @fileByRelativePath, which typically expects a relative path like img/cell_culture_protocol.pdf (no leading slash). Using /img/... may prevent Gatsby from resolving the File node, resulting in file being null and the UI falling back to #. Align the stored value with what @fileByRelativePath expects (or adjust the CMS public_folder/value format accordingly).

Suggested change
file: /img/cell_culture_protocol.pdf
file: img/cell_culture_protocol.pdf

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure about this, it's working as is, and its the same way the img file path for the banner was written.

cellLines:
- name: AICS-42
link: https://allencell.org/cell-catalog
Expand Down
7 changes: 6 additions & 1 deletion src/templates/idea-post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,12 @@ export const pageQuery = graphql`
}
}
protocols {
protocol
type
name
url
file {
publicURL
}
}
cellLines {
name
Expand Down
54 changes: 46 additions & 8 deletions static/admin/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,45 @@ collections:
widget: "list",
required: false,
hint: "List any relevant protocols used in this analysis.",
field:
{
label: "Protocol",
name: "protocol",
widget: "file",
},
types:
[
{
label: "Protocol link",
name: "protocolLink",
widget: "object",
fields:
[
{
label: "Name",
name: "name",
widget: "string",
},
{
label: "URL",
name: "url",
widget: "string",
},
],
},
{
label: "Protocol file",
name: "protocolFile",
widget: "object",
fields:
[
{
label: "Name",
name: "name",
widget: "string",
},
{
label: "File",
name: "file",
widget: "file",
},
],
},
],
},
{
label: "Cell lines used",
Expand Down Expand Up @@ -173,7 +206,7 @@ collections:
hint: "Optionally provide a custom or supplementary description for how this tool was used in this specific analysis. Leave blank to use the default description.",
},
],
}
},
],
}
- {
Expand Down Expand Up @@ -330,7 +363,12 @@ collections:
options: ["Public", "In development", "Internal use only"],
required: false,
}
- { label: "Publish Date", name: "date", widget: "datetime", required: false }
- {
label: "Publish Date",
name: "date",
widget: "datetime",
required: false,
}

- name: "pages"
label: "Pages"
Expand Down
Binary file added static/img/cell_culture_protocol.pdf
Binary file not shown.