From 798a65f53e3b1bf4a2b7f5bd89ea17d7cfce1c60 Mon Sep 17 00:00:00 2001 From: Sami Fouad Date: Sat, 7 Nov 2026 02:14:33 -0600 Subject: [PATCH] An app's site shows the app: a screenshot hero and a tour of screens, both themes; rixse lives at rixse.addis.gg (0.2.7) --- package-lock.json | 4 ++-- package.json | 2 +- src/tool/index.tsx | 56 ++++++++++++++++++++++++++++++++++++++++----- src/tool/tool.css | 29 +++++++++++++++++++++++ src/tool/tools.ts | 2 +- tests/tool.test.mjs | 29 +++++++++++++++++++++++ 6 files changed, 112 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 22e6025..cedae4f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@addiscorp/kit", - "version": "0.2.6", + "version": "0.2.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@addiscorp/kit", - "version": "0.2.6", + "version": "0.2.7", "license": "Apache-2.0", "devDependencies": { "@types/react": "19.2.7", diff --git a/package.json b/package.json index 71caa1a..3a4b095 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@addiscorp/kit", - "version": "0.2.6", + "version": "0.2.7", "description": "The header, footer, theme and tool-site layout every Addis site shares, in each project's own brand colours.", "license": "Apache-2.0", "type": "module", diff --git a/src/tool/index.tsx b/src/tool/index.tsx index 24d1e24..d8ad09e 100644 --- a/src/tool/index.tsx +++ b/src/tool/index.tsx @@ -67,8 +67,21 @@ export type ReelScene = { title: string; caption: string; lines: ReelLine[] }; const SCENE_SECONDS = 5; -/** The hero: headline, buttons, install commands under them, and the demo reel on the right. */ -export function Hero({ headline, sub, status, docs = '/docs/', github, installs, reel, Link = PlainLink }: { +/** + * A screenshot of the app, in each theme: images the site serves itself + * (`dark` when the app looks different on a dark ground). Width and height + * are the image's own, so the page keeps its place while it loads. + */ +export type Shot = { light: string; dark?: string; alt: string; width: number; height: number }; +/** A screen of the app and what it shows, for the tour. */ +export type Feature = { title: string; text: string; shot: Shot }; + +/** + * The hero: headline, buttons, install commands under them, and the demo + * beside them: the reel for a tool you run in a terminal, or, for an app, a + * screenshot of it, under the words and as wide as the page. + */ +export function Hero({ headline, sub, status, docs = '/docs/', github, installs, reel, shot, Link = PlainLink }: { headline: Headline; sub: string; /** Where the tool stands, when a visitor should know before installing: "Early: not yet audited." */ @@ -78,11 +91,10 @@ export function Hero({ headline, sub, status, docs = '/docs/', github, installs, github?: string; /** Empty until the tool can be installed; say why in `status`. */ installs: Install[]; - reel: ReelScene[]; Link?: LinkComponent; -}) { +} & ({ reel: ReelScene[]; shot?: never } | { shot: Shot; reel?: never })) { return ( -
+

{headline.before}{headline.accent}{headline.after}

{sub}

