Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New projects page #69

Merged
merged 47 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
3a56185
project cards
bianca2511 Mar 27, 2024
8291066
prettify the fonts
bianca2511 Mar 28, 2024
e5fcd86
fix h1 margin
bianca2511 Mar 28, 2024
5d3e0eb
Initial setup of decap for projects
DusterTheFirst Mar 28, 2024
20f38c8
Update all important dependencies
DusterTheFirst Mar 28, 2024
94f6327
tried adding background and failed
bianca2511 Mar 30, 2024
abe4f13
added many things
bianca2511 Mar 30, 2024
eb149cb
added photo, generalized project description section
bianca2511 Mar 30, 2024
22b9e6b
i hate gatsby
bianca2511 Mar 30, 2024
213a164
gatsbyimages stuff
bianca2511 Mar 30, 2024
f132de7
did some decap magic
bianca2511 Mar 30, 2024
8d21fd6
much stuff, fixed styling on images, working on auto generated content
bianca2511 Mar 30, 2024
8e60a19
footer fixing and more zach attempts at making pages
bianca2511 Mar 30, 2024
ce9d4d1
AUTOGENERATED PAGES WORK!! THANK YOU ZACH <3
bianca2511 Mar 30, 2024
a648083
3d stuff and i dont know anymore
bianca2511 Mar 31, 2024
581835e
Fix linter errors
DusterTheFirst Mar 31, 2024
6740d3b
Apply prettier
DusterTheFirst Mar 31, 2024
b737a22
Fix type errors
DusterTheFirst Mar 31, 2024
50d714c
Update actions dependencies, and enable dependabot
DusterTheFirst Mar 31, 2024
72a4686
More workflow changes
DusterTheFirst Mar 31, 2024
9252df8
Oops my bad, there is no v4
DusterTheFirst Mar 31, 2024
6d20702
Allow typechecking even if linting fails
DusterTheFirst Mar 31, 2024
1504324
Update cache action
DusterTheFirst Mar 31, 2024
e80c455
Merge branch 'main' into new_projects_page
DusterTheFirst Apr 26, 2024
281cac8
regenerate yarn.lock
DusterTheFirst Apr 26, 2024
c3f281f
remove autoprefixer
DusterTheFirst Apr 26, 2024
af74884
make gallery contained, reusability for stats
bianca2511 May 14, 2024
2e3a0e4
Merge branch 'main' into new_projects_page
DusterTheFirst May 15, 2024
413646a
Prettier
DusterTheFirst May 15, 2024
9c7d181
upgrade dependencies
DusterTheFirst May 15, 2024
1f361d8
Fix prettier and eslint
DusterTheFirst May 15, 2024
198e496
apply prettier
DusterTheFirst May 15, 2024
d64cb1b
Solve typecheck errors with eslint
DusterTheFirst May 15, 2024
889fcad
fix typescript
DusterTheFirst May 15, 2024
ca32234
Specs configurable through decap
DusterTheFirst May 15, 2024
27ac74c
Sponsor update: remove nxp, add bossard with placeholder
DusterTheFirst May 15, 2024
159b4f3
Bossard sponsor text
DusterTheFirst May 16, 2024
c4b2253
Update packages and fix scss ordering
DusterTheFirst Jul 29, 2024
e1624fe
Disable pages not used or referenced, and projects page
DusterTheFirst Jul 29, 2024
0246d8e
Update Team “23-24” (#89)
bianca2511 May 28, 2024
6515007
Bump crate-ci/typos from 1.21.0 to 1.22.3 (#90)
dependabot[bot] Jun 10, 2024
388ac95
Bump crate-ci/typos from 1.22.3 to 1.22.7 (#91)
dependabot[bot] Jun 17, 2024
d729f7c
Bump crate-ci/typos from 1.22.7 to 1.22.9 (#92)
dependabot[bot] Jun 24, 2024
a098b4d
Bump crate-ci/typos from 1.22.9 to 1.23.1 (#93)
dependabot[bot] Jul 8, 2024
86d89f7
Bump crate-ci/typos from 1.23.1 to 1.23.2 (#94)
dependabot[bot] Jul 15, 2024
6a39ffc
finish merge
DusterTheFirst Jul 29, 2024
fa58e0d
Fix linter and formatter errors
DusterTheFirst Jul 29, 2024
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
31 changes: 0 additions & 31 deletions .eslintrc

This file was deleted.

2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.yarn
content
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/projects/images/sparrow.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/projects/images/untitled-design.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions content/projects/markdown/aegle-v2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Aegle v2
images:
- /me-and-andy-s-mouse-love-child.png
- /untitled-design.png
stats:
- label: Flight Time
value: 30 minutes
- label: Max Speed
value: 1000 km/h
- label: Battery
value: big boi
- label: Wingspan
value: 3 meters
model: /bear.glb
academic_year: 2023
blurb: Drone 2
---
Lorem ipsum dolor sit *amet*, **consectetur** adipiscing [elit](https://google.com). Praesent euismod, ligula eu aliquam maximus, magna mi suscipit libero, eget pretium felis mauris non ligula. Nam eu lectus egestas, suscipit tortor ac, aliquet elit. Sed turpis arcu, scelerisque sed sapien sit amet, sollicitudin efficitur sapien. Sed volutpat dui eros, in semper sapien maximus ac. Duis quis massa ac diam dapibus imperdiet. Vestibulum mattis euismod purus. Praesent sed volutpat ante. Nam interdum lobortis leo, a auctor nisl fermentum sed. Maecenas quam metus, interdum id enim vitae, imperdiet rhoncus mi. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed pharetra, erat at finibus sollicitudin, orci turpis egestas neque, sit amet convallis massa neque eget leo. Aenean ac ipsum auctor, egestas elit ut, semper nisl. Donec mollis, ligula blandit blandit sollicitudin, lectus dolor lacinia mi, vel auctor ante massa quis quam.
18 changes: 18 additions & 0 deletions content/projects/markdown/battery-swap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Battery Swap
images:
- /sparrow.jpg
model: /fishpussy.glb
academic_year: 2023
blurb: Zachary Kohnen passion project
---
> I sucked not super hard

\- joe



* one
* three
* a
* boo
8 changes: 8 additions & 0 deletions content/projects/markdown/birb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
name: Birb
images:
- /untitled-design.png
academic_year: 2022
blurb: zoobie
---
glorpy schlorpy
Binary file added content/projects/models/bear.glb
Binary file not shown.
Binary file added content/projects/models/fishpussy.glb
Binary file not shown.
15 changes: 0 additions & 15 deletions content/sponsors/gold/nxp.md

This file was deleted.

1 change: 1 addition & 0 deletions content/sponsors/images/bossard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
8 changes: 8 additions & 0 deletions content/sponsors/markdown/bossard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
name: Bossard
logo: bossard.svg
url: https://nederland.bossard.com
package: gold
---
Bossard Group is a globally recognized company specializing in fastening solutions, engineering, and logistics services. Headquartered in Zug, Switzerland, Bossard has a significant presence worldwide, providing a broad range of products and services to various industries, including automotive, aerospace, electronics, and manufacturing.
Their comprehensive approach, combining high-quality products, innovative engineering, and efficient logistics, gives them a competitive edge compared to other multinationals in the industry.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
51 changes: 51 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import plugin_typescript from "@typescript-eslint/eslint-plugin";
import plugin_prettier from "eslint-plugin-prettier";
import plugin_react_hooks from "eslint-plugin-react-hooks";
import plugin_jsx_a11y from "eslint-plugin-jsx-a11y";
import plugin_import from "eslint-plugin-import-x";

import parser from "@typescript-eslint/parser";

import config_prettier from "eslint-config-prettier";
import config_typescript from "eslint-plugin-react/configs/recommended.js";

/** @type {import("eslint").Linter.FlatConfig[]} */
export default [
{ ignores: [".yarn/", ".cache/", "public/"] },
config_prettier,
config_typescript,
/** @type {import("eslint").Linter.FlatConfig} */ ({
languageOptions: {
ecmaVersion: 2024,
sourceType: "module",
parser: parser,
parserOptions: {
ecmaFeatures: {
jsx: true,
impliedStrict: true
}
}
},
plugins: {
"@typescript-eslint": /** @type {import("eslint").ESLint.Plugin} */ (/** @type {unknown} */ (plugin_typescript)),
prettier: plugin_prettier,
"react-hooks": plugin_react_hooks,
"jsx-a11y": plugin_jsx_a11y,
import: /** @type {import("eslint").ESLint.Plugin} */ (/** @type {unknown} */ (plugin_import))
},
rules: {
semi: 2,
"@typescript-eslint/explicit-member-accessibility": 2,
"@typescript-eslint/no-explicit-any": 2,
"@typescript-eslint/no-unused-vars": 2,
"@typescript-eslint/interface-name-prefix": 0,
"react/self-closing-comp": 2
},
settings: {
react: {
version: "18"
}
},
files: ["**/*.{ts,tsx,js}"]
})
];
43 changes: 34 additions & 9 deletions gatsby-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,21 @@ const config: GatsbyConfig = {
{
resolve: "gatsby-source-filesystem",
options: {
name: "team-photos",
path: `${__dirname}/content/images/teams`
name: "teams",
path: `${__dirname}/content/teams/json`
}
},
{
resolve: "gatsby-source-filesystem",
resolve: "gatsby-transformer-json",
options: {
name: "teams",
path: `${__dirname}/content/teams`
typeName: "json"
}
},
{
resolve: "gatsby-transformer-json",
resolve: "gatsby-source-filesystem",
options: {
typeName: "json"
name: "team-photos",
path: `${__dirname}/content/teams/images`
}
},
// END team list
Expand All @@ -127,15 +127,40 @@ const config: GatsbyConfig = {
resolve: `gatsby-source-filesystem`,
options: {
name: `sponsors`,
path: `${__dirname}/content/sponsors`
path: `${__dirname}/content/sponsors/markdown`
}
},
`gatsby-transformer-remark`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `sponsors-images`,
path: `${__dirname}/content/images/sponsors`
path: `${__dirname}/content/sponsors/images`
}
},
// END sponsor list

// BEGIN sponsor list
{
resolve: `gatsby-source-filesystem`,
options: {
name: `projects`,
path: `${__dirname}/content/projects/markdown`
}
},
// `gatsby-transformer-remark`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `project-images`,
path: `${__dirname}/content/projects/images`
}
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `project-models`,
path: `${__dirname}/content/projects/models`
}
},
// END sponsor list
Expand Down
128 changes: 114 additions & 14 deletions gatsby-node.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,130 @@
import type { CreatePagesArgs } from "gatsby";
import type { Actions, CreatePagesArgs } from "gatsby";
import type { TeamContext } from "./src/templates/team";
import type { Years } from "./src/queries/team_members";
import type { IGatsbyImageData } from "gatsby-plugin-image";
import type { Statistic } from "./src/queries/projects";

function isYears(years: unknown): years is Years {
return typeof years === "string" && /[0-9]{2}-[0-9]{2}/.test(years);
}

// TODO: keep in sync with useProjects and useTeams
export const createPages = async function ({ actions, graphql }: CreatePagesArgs) {
const { data } = await graphql<Queries.AllTeamsQuery>(`
query AllTeams {
teams: allFile(filter: { sourceInstanceName: { eq: "teams" } }, sort: { name: DESC }) {
nodes {
data: childJson {
year
description
const [{ data: teams }, { data: projects }] = await Promise.all([
graphql<Queries.NodeAllTeamsQuery>(`
query NodeAllTeams {
teams: allFile(filter: { sourceInstanceName: { eq: "teams" } }, sort: { name: DESC }) {
nodes {
data: childJson {
year
description
}
}
}
}
}
`);
`),
graphql<Queries.NodeProjectsQuery>(`
query NodeProjects {
projects: allFile(filter: { sourceInstanceName: { eq: "projects" } }) {
nodes {
slug: name
markdown: childMarkdownRemark {
meta: frontmatter {
name
images
academic_year
blurb
model
stats {
label
value
}
}
html
}
}
}
images: allFile(filter: { sourceInstanceName: { eq: "project-images" } }) {
nodes {
relativePath
childImageSharp {
gatsbyImageData
}
}
}
models: allFile(filter: { sourceInstanceName: { eq: "project-models" } }) {
nodes {
relativePath
publicURL
}
}
}
`)
]);

if (data === undefined) {
throw new TypeError("GraphQL query returns NULL");
if (teams === undefined) {
throw new TypeError("teams query empty");
}

const teams = data.teams.nodes.map((team) => {
console.info("creating team pages");
create_team_pages(teams, actions);

// TODO: FIXME: Projects pages hidden for now
// if (projects === undefined) {
// throw new TypeError("projects query empty");
// }

// console.info("creating project pages");
// create_project_pages(projects, actions);
void projects; // Make ESLint Happy
void create_project_pages; // Make ESLint Happy
};

function create_project_pages({ projects, images, models }: Queries.NodeProjectsQuery, actions: Actions) {
const all_images = new Map(
images.nodes.map((image) => [image.relativePath, image.childImageSharp!.gatsbyImageData!])
);

const all_models = new Map(models.nodes.map((image) => [image.relativePath, image.publicURL]));

for (const project of projects.nodes ?? []) {
const initial_images = project?.markdown?.meta?.images ?? [];
const images = initial_images
.map((image_path) => all_images.get(image_path?.replace(/^\//, "") ?? ""))
.filter((image): image is IGatsbyImageData => image !== undefined);

const model = all_models.get(project?.markdown?.meta?.model?.replace(/^\//, "") ?? "") ?? undefined;

actions.createPage({
path: `/projects/${project.slug}`,
component: `${__dirname}/src/templates/project.tsx`,
context: {
html: project?.markdown?.html ?? "",
name: project?.markdown?.meta?.name ?? "",
academic_year: project?.markdown?.meta?.academic_year ?? 0,
images: images,
blurb: project?.markdown?.meta?.blurb ?? "",
slug: project.slug,
model,
stats: (() => {
const stats = project.markdown?.meta?.stats ?? undefined;
if (stats === undefined) return undefined;

return stats.filter((stat): stat is Statistic => {
if (stat === null) throw TypeError("empty statistic");
if (stat.label === null) throw TypeError("statistic missing field label");
if (stat.value === null) throw TypeError("statistic missing field value");

return true;
});
})()
}
});
}
}

function create_team_pages({ teams: teams_raw }: Queries.NodeAllTeamsQuery, actions: Actions) {
const teams = teams_raw.nodes.map((team) => {
if (team.data === null) throw new TypeError("team data null");
if (!isYears(team.data.year)) throw new TypeError("team year is malformed");
if (team.data.description === null) throw new TypeError("Team has no description");
Expand All @@ -49,4 +149,4 @@ export const createPages = async function ({ actions, graphql }: CreatePagesArgs
}
});
}
};
}
Loading