add inter-work navigation

This commit is contained in:
41666 2023-10-10 12:31:53 -04:00
parent 23d7810ab6
commit dbc1fd7c17
11 changed files with 104 additions and 7 deletions

View file

@ -95,8 +95,6 @@ export const convertMeshes = async () => {
}
}
console.log({ propertyList });
const vertexCount = Number(
headerLines
.find((header) => header.startsWith("element vertex"))

View file

@ -11,7 +11,18 @@ export const generate = async (works: string[]) => {
.reverse();
for (const work of allWorks) {
const html = `${workTemplate}`.replace(/##name##/g, work);
const workIndex = allWorks.findIndex((w) => w === work);
const previous = allWorks[(workIndex as any) + 1] ?? null;
const next = allWorks[(workIndex as any) - 1] ?? null;
let nav = ``;
if (previous)
nav += `<a class="nav-left" href="/${previous}">⇠ ${previous}</a>`;
if (next) nav += `<a class="nav-right" href="/${next}">${next} ⇢</a>`;
const html = `${workTemplate}`
.replace(/##name##/g, work)
.replace(/##nav##/g, nav);
mkdirSync(`html/${work}`, { recursive: true });
await Bun.write(`html/${work}/index.html`, html);

View file

@ -21,5 +21,8 @@
<main>
<canvas id="canvas" width="1280" height="720"></canvas>
<div id="telemetry">XX.X FPS (XX.X ms)</div>
<nav>
##nav##
</nav>
</main>
<script src="/##name##/main.js" type="module"></script>