From 26d2c4bd9970eb58b555604cf515dc0c0170927a Mon Sep 17 00:00:00 2001 From: Sami Fouad Date: Fri, 6 Nov 2026 02:58:38 -0600 Subject: [PATCH] Tool display names (SecureCore) and a per-site footnote under the footer (0.2.4) --- package-lock.json | 4 ++-- package.json | 2 +- src/footer/index.tsx | 5 ++++- src/kit.css | 1 + src/tool/index.tsx | 24 ++++++++++++++---------- src/tool/tools.ts | 9 ++++++++- tests/tool.test.mjs | 23 +++++++++++++++++++++++ 7 files changed, 53 insertions(+), 15 deletions(-) diff --git a/package-lock.json b/package-lock.json index 89dbd84..54b8957 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@addiscorp/kit", - "version": "0.2.3", + "version": "0.2.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@addiscorp/kit", - "version": "0.2.3", + "version": "0.2.4", "license": "Apache-2.0", "devDependencies": { "@types/react": "19.2.7", diff --git a/package.json b/package.json index 14ce12e..15d3d11 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@addiscorp/kit", - "version": "0.2.3", + "version": "0.2.4", "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/footer/index.tsx b/src/footer/index.tsx index cc6c5d7..1fd9821 100644 --- a/src/footer/index.tsx +++ b/src/footer/index.tsx @@ -20,9 +20,11 @@ export type FooterProps = { year?: number; /** Anything else for the end of the footer, before the theme switch. */ children?: ReactNode; + /** A small line under the footer row, e.g. trademark notices. */ + note?: ReactNode; }; -export function Footer({ site, owner = ADDIS, year = new Date().getFullYear(), children }: FooterProps) { +export function Footer({ site, owner = ADDIS, year = new Date().getFullYear(), children, note }: FooterProps) { return ( ); } diff --git a/src/kit.css b/src/kit.css index 35d7e3d..b1a2deb 100644 --- a/src/kit.css +++ b/src/kit.css @@ -108,6 +108,7 @@ .ak-credit { display: inline-flex; align-items: center; gap: 8px; color: var(--ak-ink); text-decoration: none; } .ak-credit img, .ak-owner-mark { width: 32px; height: 32px; border-radius: 50%; } .ak-foot-end { display: inline-flex; align-items: center; gap: 12px; } +.ak-foot-note { flex-basis: 100%; margin: 0; font-size: 11px; line-height: 1.6; color: var(--ak-soft); opacity: .8; } /* The theme switch */ .ak-theme-toggle { box-sizing: border-box; border: 0; background: transparent; border-radius: 4px; color: inherit; cursor: pointer; display: inline-flex; height: 32px; width: 32px; align-items: center; justify-content: center; padding: 8px; } diff --git a/src/tool/index.tsx b/src/tool/index.tsx index 8d3087e..c096ca0 100644 --- a/src/tool/index.tsx +++ b/src/tool/index.tsx @@ -7,9 +7,9 @@ import type { LinkComponent } from '../header/index.js'; import { Footer } from '../footer/index.js'; import { CopyButton } from './copy.js'; import { MARKS } from './marks.js'; -import { TOOLS, toolInfo, type ToolId } from './tools.js'; +import { TOOLS, toolInfo, toolName, type ToolId } from './tools.js'; -export { TOOLS, toolInfo, type ToolId, type ToolInfo } from './tools.js'; +export { TOOLS, toolInfo, toolName, type ToolId, type ToolInfo } from './tools.js'; export { MARKS } from './marks.js'; export { CopyButton } from './copy.js'; @@ -30,12 +30,14 @@ export function Mark({ tool, size = 26 }: { tool: ToolId; size?: number }) { export type HeaderLink = { label: string; href: string }; /** Everything a tool site shows sits inside this: it sets the tool's colours, the header and the footer. */ -export function ToolSite({ tool, home = '/', docs = '/docs/', links = [], Link = PlainLink, children }: { +export function ToolSite({ tool, home = '/', docs = '/docs/', links = [], footnote, Link = PlainLink, children }: { tool: ToolId; home?: string; docs?: string; /** More header links, after docs, for what only this tool has. */ links?: HeaderLink[]; + /** A small line under the footer, e.g. trademark notices. */ + footnote?: ReactNode; Link?: LinkComponent; children: ReactNode; }) { @@ -43,7 +45,7 @@ export function ToolSite({ tool, home = '/', docs = '/docs/', links = [], Link =
- {tool} + {toolName(tool)}
{children}
-
+
); } @@ -147,7 +149,7 @@ export type Benefit = { title: string; text: string }; export function Why({ tool, benefits }: { tool: ToolId; benefits: [Benefit, Benefit, Benefit] }) { return (
-

Why {tool}the short version

+

Why {toolName(tool)}the short version

{benefits.map((benefit) => (
@@ -161,7 +163,7 @@ export function Why({ tool, benefits }: { tool: ToolId; benefits: [Benefit, Bene
{TOOLS.filter((t) => t.id !== tool).map((t) => ( - {t.id} + {t.name ?? t.id} {t.short} ))} @@ -175,7 +177,7 @@ export function Why({ tool, benefits }: { tool: ToolId; benefits: [Benefit, Bene export type DocsPage = { href: string; title: string }; /** The docs, after rixse.dev: the pages down the side, the page on the right. */ -export function DocsLayout({ tool, pages, pathname, eyebrow = 'Documentation', title, lede, note, home = '/', Link = PlainLink, children }: { +export function DocsLayout({ tool, pages, pathname, eyebrow = 'Documentation', title, lede, note, footnote, home = '/', Link = PlainLink, children }: { tool: ToolId; pages: DocsPage[]; pathname: string; @@ -184,6 +186,8 @@ export function DocsLayout({ tool, pages, pathname, eyebrow = 'Documentation', t lede?: string; /** A small note under the page list, e.g. what the docs describe. */ note?: string; + /** A small line under the footer, e.g. trademark notices. */ + footnote?: ReactNode; home?: string; Link?: LinkComponent; children: ReactNode; @@ -193,7 +197,7 @@ export function DocsLayout({ tool, pages, pathname, eyebrow = 'Documentation', t
-
); } diff --git a/src/tool/tools.ts b/src/tool/tools.ts index c6eaf09..4db6ce2 100644 --- a/src/tool/tools.ts +++ b/src/tool/tools.ts @@ -7,6 +7,8 @@ export type ToolInfo = { domain: string; /** One line, as the family list shows it. */ short: string; + /** The name as shown, when it isn't the id: `SecureCore`. */ + name?: string; }; export const TOOLS: ToolInfo[] = [ @@ -17,7 +19,7 @@ export const TOOLS: ToolInfo[] = [ { id: 'gelada', domain: 'gelada.addis.gg', short: 'OS sandboxes, without a container.' }, { id: 'harar', domain: 'harar.addis.gg', short: 'A simple vault for your keys.' }, { id: 'p8', domain: 'p8.addis.gg', short: 'PHP in pure Rust. Memory-safe.' }, - { id: 'securecore', domain: 'securecore.addis.gg', short: 'Every WordPress plugin in its own sandbox.' }, + { id: 'securecore', name: 'SecureCore', domain: 'securecore.addis.gg', short: 'Every WordPress plugin in its own sandbox.' }, ]; export function toolInfo(id: ToolId): ToolInfo { @@ -25,3 +27,8 @@ export function toolInfo(id: ToolId): ToolInfo { if (!info) throw new Error(`unknown tool: ${id}`); return info; } + +/** A tool's name as every site shows it: its display name, else its id. */ +export function toolName(id: ToolId): string { + return toolInfo(id).name ?? id; +} diff --git a/tests/tool.test.mjs b/tests/tool.test.mjs index d16567f..8ae58ef 100644 --- a/tests/tool.test.mjs +++ b/tests/tool.test.mjs @@ -101,3 +101,26 @@ test('docs mark the page you are on, with or without a trailing slash', () => { assert.equal(doc.querySelector('.akt-code pre').textContent, 'p8 hello.php'); assert.ok(doc.querySelector('.akt-code .akt-copy')); }); + +test('a tool with a display name shows it everywhere it is named; the others show their id', () => { + const benefits = [{ title: 'a', text: '1' }, { title: 'b', text: '2' }, { title: 'c', text: '3' }]; + const site = page(h(kit.ToolSite, { tool: 'securecore' }, h(kit.Why, { tool: 'securecore', benefits }))); + assert.equal(site.querySelector('.akt-header .akt-brand').textContent, 'SecureCore'); + assert.equal(site.querySelector('.akt-why h2').textContent, 'Why SecureCorethe short version'); + assert.match(site.querySelector('.ak-foot').textContent, /securecore\.addis\.gg/, 'the domain stays lowercase'); + const docs = page(h(kit.DocsLayout, { tool: 'securecore', pages: [{ href: '/docs/', title: 'Overview' }], pathname: '/docs/', title: 'Overview' }, h('p', null, 'x'))); + assert.equal(docs.querySelector('.akt-side .akt-brand').textContent, 'SecureCoredocs'); + // In another tool's family list: the display name for securecore, the id for every other tool. + const names = [...page(h(kit.Why, { tool: 'harar', benefits })).querySelectorAll('.akt-row strong')].map((s) => s.textContent); + assert.deepEqual(names, kit.TOOLS.filter((t) => t.id !== 'harar').map((t) => (t.id === 'securecore' ? 'SecureCore' : t.id))); + assert.equal(page(h(kit.ToolSite, { tool: 'harar' }, null)).querySelector('.akt-brand').textContent, 'harar'); +}); + +test('a site’s footnote is a line in its footer, on the site and in its docs; without one there is none', () => { + const note = 'WordPress® is a registered trademark of the WordPress Foundation.'; + const site = page(h(kit.ToolSite, { tool: 'securecore', footnote: note }, h('p', null, 'hi'))); + assert.equal(site.querySelector('.ak-foot .ak-foot-note').textContent, note); + const docs = page(h(kit.DocsLayout, { tool: 'securecore', pages: [], pathname: '/docs/', title: 'Overview', footnote: note }, h('p', null, 'x'))); + assert.equal(docs.querySelector('.ak-foot .ak-foot-note').textContent, note); + assert.equal(page(h(kit.ToolSite, { tool: 'harar' }, h('p', null, 'hi'))).querySelector('.ak-foot-note'), null); +});