@@ -100,7 +112,39 @@ export function Hero({ headline, sub, status, docs = '/docs/', github, installs, ))}
} - + {shot ? : } +
+ ); +} + +/** A screenshot in a window frame, in the page's theme. */ +export function Screen({ shot, eager = false }: { shot: Shot; eager?: boolean }) { + const img = (src: string, className?: string) => ( + {shot.alt} + ); + return ( +
+ + {shot.dark ? <>{img(shot.light, 'akt-light')}{img(shot.dark, 'akt-dark')} : img(shot.light)} +
+ ); +} + +/** The app, screen by screen: what each one is for, beside it, sides alternating. */ +export function Tour({ features, title = 'A look around' }: { features: Feature[]; title?: string }) { + return ( +
+

{title}

+ {features.map((feature) => ( +
+
+
+

{feature.title}

+

{feature.text}

+
+ +
+ ))}
); } diff --git a/src/tool/tool.css b/src/tool/tool.css index 6cc241b..21c671a 100644 --- a/src/tool/tool.css +++ b/src/tool/tool.css @@ -56,6 +56,33 @@ .akt-copy { flex: none; border: 1px solid var(--akt-faint); border-radius: 5px; background: transparent; padding: 2px 8px; font: 11px var(--akt-mono); color: var(--akt-soft); cursor: pointer; } .akt-copy:hover { color: var(--akt-ink); } +/* An app's hero: the words, then the app as wide as the page. */ +.akt-hero-app { grid-template-columns: minmax(0, 1fr); gap: 44px; padding-bottom: 40px; } +.akt-hero-app h1 { font-size: clamp(36px, 5vw, 60px); } +.akt-hero-app .akt-sub { max-width: 52ch; } + +/* A screenshot in a window frame; both themes' images drawn, the theme shows one. */ +.akt-screen { margin: 0; border: 1px solid var(--akt-faint); border-radius: 12px; overflow: hidden; background: var(--akt-card); box-shadow: 0 30px 70px -40px rgb(0 0 0 / .55); } +.akt-screen img { display: block; width: 100%; height: auto; } +.akt-chrome { display: flex; gap: 7px; padding: 10px 14px; border-bottom: 1px solid var(--akt-faint); } +.akt-chrome i { width: 10px; height: 10px; border-radius: 50%; background: var(--akt-faint); } +.akt-screen .akt-dark { display: none; } +:root[data-theme="dark"] .akt-screen .akt-light { display: none; } +:root[data-theme="dark"] .akt-screen .akt-dark { display: block; } +@media (prefers-color-scheme: dark) { + :root:not([data-theme="light"]) .akt-screen .akt-light { display: none; } + :root:not([data-theme="light"]) .akt-screen .akt-dark { display: block; } +} + +/* The tour: a screen and what it's for, sides alternating. */ +.akt-tour { padding: 40px 0 24px; } +.akt-tour h2 { font: 800 30px/1.1 var(--akt-display); letter-spacing: -0.02em; margin: 0 0 28px; } +.akt-feature { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr); gap: 44px; align-items: center; padding: 28px 0; } +.akt-feature:nth-of-type(even) .akt-feature-text { order: 2; } +.akt-feature:nth-of-type(even) { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); } +.akt-feature h3 { font: 700 22px/1.2 var(--akt-display); margin: 0 0 10px; } +.akt-feature p { margin: 0; color: var(--akt-soft); } + /* The demo reel: dark in both themes, tinted with the brand. */ .akt-reel { background: var(--akt-reel); color: #E8ECEF; border: 1px solid var(--akt-reelline); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; min-height: 340px; box-shadow: 0 20px 50px -30px rgb(0 0 0 / .5); } .akt-stage { display: grid; flex: 1; } @@ -142,6 +169,8 @@ .akt-code .akt-copy { position: absolute; top: 12px; right: 12px; } @media (max-width: 860px) { + .akt-feature, .akt-feature:nth-of-type(even) { grid-template-columns: minmax(0, 1fr); gap: 18px; } + .akt-feature:nth-of-type(even) .akt-feature-text { order: 0; } .akt-main { width: calc(100% - 32px); } .akt > .ak-foot { width: calc(100% - 32px); } .akt-hero { grid-template-columns: minmax(0, 1fr); padding: 44px 0 40px; gap: 36px; } diff --git a/src/tool/tools.ts b/src/tool/tools.ts index 161ddbd..bdfa6ac 100644 --- a/src/tool/tools.ts +++ b/src/tool/tools.ts @@ -12,7 +12,7 @@ export type ToolInfo = { }; export const TOOLS: ToolInfo[] = [ - { id: 'rixse', domain: 'rixse.dev', short: 'The gateway. Agents ask, you decide.' }, + { id: 'rixse', domain: 'rixse.addis.gg', short: 'The gateway. Agents ask, you decide.' }, { id: 'mirab', domain: 'mirab.addis.gg', short: 'Agents in VMs on your own machine.' }, { id: 'woreda', domain: 'woreda.addis.gg', short: 'Self-hosted GitHub Actions runners.' }, { id: 'kebele', domain: 'kebele.addis.gg', short: 'Container stacks over the Docker socket.' }, diff --git a/tests/tool.test.mjs b/tests/tool.test.mjs index 37988f8..3c5d787 100644 --- a/tests/tool.test.mjs +++ b/tests/tool.test.mjs @@ -154,3 +154,32 @@ test('a "works with" card takes the third benefit’s place: logos where given, assert.equal(three.querySelector('.akt-works'), null); assert.equal(three.querySelectorAll('.akt-cards > .akt-card').length, 4); }); + +const shot = (name) => ({ light: `/shots/${name}-light.png`, dark: `/shots/${name}-dark.png`, alt: `the ${name} screen`, width: 1440, height: 900 }); + +test('an app’s hero shows the app: its screenshot in both themes, under the words, and no reel', () => { + const doc = page(h(kit.Hero, { headline: { before: 'a ', accent: 'b' }, sub: 's', installs: [], shot: shot('channel') })); + assert.ok(doc.querySelector('.akt-hero').classList.contains('akt-hero-app')); + assert.equal(doc.querySelector('.akt-reel'), null); + const imgs = [...doc.querySelectorAll('.akt-screen img')]; + assert.deepEqual(imgs.map((i) => [i.getAttribute('src'), i.className, i.getAttribute('alt'), i.getAttribute('width'), i.getAttribute('loading')]), [ + ['/shots/channel-light.png', 'akt-light', 'the channel screen', '1440', 'eager'], + ['/shots/channel-dark.png', 'akt-dark', 'the channel screen', '1440', 'eager'], + ]); +}); + +test('the theme shows one of a screenshot’s two images', () => { + const css = readFileSync(new URL('../dist/tool.css', import.meta.url), 'utf8'); + assert.match(css, /\.akt-screen \.akt-dark \{ display: none; \}/); + assert.match(css, /:root\[data-theme="dark"\] \.akt-screen \.akt-light \{ display: none; \}/); + assert.match(css, /:root:not\(\[data-theme="light"\]\) \.akt-screen \.akt-dark \{ display: block; \}/); +}); + +test('the tour shows each screen with what it’s for, loaded as the visitor scrolls', () => { + const features = [{ title: 'Org', text: 'seats', shot: shot('org') }, { title: 'Access', text: 'rules', shot: { ...shot('access'), dark: undefined } }]; + const doc = page(h(kit.Tour, { features })); + const rows = [...doc.querySelectorAll('.akt-feature')]; + assert.deepEqual(rows.map((r) => r.querySelector('h3').textContent), ['Org', 'Access']); + assert.deepEqual(rows.map((r) => r.querySelectorAll('img').length), [2, 1]); + assert.ok([...doc.querySelectorAll('img')].every((i) => i.getAttribute('loading') === 'lazy')); +});