mirror of
https://github.com/bitbaum/heidi.git
synced 2026-12-04 05:37:48 +01:00
* fix(chat): stop the transcript scrolling the page sideways; open on the chat Two things, both about what the app shows first on a phone. OVERFLOW. A long link in an answer — an ordinary zuerich.ch URL, pasted by a learner asking what it said — has no break opportunity in it, so the line ran past the edge of the card. A block does not grow to fit its overflow, but the DOCUMENT does: at 320, 360 and 390 the page became 710px wide and scrolled sideways, and the reader had to drag it back and forth to read one reply. The same defect hit the flex rows (a gloss, a suggestion's label beside its Speak and Copy buttons), which size themselves from min-content and pushed their neighbours off the edge. One declaration fixes all of it, because `overflow-wrap` inherits: the transcript's root wraps anywhere, and every descendant gets it — including ones added later by somebody who never reads the note. `anywhere` rather than `break-word` is the load-bearing half, since only `anywhere` shrinks the min-content contribution that the flex rows measure. That holds only while the transcript is the one gate, so `transcript.test.ts` pins it: the root carries the class, and `AnswerView` and the bubbles are rendered there and nowhere else. It covers all four chats — home, dock, full screen and a group — because all four already share this component. The composer got the same treatment one element down: a textarea is a flex item that refuses to shrink below its `cols`, which on a 320px phone plus three 44px buttons is wider than the row. Verified in headless Chromium at 320/360/390 with a hostile answer (a long URL, a 48-letter compound, a flag list): document width was 710px before and equals the viewport after, on the home page and the full-screen chat. DEFAULT SCREEN. Signed in, the locale root rendered the dashboard — a list to look at, when what someone with an account opened it for is the conversation. It now renders the full-screen chat, sidebar and all. The dashboard is not gone: `/portal` is still its address and the account control is still the door to it. Signed out is unchanged, so the indexed landing page and its pitch stay exactly where a crawler and a first-time visitor find them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012bciJMTkW3WZ3AmpTZNvAC * fix(mobile): every page measured for overflow; align the read/copy pair The last fix went on the transcript and stopped there, so three reported pages stayed broken. This one starts from a measurement instead of a screenshot. WHAT WAS ACTUALLY WRONG. A grid track defaults to `auto`, whose automatic minimum is min-content — it will not go narrower than the widest unbreakable thing inside it. One `truncate` line is `white-space: nowrap`, so its min-content is the whole sentence. `/portal` with eleven ordinary kept words was therefore 516px wide in a 360px viewport, and 912px once one word had been kept from a link. Nothing on that page was doing anything unusual, which is why nobody caught it by reading the code. `grid-cols-safe` is that missing `minmax(0, 1fr)`, named once in globals.css with the reason beside it, and applied to every grid whose base layout is one column. Kept words and the vocabulary list also hyphenate now: a German compound longer than a phone column is the whole subject of this product. `overflow-x: clip` on the body is the backstop and explicitly NOT the fix — it turns the next mistake into a clipped card instead of a site that scrolls sideways. `clip` rather than `hidden` because `hidden` makes the body a scroll container and silently kills the composer's `position: sticky`. MEASURED, NOT INSPECTED. `pnpm run audit:responsive` drives every page in every language at 320/360/390/414 in both themes, with a browser that has been used — a dozen kept words in three scripts, one of them kept from a 100-character URL — and fails on two things: an element whose box leaves the viewport, and an element whose content is wider than itself and cannot scroll. The second is the one no amount of reading finds. 532 renders, zero overflow. Not in `verify`: it needs a server and a browser binary. THE READ/COPY PAIR. They were two halves of different components bolted together, and looked it: Speak is a 44px control, Copy was 36px, so "Kopieren" rode eight pixels above "Vorlesen". Equal heights now, because the alignment IS the two numbers being equal. Their row also stopped being rigid: in Russian the label wrapped to four lines beside them, and the moment Speak opened its caveat — two sentences about which voice the device really has — the cluster pushed the whole card off the right of the screen. YOUR OWN MESSAGES, FROM A STRANGER. Sending a line in a signed-in conversation returned the stored ROW, whose author is the OIDC `sub`. The transcript is built on `LEARNER_ID`, so it rendered the reader's own sentence in the shell reserved for a third person, left-aligned, with their raw actor UUID printed above it as that person's name. The conversation GET had it too, and was handing the `sub` back over the wire besides. One mapping now, shared by all three boundaries, pinned by a test. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012bciJMTkW3WZ3AmpTZNvAC * feat(dialect): the three branches, and where each dialect can be heard "Swiss German is not one language" was the third fact the page led with, and then it illustrated the claim with eleven names in a flat grid — which reads as eleven flavours of one thing, the opposite of what it says. The structure is the interesting part, and it is not ours to invent: the Alemannic dialects divide into Low, High and Highest, and the divisions are drawn by sound changes that stopped in different places. So the atlas now carries that structure. `DialectGroup` is generic — nothing in the pack type says Alemannic — and each group holds the pair of FORMS that draws its line rather than a sentence about them: `Kind` inside Low Alemannic, `Chind` outside it, `Kind` in the standard both are versions of. A reader sees the line instead of being told about it, and a pair of forms is the same in all seven languages. ABSENT IS AN ANSWER. Innerschwyzertütsch spans Lucerne, which is High, and Uri and Unterwalden, which are Highest; Bündnerdütsch covers Chur and the Walser settlements, likewise on two sides. Both carry no branch and the page says the area straddles the line, because the tidier page would be the false one. WHERE YOU CAN HEAR IT. Every row in the listening register has carried an atlas `area` id since the first commit and no page ever followed the join, so the one question a dialect page could not answer — "where do I actually hear this?" — was already answered in the data. The area pages now list the programmes recorded in that dialect, sharing `/listen`'s own row component rather than growing a second copy of it. STILL NO PER-AREA PROSE, and the page got substantially longer anyway. That is the part worth keeping: three branch explanations, translated once, serve all eleven areas, where eleven descriptions would have been seventy-seven blocks nobody here can check. Everything else added is data. What is deliberately NOT here: invented dialect forms. Seven of the eleven areas still say Heidi cannot tell them apart by form, because that is true. The container for per-area vocabulary and grammar contrasts is what this commit builds; filling it needs rows somebody can cite, not rows that look plausible. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012bciJMTkW3WZ3AmpTZNvAC * feat(essays): somewhere for the long answer, and the first one The dialect pages answer "which forms" and "where", and they are made of data on purpose — eleven areas of translated description would be seventy-seven blocks nobody here can check. But the question a visitor actually arrives with is not a form and not a map: why does a country this small have this many dialects, and why did the big neighbour lose its own? That is an argument with sources, and it had nowhere to live. TYPED BLOCKS, NOT MARKDOWN. A parser is a dependency this repo has spent real effort avoiding, and Markdown would let a page render anything at all — the design system would be one stray element away from not applying. Blocks render through components that already know the type scale, the measure and the one accent, and a block kind nobody implemented is a build error instead of a paragraph that looks wrong in production. `inline.ts` gives prose the three things it needs inside a sentence — a link, emphasis, and a language form set in the dialect face — in forty lines of pure, tested code, so writing an essay is writing sentences. TRANSLATION IS NOT REQUIRED, and that is the whole reason essays are not dictionary entries. A dictionary must have every key in all seven languages or the build fails, which is right for interface copy and impossible for two thousand words of argued history: machine-translating that into Romansh and publishing it under our own name is exactly the overclaiming `/method` exists to refuse. An essay exists in the languages somebody wrote it in, a reader in another gets the version that does exist, and the page says which language it is in rather than letting the site look broken. The sitemap follows the same rule — hreflang names only real translations. THE FIRST PIECE argues that it is not the mountains. Austria is as mountainous and kept a spoken norm, because Vienna was a court and a capital; the Confederation had neither, and until 1848 not even a capital, so there was no place whose pronunciation anyone was supposed to imitate. Where it reaches the causal story it marks it as a conjecture, because the sources under it — Ferguson on diglossia, the HLS on multilingualism and on the Geistige Landesverteidigung — describe the language situation and not why it arose. Every URL was resolved before it was cited, per this registry's own standing rule. `sources.test.ts` now counts essays and dialect branches as citers, and refuses an essay that names no source at all — the reverse check, and the one that matters more on the pages that make the strongest claims. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012bciJMTkW3WZ3AmpTZNvAC * feat(practice): a second attempt before the sitting ends, and the papers on the page Practice is the half of this product that decides whether anybody comes back, and it is the half where guessing is least excusable. Two changes, both argued. A MISSED QUESTION COMES BACK. It used to reveal its answer and move on, which makes a sitting a test with feedback and never a second chance to produce the thing. Rawson & Dunlosky (2011): the durable gain comes from retrieving something correctly more than once, spaced — not from having seen it. Butler & Roediger (2008) is the sharper case here, because three of the five item kinds are multiple choice and choosing a lure can leave the learner holding the lure unless something corrects them. So a missed item returns three questions later, once, labelled as the second attempt rather than appearing again unexplained. The gap of three is OURS and says so. The literature gives the direction and not the number, and a cited estimate presented as a finding is an uncited claim one step better disguised. THE SCHEDULE HEARS THE FIRST ANSWER ONLY. A word got right a minute after being revealed has not been retrieved; grading it twice would advance the very interval the spacing exists to protect, which is the same inflation `review.ts` already refuses when it sends a missed word to the start rather than back one step. MY FIRST GUARD WAS WRONG, and reading it did not show it. It refused to requeue an item already in the QUEUE — but a requeued item leaves the queue to become the current question, so a second miss put it back again. Found by driving a whole session wrong on purpose: eight questions became thirteen and would have kept going, which punishes exactly the learner who is finding it hard. The rule is now stated on what decides it — an item already answered this sitting has had its go — and a test pins the worst case at exactly twice the session size. THE PAGE ARGUES FOR ITSELF. Seven claims on `/practice`, each linking to the study behind it, on the page the design belongs to rather than on `/method`: the person reading has just been told they got something wrong and is entitled to know whether the thing telling them knows anything. The interleaving row states the meta-analysis's moderator — the benefit depends on how similar the material is, and on very similar material blocking can win — instead of quoting the headline and hoping. Every row carries the guarantee the research page already had: a test refuses a row citing nothing, and refuses a locale citing something different for the same sentence. Four sources added, each resolved through Crossref before being written down. HEIDI.md §9 now carries the exercise track in order, including what is deliberately refused: streaks, points, levels, percentages, a daily goal. If that ever costs retention against a competitor with a flame icon, we lose that comparison on purpose. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012bciJMTkW3WZ3AmpTZNvAC * fix(portal): a way around your own page, and the account where people look THE DASHBOARD HAD NO NAVIGATION. Five sections stacked down roughly two thousand pixels of phone with nothing to steer by — no index, no counts, no sign that anything existed below the fold. Somebody wanting their groups scrolled past everything else to find out whether they had any. `DashboardNav` is one component in two shapes, because a phone and a laptop want different things from the same list: a strip that sticks under the header below `lg`, the sidebar this page always needed above it. A second component for the second shape would be two lists that disagree about what sections exist. It wraps rather than scrolling sideways — a strip that scrolls hides its own last item, on the exact class of page this repo has shipped scrolling sideways by accident. The counts are the point: "Groups" says a section exists, "Groups · 1" answers the question a personal page is being asked. THE ACCOUNT IS IN THE CORNER NOW, at every width. It used to appear there only from `lg` up and hide inside the mobile menu sheet below that. "Log out" is the one control people look for without being told where it is, and on a phone there was nothing in the corner at all. Signed OUT it stays in the sheet, and that is not inconsistency: a signed-out bar needs a gear and a full-width sign-in button beside the wordmark, the language switcher and the menu, and five controls do not fit in 320px. An avatar is 44px and does. The right-hand rail is gone. It held the account (now in the header), the roadmap (the project talking about itself on a page about the reader) and the way back into the product — which is now at the END of the page, where you are when you have finished reading your own words. TWO DEFECTS THE CHANGE CAUSED, both caught before shipping and both worth recording because they are the same shape as each other: The account dropdown is `absolute right-0`, which hangs from the nearest positioned ancestor. That was its own button — correct only while the avatar was the LAST control in the bar. It no longer is, so at 360px the 328px panel ran from x = −78 with its labels cut in half. The anchor belongs on the control row, whose right edge is the page gutter. And the bar stopped fitting: 342px inside 320 in Russian, once the avatar was paid for. The wordmark stands down under 380px and the cow stays. That needed a breakpoint Tailwind does not have — every real decision in this product is between a 320px phone and a 390px one, and `sm` at 640 is a tablet. THE AUDIT NOW OPENS THINGS. It found neither of the above, because it measured pages at rest and every dropdown on them was shut. It opens the header's disclosures one at a time on two representative pages and measures each state — which immediately found a third: the theme row inside the dropdown is 328px of Russian in a 302px panel, cut off at the panel edge. AND IT RUNS IN CI. An opt-in script nobody remembers to run would have caught none of the three overflow defects reported from a phone this month. It needs a browser and a built server, which is why it cannot live in `verify` — so it is its own step, against the real build. `AGENTS.md` now opens with the four rules behind every one of these, because they are not obvious and this repo has now made all four. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012bciJMTkW3WZ3AmpTZNvAC --------- Co-authored-by: Claude <noreply@anthropic.com>
80 lines
3.1 KiB
TypeScript
80 lines
3.1 KiB
TypeScript
import { test, describe } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { inline, isInternal } from "./inline.ts";
|
|
|
|
describe("the inline syntax essays are written in", () => {
|
|
test("plain prose comes back as one span", () => {
|
|
assert.deepEqual(inline("Zurich German has no standard spelling."), [
|
|
{ kind: "text", text: "Zurich German has no standard spelling." },
|
|
]);
|
|
});
|
|
|
|
test("a link keeps its label and its target apart", () => {
|
|
assert.deepEqual(inline("see [the method](/de/method) for why"), [
|
|
{ kind: "text", text: "see " },
|
|
{ kind: "link", text: "the method", href: "/de/method" },
|
|
{ kind: "text", text: " for why" },
|
|
]);
|
|
});
|
|
|
|
test("forms and emphasis are different things and stay different", () => {
|
|
assert.deepEqual(inline("Basel says `Kind`, and that is **the** line"), [
|
|
{ kind: "text", text: "Basel says " },
|
|
{ kind: "form", text: "Kind" },
|
|
{ kind: "text", text: ", and that is " },
|
|
{ kind: "strong", text: "the" },
|
|
{ kind: "text", text: " line" },
|
|
]);
|
|
});
|
|
|
|
/**
|
|
* The ordering bug this pins. Three separate passes would let the emphasis
|
|
* rule eat the asterisks around a link and leave the brackets behind, which
|
|
* publishes as literal `[label](url)` in the middle of a sentence.
|
|
*/
|
|
test("a link inside emphasis survives both", () => {
|
|
assert.deepEqual(inline("**[Idiotikon](https://idiotikon.ch)**"), [
|
|
{ kind: "strong", text: "[Idiotikon](https://idiotikon.ch)" },
|
|
]);
|
|
});
|
|
|
|
test("an unclosed marker stays literal rather than swallowing the rest", () => {
|
|
assert.deepEqual(inline("a lone ** and a lone ` are just characters"), [
|
|
{ kind: "text", text: "a lone ** and a lone ` are just characters" },
|
|
]);
|
|
});
|
|
|
|
test("markers at the very edges lose nothing", () => {
|
|
assert.deepEqual(inline("`Chind`"), [{ kind: "form", text: "Chind" }]);
|
|
assert.deepEqual(inline("**both** ends `here`"), [
|
|
{ kind: "strong", text: "both" },
|
|
{ kind: "text", text: " ends " },
|
|
{ kind: "form", text: "here" },
|
|
]);
|
|
});
|
|
|
|
test("an internal link is the one the router owns", () => {
|
|
assert.equal(isInternal("/de/dialect"), true);
|
|
assert.equal(isInternal("https://idiotikon.ch"), false);
|
|
assert.equal(isInternal("mailto:hoi@heidi.ch"), false);
|
|
});
|
|
});
|
|
|
|
/**
|
|
* The one hard-coded slug on the site.
|
|
*
|
|
* `/dialect` hands its hardest question — why a country this size has this
|
|
* many dialects — to a specific essay, by slug. Every other link between pages
|
|
* goes through `ROUTES`, so this is the single place a rename becomes a 404,
|
|
* and it would be a 404 on the most-linked reference page here.
|
|
*/
|
|
describe("the essay the dialect page points at", () => {
|
|
test("exists, and is readable in the default locale", async () => {
|
|
const { essayBySlug } = await import("./registry.ts");
|
|
const slug = "warum-die-schweiz-ihre-mundarten-behalten-hat";
|
|
const served = essayBySlug(slug, "de");
|
|
assert.ok(served, `/dialect links to "${slug}", which is not a published essay`);
|
|
assert.equal(served.got, "de", "the piece the dialect page leans on should exist in German");
|
|
});
|
|
});
|