Skip to content

query more of the text fields in markdown and make figure component#37

Open
interim17 wants to merge 15 commits intomainfrom
feature/more-queries
Open

query more of the text fields in markdown and make figure component#37
interim17 wants to merge 15 commits intomainfrom
feature/more-queries

Conversation

@interim17
Copy link
Contributor

@interim17 interim17 commented Feb 6, 2026

Update:
In response to @jessicasyu nicely stress testing the figures data entry, I pushed up a few changes

Problem

Advances #7

  • querying the various fields in the markdown that we weren't rendering yet: preliminary findings, next steps, authors, publication
  • build a very basic component as a container for figures, can expand on this later

Not a polished design, but it's easier to picture the final result if add better placeholders, and actually query and render the data. Then we can design around something more reasonable.

Screenshot 2026-02-05 at 7 13 48 PM ing-system.url/ticket-number)

@interim17 interim17 requested a review from Copilot February 6, 2026 03:17
@netlify
Copy link

netlify bot commented Feb 6, 2026

Deploy Preview for project-idea-board ready!

Name Link
🔨 Latest commit 397a360
🔍 Latest deploy log https://app.netlify.com/projects/project-idea-board/deploys/698a7c37631df500089652c6
😎 Deploy Preview https://deploy-preview-37--project-idea-board.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the idea post template by querying and rendering additional markdown frontmatter fields that were previously not displayed, including authors, publication info, preliminary findings with figures, and next steps. A new Figure component was created to display images with captions.

Changes:

  • Added type definitions for PreliminaryFindings and Figure to support the new data structures
  • Created a FigureComponent to render images with captions in a styled card container
  • Updated the idea post template to display authors, publication, preliminary findings with figures, and next steps as a formatted list

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/types/index.ts Added type exports for PreliminaryFindings and Figure
src/templates/idea-post.tsx Integrated new fields into template, added Figure rendering, and updated GraphQL query
src/style/figure.module.css Added styling for figure container and captions with responsive design
src/pages/ideas/dev-example.md Reformatted markdown structure and updated example content
src/components/Figure.tsx Created new component to render figures with GatsbyImage and captions
gatsby-node.js Added schema definitions and resolvers for new frontmatter fields

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

export type IdeasForTags = Queries.AllIdeasForTagsQuery["allMarkdownRemark"]["edges"];

export type PreliminaryFindings = NonNullable<IdeaFrontmatter["preliminaryFindings"]>;
export type Figure = NonNullable<IdeaFrontmatter["preliminaryFindings"]>["figures"][number] No newline at end of file

This comment was marked as resolved.

@interim17 interim17 requested a review from Copilot February 9, 2026 23:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

import React from "react";
import { Helmet } from "react-helmet-async";
import { graphql, Link, PageProps } from "gatsby";
import { GatsbyImage, getImage } from "gatsby-plugin-image";

This comment was marked as resolved.

Comment on lines 113 to 120
{hasFigures &&
preliminaryFindings.figures.map((figure) => {
return (
<FigureComponent
figure={figure}
/>
);
})}

This comment was marked as resolved.

Comment on lines 124 to 133
{nextSteps && (
<div className={section}>
<h2 className={sectionTitle}>Suggested next steps:</h2>
{nextSteps}
<h4 className={sectionTitle}>Suggested next steps:</h4>
<ul>
{nextSteps.map((step: string, index: number) => (
<li key={index}>{step}</li>
))}
</ul>
</div>
)}

This comment was marked as resolved.

Comment on lines +145 to +159
preliminaryFindings: {
resolve: (source) => {
const raw = source.preliminaryFindings;
if (!raw || typeof raw !== "object") {
return {
summary: "",
figures: [],
};
}
return {
summary: stringWithDefault(raw.summary, ""),
figures: resolveToArray(raw.figures),
};
},
},

This comment was marked as resolved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Handled this slightly differently

Comment on lines +70 to +75
type ImgWithCaption @dontInfer {
type: String!
url: String
file: File @fileByRelativePath
caption: String
}

This comment was marked as resolved.

caption
}
}
publication

This comment was marked as resolved.

Comment on lines +97 to +137
types:
[
{
label: "Image link",
name: "imageLink",
widget: "object",
fields: [
{
label: "Figure URL",
name: "url",
widget: "url-image",
hint: "Enter a valid image URL to see a preview",
},
{
label: "Caption",
name: "caption",
widget: "string",
required: false,
},
],
},
{
label: "Image file",
name: "imageFile",
widget: "object",
fields: [
{
label: "Figure",
name: "file",
widget: "image",
choose_url: false,
},
{
label: "Caption",
name: "caption",
widget: "string",
required: false,
},
],
},
],
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 default image widget is nice in the admin page, but a bit of pain when it comes time to query and use a remote URL for an image (like the one Jess added). This sets us up to use our custom url-image widget and preview.

Comment on lines +1 to +26
import React from "react";

// Custom widget for URL-only image input with preview
export const UrlImageControl = ({ value, onChange, forID, classNameWrapper }) => {
return React.createElement(
"div",
{ className: classNameWrapper },
React.createElement("input", {
id: forID,
type: "text",
value: value || "",
onChange: (e) => onChange(e.target.value),
placeholder: "https://example.com/image.png",
style: { width: "100%" },
}),
value &&
React.createElement("img", {
src: value,
alt: "Preview",
style: { display: "block", marginTop: "12px", maxWidth: "100%", maxHeight: "200px" },
})
);
};

export const UrlImagePreview = ({ value }) =>
value ? React.createElement("img", { src: value, alt: "Preview" }) : null;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Custom widget and preview for the CMS.

Essentially all this is is a "string" widget and a preview so that we can get the functionality of an "image" widget without the button that gives the option to load in a local file.

That way when we query by type we know easily which one we are dealing with. The suggested workaround from gatsby seemed like a pain, especially given that we are not storing figures directly on a markdown node:
https://www.gatsbyjs.com/docs/how-to/images-and-media/preprocessing-external-images/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant