Choose a cover in two parts, and let the app be installed
A cover is a colour *and* a pattern now, chosen in turn. Offering every combination as its own entry meant fifteen colours times a dozen patterns in a grid nobody could take in — and in practice only the handful someone had thought to write out. Each pattern is previewed over the colour in hand, so what is on screen is the cover as it will be. `cover_pattern` is its own column: they are two decisions, and folding them into one number would mean renumbering every cover the day a pattern is added. For one day the patterns *were* twelve appended entries. Those indices are read back as the colour-and-pattern pair they were drawn as, so nothing chosen then looks different now. And three separate reasons the install button never appeared, none of them in anyone's configuration: - `beforeinstallprompt` fires once, early — usually before React has mounted — and is never fired again. A listener added from inside a component simply missed it. It is caught at the top of index.html now. - A `<link rel="manifest">` is fetched with credentials omitted unless it says otherwise. Behind a reverse proxy that authenticates in front of the app, that one request comes back as the proxy's login page and the browser reads it as an invalid manifest — while the app itself works perfectly, because its own requests carry the cookie. - The service worker cached whatever came back, so a lapsed session could be stored as the application itself. The app would then "work offline" by showing a login screen it could never get past, curable only by clearing the site's data. Only successful, unredirected responses are cached now, and the cache name is bumped to drop anything already stored under the old rules. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0d8d1180de
commit
8ca1ed6e06
17 files changed
+455
-221
No files matched your search
+18
-4
@@ -395,14 +395,28 @@ try {
|
||||
await p.waitForTimeout(600);
|
||||
await p.getByRole("button", { name: "Add Notebook" }).click();
|
||||
await p.waitForTimeout(700);
|
||||
const covers = p.locator('[data-cover-option]');
|
||||
check((await covers.count()) > 20, "there are patterned covers as well as plain ones", `${await covers.count()} covers`);
|
||||
/* Colour and pattern are two choices, not one long list of combinations. */
|
||||
check((await p.locator("[data-cover-option]").count()) >= 15, "a colour to choose", `${await p.locator("[data-cover-option]").count()}`);
|
||||
check((await p.locator("[data-pattern-option]").count()) > 5, "and a pattern to lay over it", `${await p.locator("[data-pattern-option]").count()}`);
|
||||
check(
|
||||
await p.getByRole("button", { name: "Create", exact: true }).isVisible(),
|
||||
"and the dialog still fits a laptop screen, Create and all"
|
||||
);
|
||||
await p.getByRole("button", { name: "Cancel" }).click();
|
||||
await p.waitForTimeout(400);
|
||||
|
||||
// The two together make the cover, and both reach the server.
|
||||
await p.getByPlaceholder("Notebook name...").fill("Kariert");
|
||||
await p.locator('[data-cover-option="6"]').click();
|
||||
await p.locator('[data-pattern-option="2"]').click();
|
||||
await p.waitForTimeout(300);
|
||||
await p.getByRole("button", { name: "Create", exact: true }).click();
|
||||
await p.waitForTimeout(2000);
|
||||
const books = (await api(p, "GET", "/notebooks")).body;
|
||||
const made = books.find((b) => b.name === "Kariert");
|
||||
check(
|
||||
made?.cover_index === 6 && made?.cover_pattern === 2,
|
||||
"the colour and the pattern are both stored",
|
||||
`cover ${made?.cover_index}, pattern ${made?.cover_pattern}`
|
||||
);
|
||||
/* ── moving a row with a finger ──
|
||||
* Last in the suite, because moving rows about would pull the ground from
|
||||
* under every check above that names an order.
|
||||
|
||||
Reference in new issue
Block a user