Skip to content

Commit 0993f47

Browse files
Merge pull request #110 from strudel-science/feature/showcase
Add initial app gallery
2 parents 67b2ea5 + 088c778 commit 0993f47

File tree

13 files changed

+413
-4
lines changed

13 files changed

+413
-4
lines changed

config/strudel-config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@
192192
"layoutComponent": "PageLayout"
193193
}
194194
]
195+
},
196+
{
197+
"name": "Gallery",
198+
"path": "/gallery"
195199
}
196200
]
197201
}

content/gallery/ameriflux.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: 'Ameriflux Dashboard'
3+
slug: 'ameriflux-dashboard'
4+
contributors: ['Sy-Toan Ngo']
5+
appType: 'Live Project'
6+
repoUrl: ''
7+
liveUrl: ''
8+
primaryImage: '../images/gallery/ameriflux-1.png'
9+
otherImages: ['../images/gallery/ameriflux-2.png', '../images/gallery/ameriflux-3.png']
10+
---
11+
12+
The Ameriflux Dashboard is a monitoring tool designed to track real-time data status across the network, providing visibility into key stages such as uploads, processing and data availabilities. The teams can scan for potential issues instantly, enabling swift action to resolve discrepancies and maintain high standards.
245 KB
Loading
270 KB
Loading
233 KB
Loading

gatsby-config.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const config: GatsbyConfig = {
2424
options: {
2525
name: 'content',
2626
path: `${__dirname}/content`,
27-
ignore: [`**/engage/events/*`, `**/engage/news/*`],
27+
ignore: [`**/engage/events/*`, `**/engage/news/*`, `${__dirname}/content/gallery/*`],
2828
}
2929
},
3030
{
@@ -41,6 +41,13 @@ const config: GatsbyConfig = {
4141
path: `${__dirname}/content/engage/news`,
4242
}
4343
},
44+
{
45+
resolve: 'gatsby-source-filesystem',
46+
options: {
47+
name: 'gallery',
48+
path: `${__dirname}/content/gallery`,
49+
}
50+
},
4451
{
4552
resolve: 'gatsby-source-filesystem',
4653
options: {

gatsby-node.ts

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import path from "path";
22
import type { GatsbyNode } from "gatsby";
33
import { flattenPages } from "./src/utils/utils";
4-
import { EventFrontmatter, NewsFrontmatter, PageFrontmatter, StrudelPage, TaskFlowFrontmatter } from "./src/types/strudel-config";
4+
import { EventFrontmatter, GalleryFrontmatter, NewsFrontmatter, PageFrontmatter, StrudelPage, TaskFlowFrontmatter } from "./src/types/strudel-config";
55

66
/**
77
* Shape of the result from the graphql query
@@ -44,6 +44,17 @@ interface Result {
4444
}
4545
}[]
4646
}
47+
gallery: {
48+
nodes: {
49+
frontmatter: GalleryFrontmatter,
50+
internal: {
51+
contentFilePath: string;
52+
},
53+
fields: {
54+
source: string;
55+
}
56+
}[]
57+
}
4758
}
4859
}
4960

@@ -159,6 +170,37 @@ export const createPages: GatsbyNode["createPages"] = async ({
159170
}
160171
}
161172
}
173+
gallery: allMdx(filter: {fields: {source: {eq: "gallery"}}}) {
174+
nodes {
175+
fields {
176+
source
177+
}
178+
frontmatter {
179+
title
180+
slug
181+
contributors
182+
appType
183+
repoUrl
184+
liveUrl
185+
primaryImage {
186+
childImageSharp {
187+
gatsbyImageData
188+
}
189+
absolutePath
190+
}
191+
otherImages {
192+
childImageSharp {
193+
gatsbyImageData
194+
}
195+
absolutePath
196+
}
197+
}
198+
excerpt
199+
internal {
200+
contentFilePath
201+
}
202+
}
203+
}
162204
}
163205
`
164206
);
@@ -173,6 +215,7 @@ export const createPages: GatsbyNode["createPages"] = async ({
173215
const mdxPages = result.data?.content.nodes;
174216
const eventPages = result.data?.events.nodes;
175217
const newsPages = result.data?.news.nodes;
218+
const galleryPages = result.data?.gallery.nodes;
176219

177220
/**
178221
* Create a page for each page object that has an associated markdown file.
@@ -243,6 +286,22 @@ export const createPages: GatsbyNode["createPages"] = async ({
243286
})
244287
}
245288

289+
/**
290+
* Create a page for each gallery mdx node.
291+
*/
292+
if (galleryPages) {
293+
const galleryTemplate = path.resolve(`src/components/layouts/GalleryDetailLayout.tsx`)
294+
galleryPages.forEach((galleryPage) => {
295+
createPage({
296+
path: `/gallery/${galleryPage.frontmatter.slug}`,
297+
component: `${galleryTemplate}?__contentFilePath=${galleryPage.internal.contentFilePath}`,
298+
context: {
299+
frontmatter: galleryPage.frontmatter,
300+
}
301+
});
302+
})
303+
}
304+
246305
/**
247306
* Add redirects for top-level routes that
248307
* don't have specific pages associated with them.

package-lock.json

Lines changed: 16 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
"gatsby-transformer-json": "^5.12.0",
3838
"gatsby-transformer-sharp": "^5.13.0",
3939
"react": "^18.2.0",
40-
"react-dom": "^18.2.0"
40+
"react-dom": "^18.2.0",
41+
"react-photo-view": "^1.2.7"
4142
},
4243
"devDependencies": {
4344
"@types/gatsbyjs__reach-router": "^2.0.3",

src/components/ResponsiveImageWrapper.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ export const ResponsiveImageWrapper: React.FC<BoxProps> = ({ sx, children, ...re
2222
'& .gatsby-resp-image-wrapper .gatsby-resp-image-link': {
2323
width: 'auto !important'
2424
},
25+
'& > img': {
26+
width: '100%',
27+
height: 'auto',
28+
cursor: 'pointer',
29+
},
2530
...sx
2631
}}
2732
>

0 commit comments

Comments
 (0)