import type { navLink } from "@interfaces/site-layout.ts"; export const siteLayout: navLink[] = [ { navText: "About", path: "" }, { navText: "Education", path: "education" }, { navText: "Experience", path: "experience", children: [ { enabled: false, navText: "SpaceX", path: "spacex", children: [ { enabled: false, navText: "Hardware Test Engineer I/II", path: "hardware-test-engineer-i-ii", }, { enabled: false, navText: "Avionics Test Engineering Internship", path: "avionics-test-engineering-internship", }, ], }, { navText: "OSU CEOAS Ocean Mixing Group", path: "osu-ceoas-ocean-mixing-group", children: [ { navText: "Robotics Oceanographic Surface Sampler", path: "robotic-oceanographic-surface-sampler", }, { navText: "LeConte Glacier Deployments", path: "leconte-glacier-deployments", }, ], }, { enabled: false, navText: "OSU SARL", path: "osu-sinnhuber-aquatic-research-laboratory", children: [ { enabled: false, navText: "Team Lead", path: "team-lead", }, { enabled: false, navText: "Zebrafish Embryo Pick and Plate", path: "zebrafish-embryo-pick-and-plate", }, { enabled: false, navText: "Shuttlebox Behavior System", path: "shuttlebox-behavior-system", }, { enabled: false, navText: "Dechorionator", path: "dechorionator", }, { enabled: false, navText: "Denso Embryo Pick and Plate", path: "denso-embryo-pick-and-plate", }, { enabled: false, navText: "ZScan Processor", 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: "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)]; };