Website: 16-bit pixel-art rebuild with a live Three.js office, downloads from Gitea v1.5.1
CI / Typecheck, lint, tests, e2e (push) Failing after 3m51s
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>
This commit is contained in:
1 parent
e374bc1e8e
commit
2d7af224dd
112 files changed
+5692
-4223
No files matched your search
@@ -0,0 +1,75 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { Icon, type IconName } from "./icon";
|
||||
import styles from "./pixel.module.css";
|
||||
|
||||
const CHAR_MS = 28;
|
||||
|
||||
/** A character's speech box: lines type out, ▼ blinks when one is done, a click or Enter skips ahead. */
|
||||
export function NpcSay({ speaker, portrait = "bot", lines, typewriter = true }: {
|
||||
speaker: string;
|
||||
portrait?: IconName;
|
||||
lines: string[];
|
||||
typewriter?: boolean;
|
||||
}) {
|
||||
const boxRef = useRef<HTMLElement>(null);
|
||||
const [line, setLine] = useState(0);
|
||||
const [shown, setShown] = useState(0);
|
||||
const [reduced, setReduced] = useState(false);
|
||||
const [onScreen, setOnScreen] = useState(false);
|
||||
const text = lines[line] ?? "";
|
||||
const count = typewriter && !reduced ? Math.min(shown, text.length) : text.length;
|
||||
const done = count === text.length;
|
||||
const last = line === lines.length - 1;
|
||||
|
||||
useEffect(() => {
|
||||
if (!typewriter) return;
|
||||
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return setReduced(true);
|
||||
const observer = new IntersectionObserver(([entry]) => {
|
||||
if (!entry?.isIntersecting) return;
|
||||
setOnScreen(true);
|
||||
observer.disconnect();
|
||||
});
|
||||
observer.observe(boxRef.current!);
|
||||
return () => observer.disconnect();
|
||||
}, [typewriter]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!onScreen || done) return;
|
||||
const timer = window.setTimeout(() => setShown((value) => value + 1), CHAR_MS);
|
||||
return () => window.clearTimeout(timer);
|
||||
}, [onScreen, done, shown]);
|
||||
|
||||
const advance = () => {
|
||||
if (!done) return setShown(text.length);
|
||||
setLine(last ? 0 : line + 1);
|
||||
setShown(0);
|
||||
};
|
||||
|
||||
return (
|
||||
<figure ref={boxRef} className={`${styles.frame} ${styles.npc}`} onClick={advance}>
|
||||
<figcaption className={styles.plate}>{speaker}</figcaption>
|
||||
<div className={styles.portrait} aria-hidden="true">
|
||||
<Icon name={portrait} size={3} />
|
||||
</div>
|
||||
<blockquote className={styles.npcText}>
|
||||
<p className={styles.visuallyHidden} aria-live="polite">{text}</p>
|
||||
<p aria-hidden="true">
|
||||
{text.slice(0, count)}
|
||||
<span className={styles.ghost}>{text.slice(count)}</span>
|
||||
</p>
|
||||
</blockquote>
|
||||
<button
|
||||
type="button"
|
||||
className={styles.advance}
|
||||
data-done={done ? "" : undefined}
|
||||
aria-label={!done ? "Show the whole line" : last ? "Hear it again" : "Next line"}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
advance();
|
||||
}}
|
||||
/>
|
||||
</figure>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user