Files
caperren-com/src/data/site-layout.ts
Corwin Perren 8fd744118f
Some checks failed
Build and Test - Staging / test (pull_request) Failing after 4m56s
Build and Test - Staging / build_and_push (pull_request) Has been skipped
Build and Test - Staging / deploy_staging (pull_request) Has been skipped
Component for PCBs, many visual tweaks, finished dechorionator content, added many many photos, started work on mars rover software lead, timeline to luxon and automatic date-based ordering
2025-12-12 22:48:03 -08:00

289 lines
7.6 KiB
TypeScript

import type { navLink } from "@interfaces/site-layout.ts";
export const siteLayout: navLink[] = [
{ navText: "About", path: "" },
{ navText: "Education", path: "education" },
{
navText: "Experience",
path: "experience",
children: [
{
navText: "SpaceX",
path: "spacex",
children: [
{
navText: "Hardware Test Engineer I/II",
path: "hardware-test-engineer-i-ii",
},
{
navText: "Avionics Test Engineering Internship",
path: "avionics-test-engineering-internship",
},
],
},
{
navText: "OSU CEOAS Ocean Mixing Group",
path: "osu-ceoas-ocean-mixing-group",
children: [
{
navText: "Student Software/Electrical Engineer",
placeholderEntry: true,
},
{
navText: "Robotic Oceanographic Surface Sampler",
isSubItem: true,
path: "robotic-oceanographic-surface-sampler",
},
{
navText: "LeConte Glacier Deployments",
isSubItem: true,
path: "leconte-glacier-deployments",
},
],
},
{
navText: "OSU Sinnhuber Aquatic Research Lab",
path: "osu-sinnhuber-aquatic-research-laboratory",
children: [
{
navText: "Student Automation Engineer",
placeholderEntry: true,
},
{
enabled: false,
navText: "Zebrafish Embryo Pick and Plate",
isSubItem: true,
path: "zebrafish-embryo-pick-and-plate",
},
{
enabled: false,
navText: "Shuttlebox Behavior System",
isSubItem: true,
path: "shuttlebox-behavior-system",
},
{
navText: "Dechorionator",
isSubItem: true,
path: "dechorionator",
},
{
enabled: false,
navText: "Denso Embryo Pick and Plate",
isSubItem: true,
path: "denso-embryo-pick-and-plate",
},
{
enabled: false,
navText: "ZScan Processor",
isSubItem: true,
path: "zscan-processor",
},
],
},
{
enabled: false,
navText: "OSU Robotics Club",
path: "osu-robotics-club",
children: [
{
enabled: false,
navText: "Mars Rover Software Team Lead",
path: "mars-rover-software-team-lead",
},
{
enabled: false,
navText: "Mars Rover Emergency Software Team Lead",
path: "mars-rover-emergency-software-team-lead",
},
{
enabled: false,
navText: "Mars Rover Electrical Team Lead",
path: "mars-rover-electrical-team-lead",
},
{
enabled: false,
navText: "Club Officer",
path: "club-officer",
},
],
},
],
},
{
navText: "Hobbies",
path: "hobby",
children: [
{
enabled: false,
navText: "Homelab",
path: "homelab",
children: [
{
enabled: false,
navText: "Home Server Rack",
path: "home-server-rack",
},
{
enabled: false,
navText: "Offsite Backup Rack",
path: "offsite-backup-rack",
},
{
enabled: false,
navText: "Kubernetes Cluster",
path: "kubernetes-cluster",
},
{
enabled: false,
navText: "Home Automation",
path: "home-automation",
},
],
},
{
navText: "Motorcycling",
path: "motorcycling",
children: [
{ navText: "Lineup", path: "lineup" },
{
navText: "Custom Accessories",
path: "custom-accessories",
children: [
{
navText: "Chubby Buttons 2 Mount",
path: "chubby-buttons-2-mount",
},
],
},
{
enabled: false,
navText: "Trips",
path: "trips",
children: [
{
navText: "2025-08 | Alaska ",
path: "2025-08-alaska",
enabled: false,
},
{
navText: "2024-10 | Norway ",
path: "2024-10-norway",
enabled: false,
},
],
},
],
},
{
enabled: false,
navText: "Projects",
path: "projects",
children: [
{
navText: "OSSM Overkill Edition",
path: "ossm-overkill-edition",
enabled: false,
},
{
navText: "Rachael Ray Light Box",
path: "rachael-ray-light-box",
enabled: false,
},
{ navText: "Shed Solar", path: "shed-solar", enabled: false },
],
},
{ enabled: false, navText: "NixOS", path: "nixos" },
{ navText: "Body Mods", path: "body-mods" },
{ navText: "This Website", path: "this-website" },
],
},
{
navText: "Resumes",
path: "resume",
children: [
{
enabled: false,
navText: "2025-11-10 | Complete CV",
path: "2025-11-10-complete-cv",
},
{
navText: "2025-11-10 | Infrastructure Engineer",
path: "2025-11-10-infrastructure-engineer",
},
{
navText: "2019-07-01 | Hardware Test Engineer",
path: "2019-07-01-hardware-test-engineer",
},
],
},
{ navText: "Github", pubpath: "https://github.com/caperren" },
{ navText: "LinkedIn", pubpath: "https://www.linkedin.com/in/caperren/" },
];
export const pathToMetadata = (path: string): navLink => {
let paths = path.split("/").filter((entry) => entry);
// Handle root path of /
if (paths.length < 1) {
paths = [""];
}
let currentEntries: navLink[] = siteLayout;
let foundEntry: navLink | undefined;
for (const path of paths) {
for (const currentEntry of currentEntries) {
if (currentEntry.path === path) {
foundEntry = currentEntry;
if (foundEntry.children && foundEntry.children.length > 0) {
currentEntries = foundEntry.children;
}
}
}
}
if (foundEntry === undefined) {
throw new Error(`${path} not found in site layout!`);
}
return foundEntry;
};
export const getPaths = (
currentEntries: navLink[] = siteLayout,
paths: string[] = [],
disabledOnly = false,
): string[] => {
let foundPaths: string[] = [];
for (const currentEntry of currentEntries) {
if (currentEntry.children && currentEntry.children.length > 0) {
foundPaths = [
...foundPaths,
...getPaths(
currentEntry.children,
[...paths, currentEntry.path || ""],
disabledOnly,
),
];
} else {
let enabled = currentEntry.enabled ?? true;
if (disabledOnly ? !enabled : enabled) {
foundPaths.push("/" + [...paths, currentEntry.path || ""].join("/"));
}
}
}
return [...new Set(foundPaths)];
};
export const getNavLinkSuffix = (paths: string[], entry: navLink): string => {
return "-" + [...paths, entry.path].join("-");
};
export const getHrefPath = (paths: string[], entry: navLink): string => {
return entry.pubpath
? entry.pubpath
: "/" +
(paths && paths.length ? [...paths, entry.path].join("/") : entry.path);
};