CI / Typecheck, lint, tests, e2e (push) Failing after 3m51s
- Title screen over a real-time voxel office rendered at low resolution and quantized to a rotating 32-colour palette with Bayer dithering; day part and season re-light the scene and every surface. - 16-bit UI kit: name-plate dialogs, menu cursor, inventory, XP bar, badges, NPC speech, GAME OVER with CONTINUE, hand-placed 12x12 icons, Fusion Pixel font (Latin subset preloaded). - Sections as a game: quest log (onboarding), character select (AI CEO / AI Co-Founder), inventory (features), party roster (providers), live download XP, save point (all v1.5.1 builds), FAQ as NPC dialog, credits. - Downloads and source point to the Gitea release; the download function only redirects to git.zacharyzhang.com. - Tailwind and the old components removed; unit tests for platform/downloads, rewritten e2e suite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
55 lines
1.8 KiB
TypeScript
55 lines
1.8 KiB
TypeScript
"use client";
|
|
|
|
import { useEffect, useRef, useState } from "react";
|
|
import { Dialog, MenuList } from "../pixel";
|
|
import { nav } from "../../lib/content";
|
|
import styles from "./top-bar.module.css";
|
|
|
|
/** Phone navigation: a MENU button that opens a pause-menu window; Escape or a pick closes it. */
|
|
export function SiteMenu() {
|
|
const [open, setOpen] = useState(false);
|
|
const root = useRef<HTMLDivElement>(null);
|
|
const button = useRef<HTMLButtonElement>(null);
|
|
|
|
useEffect(() => {
|
|
if (!open) return;
|
|
root.current!.querySelector<HTMLElement>('[role="menuitem"]')!.focus();
|
|
const onKeyDown = (event: KeyboardEvent) => {
|
|
if (event.key !== "Escape") return;
|
|
setOpen(false);
|
|
button.current!.focus();
|
|
};
|
|
const onPointerDown = (event: PointerEvent) => {
|
|
if (!root.current!.contains(event.target as Node)) setOpen(false);
|
|
};
|
|
document.addEventListener("keydown", onKeyDown);
|
|
document.addEventListener("pointerdown", onPointerDown);
|
|
return () => {
|
|
document.removeEventListener("keydown", onKeyDown);
|
|
document.removeEventListener("pointerdown", onPointerDown);
|
|
};
|
|
}, [open]);
|
|
|
|
return (
|
|
<div ref={root} className={styles.menu}>
|
|
<button
|
|
ref={button}
|
|
type="button"
|
|
className={styles.menuButton}
|
|
aria-expanded={open}
|
|
aria-controls="site-menu"
|
|
onClick={() => setOpen((value) => !value)}
|
|
>
|
|
{open ? "▼" : "▶"} Menu
|
|
</button>
|
|
{open ? (
|
|
<div id="site-menu" className={styles.popover}>
|
|
<Dialog title="Paused" as="div">
|
|
<MenuList label="Sections" items={nav.map((link) => ({ label: link.label, href: link.href, onSelect: () => setOpen(false) }))} />
|
|
</Dialog>
|
|
</div>
|
|
) : null}
|
|
</div>
|
|
);
|
|
}
|