diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 77c5c86..310b0a6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,6 +38,11 @@ jobs: - name: Format, lint and type-check run: vp run check + # Mzizi's tokens.css is copied from the registry at a pinned commit + # (issue 153); this fails if the copy was edited or no longer matches. + - name: Mzizi tokens match the registry + run: vpx scripts/sync-mzizi-css.mjs --check + # `vp run test` builds the site (Astro, bundled by Vite+'s Vite), runs # the tests (vp test), and then verifies that every inline script in # the build is covered by the CSP hash allowlist in public/_headers — so diff --git a/.prettierignore b/.prettierignore index 4254d65..42c7ad7 100644 --- a/.prettierignore +++ b/.prettierignore @@ -40,3 +40,7 @@ pnpm-lock.yaml # # These files are still type-checked by `npm run check` (astro check). *.astro + +# Mzizi's tokens.css, copied byte for byte from the registry by +# scripts/sync-mzizi-css.mjs (issue 153). vite.config.ts's fmt block skips it too. +src/styles/mzizi/ diff --git a/astro.config.mjs b/astro.config.mjs index 72777d4..8d06395 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -3,6 +3,16 @@ import { defineConfig } from "astro/config"; import sitemap from "@astrojs/sitemap"; import tailwindcss from "@tailwindcss/vite"; +/* Mzizi's browser floor (mzizi-css, mzizi-dev/mzizi-registry): the first + versions with color-mix(), nesting and :is(). Lightning CSS encodes a + version as major << 16 | minor << 8. */ +const MZIZI_TARGETS = { + chrome: 111 << 16, + edge: 111 << 16, + firefox: 113 << 16, + safari: (16 << 16) | (2 << 8), +}; + export default defineConfig({ site: "https://learning.nyuchi.com", /* Astro's HTML compression drops the space where a line break sits between @@ -40,5 +50,15 @@ export default defineConfig({ }, }), ], - vite: { plugins: [tailwindcss()] }, + vite: { + plugins: [tailwindcss()], + /* Lightning CSS (issue 153), as Mzizi builds its stylesheets: it + transforms and minifies the site's CSS, lowering nesting and + color-mix() for Mzizi's browser floor. */ + css: { + transformer: "lightningcss", + lightningcss: { targets: MZIZI_TARGETS }, + }, + build: { cssMinify: "lightningcss" }, + }, }); diff --git a/docs/toolchain.md b/docs/toolchain.md index f008376..49529ca 100644 --- a/docs/toolchain.md +++ b/docs/toolchain.md @@ -46,6 +46,39 @@ that this repo does not control. Astro does not read `vite.config.ts`; it takes its Vite settings from `astro.config.mjs`. The override is what puts it on Vite+'s Vite. +## CSS: Lightning CSS and Mzizi's tokens.css + +Mzizi builds its CSS with Lightning CSS, which works with Rust where Tailwind +does not, around `tokens.css` (values only) and `floor.css` (accessibility +minimums). This site is moving the same way (issue 153), in steps: + +1. **Done.** Vite+'s CSS pipeline runs on Lightning CSS (`css.transformer` + and `build.cssMinify` in `astro.config.mjs`), targeting Mzizi's browser + floor: Chrome and Edge 111, Firefox 113, Safari 16.2. +2. **Done.** Mzizi's `tokens.css` is in `src/styles/mzizi/`, copied from + `mzizi-dev/mzizi-registry` at a pinned commit by + `vpx scripts/sync-mzizi-css.mjs`. CI checks the copy with `--check`. It is + imported into the lowest cascade layer, so it changes no value the site + already sets: a browser comparison of every page, in light and dark, at + phone and desktop width, found no change. It adds Mzizi's tokens the kit + does not have, such as `--measure` and `--ring-width`. +3. **In progress.** Pages and components move from Tailwind utilities to + plain CSS that reads the tokens, one at a time, each checked with + `vp run qa` and a screenshot comparison. Done: the accessibility statement + (`src/styles/site/document.css`, which the legal pages will share). + `src/styles/site/tokens.css` holds the few values Mzizi's tokens do not + have (this site's fluid heading sizes and their letter-spacing), and + `tests/plain-css.test.ts` keeps a converted page off utility classes and + its stylesheet on tokens. + `floor.css` comes in with the first page on Mzizi's `data-slot` pattern. + Loaded now, it would size `@bundu/ui`'s buttons by the kit's 49px floor, + not Mzizi's. +4. Last: Tailwind, `@tailwindcss/vite`, the typography plugin and + `tailwind.config.mjs` go. + +When Mzizi publishes the pattern stylesheets in a package, it replaces the +copy and the sync script. + ## Two formatters Prettier and Vite+'s formatter (Oxfmt, through `vp fmt`) both format this diff --git a/package-lock.json b/package-lock.json index 0222f2e..c227c4c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "@tailwindcss/vite": "^4.1.18", "@types/node": "^24.10.0", "axe-core": "^4.12.1", + "lightningcss": "^1.33.0", "playwright": "^1.63.0", "prettier": "3.3.3", "tailwindcss": "^4.1.18", diff --git a/package.json b/package.json index eb445fb..5283dd4 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "@tailwindcss/vite": "^4.1.18", "@types/node": "^24.10.0", "axe-core": "^4.12.1", + "lightningcss": "^1.33.0", "playwright": "^1.63.0", "prettier": "3.3.3", "tailwindcss": "^4.1.18", diff --git a/public/brand/og.jpg b/public/brand/og.jpg new file mode 100644 index 0000000..116cf84 Binary files /dev/null and b/public/brand/og.jpg differ diff --git a/scripts/og-image.mjs b/scripts/og-image.mjs new file mode 100644 index 0000000..979654c --- /dev/null +++ b/scripts/og-image.mjs @@ -0,0 +1,74 @@ +#!/usr/bin/env node +/** + * The share image (issue 161): public/brand/og.jpg, 1200 by 630, the size + * LinkedIn, WhatsApp, X and Slack show beside a shared link. + * + * It is a still of the Bundu scene (src/scripts/bundu-scene.js, issue 160) at + * golden hour, with the wordmark and the home page's statement. The image is + * committed; run this again only when the scene or the statement changes: + * + * vpx scripts/og-image.mjs + * + * It loads the site's fonts from Google Fonts, so it needs the network. + */ +import { readFileSync } from "node:fs"; +import { dirname, join, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; +import { chromium } from "playwright"; +import { findChromium } from "./lib/browser.mjs"; + +const root = resolve(dirname(fileURLToPath(import.meta.url)), ".."); +const scene = readFileSync( + join(root, "src/scripts/bundu-scene.js"), + "utf8", +).replace("export function mountBunduScene", "function mountBunduScene"); +const bee = readFileSync( + join(root, "public/brand/nyuchi-bee-light.png"), +).toString("base64"); + +const html = ` + + +
+ +
+
Nyuchi Learning
+

