diff --git a/website/src/components/TerminalDemo.astro b/website/src/components/TerminalDemo.astro index 65e3714..6db96aa 100644 --- a/website/src/components/TerminalDemo.astro +++ b/website/src/components/TerminalDemo.astro @@ -10,10 +10,10 @@ import { terminalStory } from "../scripts/terminal-story"; Choose a story step to inspect its result. -

One product. Four decisions.

    {terminalStory.map((step, index) =>
  1. )}

{terminalStory[0]?.detail}

Download this scenario
+

One product. Four decisions.

    {terminalStory.map((step, index) =>
  1. )}

{terminalStory[0]?.detail}

The scenarios use made-up rates, not live provider prices. The real ProfitCTL CLI calculates every result on your device. The story repeats automatically; choosing a step holds its result.

- + @@ -81,22 +89,18 @@ .eyebrow { color: var(--muted); font-size: 11px; line-height: 1.6; font-weight: 600; letter-spacing: .055em; text-transform: uppercase; } h2 { max-width: 520px; margin-top: 15px; font-size: clamp(30px,3.5vw,44px); line-height: 1.16; font-weight: 550; letter-spacing: -.05em; text-wrap: balance; } .video-heading > p { max-width: 440px; font-size: 15px; line-height: 1.7; color: var(--muted); text-wrap: pretty; } - .video-frame { position: relative; } - .video-player { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); } - .video-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 52px; padding: 14px 22px; border: 1px solid var(--line); border-radius: 999px; background: var(--ink); color: var(--on-ink); font-size: 14px; white-space: nowrap; } - .video-play[hidden], .video-error[hidden] { display: none; } - .video-play:hover { outline: 2px solid var(--green); outline-offset: 3px; } + .video-frame { position: relative; overflow: hidden; border-radius: 16px; background: var(--panel); } + .video-player { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; } + .video-toggle { position: absolute; right: 12px; bottom: 12px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); color: var(--ink); cursor: pointer; } + .video-toggle[hidden], .video-error[hidden], .video-toggle[data-playing="true"] .play-icon, .video-toggle:not([data-playing="true"]) .pause-icon { display: none; } + .video-toggle:hover { color: var(--green); } + .video-toggle:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; } .video-error { margin-top: 16px; font-size: 14px; line-height: 1.6; color: var(--risk); } - .video-player:focus-visible { outline: 3px solid var(--green); outline-offset: 5px; } - .video-caption { margin-top: 16px; color: var(--muted); font-size: 12px; line-height: 1.7; } - .video-actions { display: flex; flex-wrap: wrap; gap: 8px 28px; margin-top: 8px; } - .video-actions a { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: var(--green); font-size: 14px; text-underline-offset: 4px; } - .video-summary { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.7; } - .video-summary summary { width: fit-content; min-height: 44px; padding-block: 9px; cursor: pointer; font-weight: 550; } - .video-summary p { max-width: 850px; margin-top: 12px; color: var(--muted); } + .visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; } @media (max-width: 760px) { .video-overview { padding-bottom: 40px; } .video-heading { grid-template-columns: 1fr; gap: 18px; } - .video-player { border-radius: 12px; } + .video-frame { border-radius: 12px; } + .video-toggle { right: 8px; bottom: 8px; } } diff --git a/website/src/scripts/terminal-demo.ts b/website/src/scripts/terminal-demo.ts index 1b8bd21..cf89d7b 100644 --- a/website/src/scripts/terminal-demo.ts +++ b/website/src/scripts/terminal-demo.ts @@ -7,7 +7,6 @@ export function initializeTerminalDemo() { const output = root.querySelector("[data-terminal-output]")!; const status = root.querySelector("[data-terminal-status]")!; const detail = root.querySelector("[data-terminal-detail]")!; - const download = root.querySelector("[data-terminal-download]")!; const steps = [...root.querySelectorAll("[data-terminal-step]")]; const reducedMotion = matchMedia("(prefers-reduced-motion: reduce)"); const playback = new EventTarget(); @@ -46,7 +45,7 @@ export function initializeTerminalDemo() { return new Promise<{ output: string; exitCode: number }>((resolve, reject) => { const cleanup = () => { clearTimeout(timer); signal.removeEventListener("abort", abort); }; const abort = () => { cleanup(); worker?.terminate(); worker = undefined; reject(signal.reason); }; - const timer = setTimeout(() => { cleanup(); worker?.terminate(); worker = undefined; reject(new Error("The demo took too long. Please retry or run the downloaded scenario locally.")); }, 45000); + const timer = setTimeout(() => { cleanup(); worker?.terminate(); worker = undefined; reject(new Error("The demo took too long. Select a step to retry.")); }, 45000); signal.addEventListener("abort", abort, { once: true }); worker!.onerror = () => { cleanup(); reject(new Error("The demo could not start. Please retry or run the scenario locally.")); }; worker!.onmessage = (event) => { @@ -66,7 +65,6 @@ export function initializeTerminalDemo() { const step = terminalStory[index]!; steps.forEach((button, position) => button.setAttribute("aria-current", position === index ? "step" : "false")); detail.textContent = step.detail; - download.href = `/demo/${step.scenario}.yml`; command.textContent = "$ "; output.textContent = ""; root!.dataset.state = "running"; @@ -75,7 +73,7 @@ export function initializeTerminalDemo() { else for (const character of text) { await wait(18, signal); command.textContent += character; } status.textContent = "Running ProfitCTL…"; const result = await execute(index, signal); - if (result.exitCode !== step.exitCode) throw new Error("The scenario returned an unexpected result. Download it to inspect the inputs."); + if (result.exitCode !== step.exitCode) throw new Error("The scenario returned an unexpected result. Select a step to retry."); const transcript = result.output.replace(/\x1b\[[0-9;]*m/g, ""); for (const line of transcript.trimEnd().split("\n")) { await wait(reducedMotion.matches ? 1 : 45, signal);