Built for your school, not for every school.

+

Open tools for schools, built to open standards and handed over.

+
+
learning.nyuchi.com
+
`; + +const browser = await chromium.launch({ executablePath: findChromium() }); +const page = await browser.newPage({ + viewport: { width: 1200, height: 630 }, + deviceScaleFactor: 1, +}); +await page.setContent(html, { waitUntil: "networkidle" }); +await page.addScriptTag({ content: scene }); +await page.evaluate(() => { + // eslint-disable-next-line no-undef -- defined by the script tag above + mountBunduScene( + document.getElementById("scene"), + document.getElementById("card"), + { time: "golden" }, + ).setPaused(true); +}); +await page.waitForTimeout(1200); +const out = join(root, "public/brand/og.jpg"); +await page + .locator("#card") + .screenshot({ path: out, type: "jpeg", quality: 88 }); +await browser.close(); +console.log(`wrote ${out}`); diff --git a/scripts/qa.mjs b/scripts/qa.mjs index d0998a6..c1203e2 100644 --- a/scripts/qa.mjs +++ b/scripts/qa.mjs @@ -63,15 +63,17 @@ for (const scheme of ["light", "dark"]) { * claim the privacy policy makes and the one worth a browser to check. * * Everything else third-party must be on the approved list. Google Fonts - * and Google Analytics are there because a commit put them there; anything - * else arriving is the regression this exists to catch. + * and Google Analytics are there because a commit put them there, and + * Cloudflare Web Analytics' cookieless beacon (issue 157), which the CSP + * and the privacy policy already name; anything else arriving is the + * regression this exists to catch. * * Google Analytics loads only after consent, which this run never gives; * scripts/probe-consent.mjs is what asserts that. Either way, analytics * is not a licence for the messenger to load, which is why these are two * assertions rather than one "no third parties". */ const APPROVED = - /(^|\.)(googleapis|gstatic|googletagmanager|google-analytics)\.com$|(^|\.)analytics\.google\.com$/; + /(^|\.)(googleapis|gstatic|googletagmanager|google-analytics|cloudflareinsights)\.com$|(^|\.)analytics\.google\.com$/; const unapproved = []; const intercomBeforeClick = []; page.on("request", (request) => { diff --git a/scripts/sync-mzizi-css.mjs b/scripts/sync-mzizi-css.mjs new file mode 100644 index 0000000..ee1f90e --- /dev/null +++ b/scripts/sync-mzizi-css.mjs @@ -0,0 +1,81 @@ +#!/usr/bin/env node +/** + * Mzizi's pattern stylesheets, copied in from the registry (issue 153). + * + * Mzizi moved its CSS to Lightning CSS and plain stylesheets built around + * `tokens.css` (values only) and `floor.css` (the accessibility minimums), + * in mzizi-dev/mzizi-registry's `styles/pattern/`. They are not in an npm + * package yet, so this site keeps a copy, pinned to one registry commit: + * + * src/styles/mzizi/tokens.css values only, light and dark + * + * Each copy starts with a header naming the commit and source path. The rest + * of the file is the registry's, byte for byte: nothing here edits a token. + * When Mzizi publishes these in a package, import the package and delete + * this script. + * + * vpx scripts/sync-mzizi-css.mjs fetch the pinned commit, write the copies + * vpx scripts/sync-mzizi-css.mjs --check fail if a copy differs from the pinned commit + * + * To move to a newer registry commit, change REF and run it without --check, + * then review the diff. + */ +import { mkdirSync, readFileSync, writeFileSync } from "node:fs"; +import { dirname, join, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; + +export const REPO = "mzizi-dev/mzizi-registry"; +/** registry main, 2026-11-28 (tokens with the nine chrome tokens of 2026-11-22) */ +export const REF = "292ecc8f775eaa189550e7bb3add4df40d527d22"; +/* floor.css joins when the first page moves to Mzizi's data-slot pattern: + loaded now, it would size @bundu/ui's buttons by the kit's own floor + (49px), not Mzizi's, and change the look (issue 153). */ +export const FILES = ["tokens.css"]; + +const root = resolve(dirname(fileURLToPath(import.meta.url)), ".."); +export const OUT_DIR = join(root, "src", "styles", "mzizi"); + +/** The header written above the registry's own text. */ +export const header = (file) => + `/* Copied from ${REPO}@${REF}, styles/pattern/${file}.\n` + + ` Do not edit: run \`vpx scripts/sync-mzizi-css.mjs\` (issue 153). */\n`; + +async function fetchSource(file) { + const url = `https://raw.githubusercontent.com/${REPO}/${REF}/styles/pattern/${file}`; + const res = await fetch(url); + if (!res.ok) throw new Error(`${url}: HTTP ${res.status}`); + return res.text(); +} + +async function main() { + const check = process.argv.includes("--check"); + mkdirSync(OUT_DIR, { recursive: true }); + let stale = 0; + for (const file of FILES) { + const want = header(file) + (await fetchSource(file)); + const path = join(OUT_DIR, file); + let have = ""; + try { + have = readFileSync(path, "utf8"); + } catch { + /* not written yet */ + } + if (have === want) continue; + if (check) { + console.error(`${path} differs from ${REPO}@${REF.slice(0, 7)}`); + stale++; + } else { + writeFileSync(path, want); + console.log(`wrote ${path}`); + } + } + if (stale) { + console.error( + "Run `vpx scripts/sync-mzizi-css.mjs`, then review the diff.", + ); + process.exit(1); + } + if (check) console.log(`Mzizi stylesheets match ${REF.slice(0, 7)}`); +} + +if (process.argv[1] === fileURLToPath(import.meta.url)) await main(); diff --git a/src/components/BunduScene.astro b/src/components/BunduScene.astro new file mode 100644 index 0000000..f39b297 --- /dev/null +++ b/src/components/BunduScene.astro @@ -0,0 +1,31 @@ +--- +/** + * The Bundu scene behind a hero (issue 160). Put it first inside the element + * it should fill, and mark that element data-bundu-host (it must be + * positioned, and clip its overflow). The scene is decoration: the canvas is + * hidden from assistive technology, and the button pauses it (WCAG 2.2.2). + * The painting is src/scripts/bundu-scene.js; the look of the canvas and the + * button is the page's (src/styles/site/home.css). + */ +--- + + + + + diff --git a/src/components/SiteHeader.astro b/src/components/SiteHeader.astro index 09d90fd..3a0833e 100644 --- a/src/components/SiteHeader.astro +++ b/src/components/SiteHeader.astro @@ -4,19 +4,24 @@ * a single hairline border, and a 64/80px row. * * The right-hand side carries the page's one primary call to action (by - * default, installing the extension: it is the product most visitors can act - * on today), with "Talk to us" beside it as the quieter link from `xl` up. + * default, working with Nyuchi Learning, which is what the site is for: + * issue 158), with "Talk to us" beside it as the quieter link from + * `xl` up when the action goes elsewhere. A product's own pages pass their + * own action (the extension's pages, "Add to Chrome"). */ import Wordmark from "./Wordmark.astro"; -import { headerCta, primaryNav, toddleExtension, type HeaderAction } from "../data/site"; +import { headerCta, primaryNav, type HeaderAction } from "../data/site"; interface Props { action?: HeaderAction; } -const defaultAction: HeaderAction = toddleExtension.webStore - ? { label: "Add to Chrome", short: "Install", href: toddleExtension.webStore, external: true } - : { label: "Talk to us", href: toddleExtension.enquiry }; +const defaultAction: HeaderAction = { + label: "Work with us", + short: "Contact", + href: headerCta.href, + external: headerCta.external, +}; const { action = defaultAction } = Astro.props; const { pathname } = Astro.url; diff --git a/src/data/site.ts b/src/data/site.ts index 22893ea..6af1fd0 100644 --- a/src/data/site.ts +++ b/src/data/site.ts @@ -11,8 +11,14 @@ export const site = { wordmark: "Nyuchi Learning", url: "https://learning.nyuchi.com", parent: { name: "Nyuchi Africa", url: "https://nyuchi.com" }, + /* The picture a shared link shows (issue 161): 1200 by 630, made by + scripts/og-image.mjs from the Bundu scene. */ + shareImage: { + path: "/brand/og.jpg", + alt: "Nyuchi Learning: built for your school, not for every school. A baobab and an umbrella thorn at sunset, their roots joined underground.", + }, description: - "The Nyuchi Learning surface: training programmes, the open Bundu Education frameworks, Mukoko Lingo for languages, and the classroom tools Nyuchi Web Services builds for schools.", + "Nyuchi Learning works inside schools and builds the tools each one needs: architected to the open Bundu frameworks and standards, published open source, and handed over for the school to run.", } as const; /** @@ -62,13 +68,15 @@ export const legalPages: NavLink[] = [ { label: "Legal notice", href: "/legal/notice" }, ]; -/* The two products come first, side by side, so they read as Nyuchi - Learning's own; the ecosystem destinations follow. */ +/* Nyuchi Learning is forward-deployed for schools (issue 158): how it works, + its open apps (Mukoko Lingo, the Toddle extension and CampusPass, each with + equal weight, listed on the home page), the frameworks it builds on, and + the programmes. Four short items, so the row fits from 1024px. */ export const primaryNav: NavLink[] = [ - { label: "Toddle extension", href: "/toddle-enhancement-extension" }, - { label: "Mukoko Lingo", href: "/mukoko-lingo" }, + { label: "How we work", href: "/#how-we-work" }, + { label: "Apps", href: "/#apps" }, + { label: "Frameworks", href: "/#frameworks" }, { label: "Programmes", href: "https://nyuchi.com/learning", external: true }, - { label: "Frameworks", href: "https://bundu.org/education", external: true }, ]; /** The header's quieter link, beside the page's primary call to action. */ @@ -87,41 +95,35 @@ export const footerColumns: { title: string; links: NavLink[] }[] = [ { title: "Learning", links: [ + { label: "How we work", href: "/#how-we-work" }, + { label: "Frameworks", href: "/#frameworks" }, { label: "Programmes", href: "https://nyuchi.com/learning", external: true, }, - { - label: "Frameworks", - href: "https://bundu.org/education", - external: true, - }, + { label: "Send feedback", href: "/feedback" }, + { label: "Get in touch", href: "mailto:support@nyuchi.com" }, ], }, { - title: "Products", + /* The open apps, with equal weight (issue 158). */ + title: "Apps", links: [ + { label: "Mukoko Lingo", href: "/mukoko-lingo" }, { label: "Toddle Enhancement Extension", href: "/toddle-enhancement-extension", }, { - label: "Deploy the extension", - href: "/toddle-enhancement-extension#install", + label: "CampusPass", + href: "https://www.nyuchi.com/campuspass", + external: true, }, { label: "Extension releases", href: "/toddle-enhancement-extension/releases", }, - { - label: "Extension source on GitHub", - href: "https://github.com/nyuchi/toddle-enhancement-extension", - external: true, - }, - { label: "Mukoko Lingo", href: "/mukoko-lingo" }, - { label: "Send feedback", href: "/feedback" }, - { label: "Get in touch", href: "mailto:support@nyuchi.com" }, ], }, { @@ -277,6 +279,75 @@ export const mukokoLingo = { enquiry: "mailto:support@nyuchi.com?subject=Mukoko%20Lingo", } as const; +/** + * The Bundu Education frameworks (issue 158): the forefront of Nyuchi + * Learning, which implements them for organisations that want help. Names, + * roles and summaries as bundu.org/education gives them; the frameworks + * themselves are the Foundation's, free and not for sale. + */ +export const frameworks = { + home: "https://bundu.org/education", + list: [ + { + name: "K-12 Digital Campus", + role: "Core", + summary: + "A complete blueprint for digital transformation in K-12 schools: infrastructure, software, pedagogy, professional development and a phased rollout, for African contexts.", + points: [ + "Mobile-first, low-bandwidth design", + "A free and open-source software stack", + "Budget scenarios from minimal to comprehensive", + ], + href: "https://bundu.org/education/k12-digital-campus", + mineral: "gold", + }, + { + name: "Digital Literacy for Africa", + role: "Curriculum", + summary: + "Mobile-first digital literacy for students, teachers and parents: digital citizenship, lifelong learning and readiness for the 2050 digital landscape.", + points: [ + "Designed for shared devices, not one each", + "Parallel pathways for students, teachers and parents", + "Progressions for ages 5 to 18 and beyond", + ], + href: "https://bundu.org/education/digital-literacy", + mineral: "malachite", + }, + { + name: "K-12 Support Process", + role: "Support", + summary: + "A three-tier support system for digital campuses, balancing AI self-service, educational technology support and IT operations.", + points: [ + "Tier 0: AI self-service", + "Tier 1: the EdTech team", + "Tier 2: IT operations, with playbooks and SLAs", + ], + href: "https://bundu.org/education/support-process", + mineral: "cobalt", + }, + ], +} as const; + +/** + * CampusPass (issue 158): one of Nyuchi Learning's products, beside Mukoko + * Lingo and the Toddle extension. Its home is nyuchi.com/campuspass; every + * word here comes from that page's facts (bundu-labs/marketing, + * apps/nyuchi/src/data/campuspass.ts), whose truth list is the ceiling: + * nothing here may claim more than the app does. + */ +export const campusPass = { + name: "CampusPass", + tagline: "Your student ID, in Apple Wallet.", + summary: + "Scan your student card, theme your pass and add it to Apple Wallet. No servers, no accounts and no network requests: nothing leaves your iPhone.", + url: "https://www.nyuchi.com/campuspass", + /** Public beta on TestFlight until the App Store release. */ + status: "Beta", + beta: "https://testflight.apple.com/join/DHXyfmWu", +} as const; + /** * The feedback form posts to Formspree, which emails each submission to Nyuchi. * The site stays static: there is no endpoint of ours to run or secure. diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index 7621ea1..da819bc 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -24,6 +24,10 @@ interface Props { ogType?: "website" | "article"; /** Extra schema.org nodes for this page, merged into the site graph. */ schema?: Record[]; + /** The share image, as a site path. Defaults to the site's own (1200 by 630). */ + image?: string; + /** What the share image shows, for people who cannot see it. */ + imageAlt?: string; /** Keep the page out of search results, e.g. a thank-you page. */ noindex?: boolean; /** The header's primary call to action. Defaults to installing the extension. */ @@ -36,10 +40,14 @@ const { canonical, ogType = "website", schema = [], + image = site.shareImage.path, + imageAlt = site.shareImage.alt, noindex = false, action, } = Astro.props; const canonicalUrl = new URL(canonical ?? Astro.url.pathname, site.url).toString(); +/* Share images must be absolute: the services that fetch them have no base URL. */ +const imageUrl = new URL(image, site.url).toString(); /* One JSON-LD graph per page: the organisation and the site, plus whatever the page adds. Kept as a graph rather than several script tags so the nodes can @@ -53,6 +61,7 @@ const schemaGraph = { "@id": `${site.url}/#organization`, name: site.parent.name, url: site.parent.url, + logo: new URL("/brand/apple-touch-icon.png", site.url).toString(), parentOrganization: { "@type": "Organization", name: "Bundu Foundation", url: "https://bundu.org" }, contactPoint: { "@type": "ContactPoint", @@ -76,6 +85,7 @@ const schemaGraph = { url: canonicalUrl, name: title, description, + primaryImageOfPage: { "@type": "ImageObject", url: imageUrl, width: 1200, height: 630 }, isPartOf: { "@id": `${site.url}/#website` }, inLanguage: "en", }, @@ -94,7 +104,13 @@ const schemaGraph = { {title} - {noindex && } + { + noindex ? ( + + ) : ( + + ) + } + + + + + + + + + +