mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 15:42:24 +00:00
Finish the wiring polish: verbosity gate, upload flash, /about links, dead settings slugs
- The Coach verbosity picker is disabled while the concise tone forces brief, with a hint saying so, instead of a live control that silently does nothing. - A fresh document upload flashes its new row like the duplicate path always did; the settle decision is a pure exported helper with a test. - /about gains its two inbound links: the /privacy footer and a Settings→About credits row (the GeoLite2 EULA wants the attribution reachable from the running app). - The eight settings slugs shadowed by permanent redirects (the seven layout children + sharing) leave the slug registry: no more prerendering unreachable pages, no dead component wirings, and the SectionPlaceholder fallback that could never render is gone. The redirects, section components, and layout-hub subpages are unchanged.
This commit is contained in:
1 parent
3b1314d1b0
commit
542ca91be5
25 files changed
+181
-223
No files matched your search
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* The upload manager's settle decision (§3.2 + the fresh-upload flash).
|
||||
*
|
||||
* Watched red: with `settleDecision` returning `flashId: null` on the
|
||||
* non-duplicate branch (the pre-v1.37.19 behaviour — only the duplicate
|
||||
* path flashed the row), the fresh-upload case below fails. A fresh upload
|
||||
* used to give no feedback beyond its queue row disappearing.
|
||||
*/
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { settleDecision } from "../use-document-upload";
|
||||
import type { UploadResult } from "../vault-utils";
|
||||
|
||||
function success(duplicate: boolean): UploadResult {
|
||||
return {
|
||||
ok: true,
|
||||
duplicate,
|
||||
document: { id: "doc-1" },
|
||||
} as unknown as UploadResult;
|
||||
}
|
||||
|
||||
describe("settleDecision", () => {
|
||||
it("flashes the NEW row on a fresh upload (no toast)", () => {
|
||||
expect(settleDecision(success(false))).toEqual({
|
||||
removeFromQueue: true,
|
||||
toastDuplicate: false,
|
||||
flashId: "doc-1",
|
||||
});
|
||||
});
|
||||
|
||||
it("flashes the EXISTING row and toasts on a duplicate", () => {
|
||||
expect(settleDecision(success(true))).toEqual({
|
||||
removeFromQueue: true,
|
||||
toastDuplicate: true,
|
||||
flashId: "doc-1",
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps a failed upload in the queue with no flash", () => {
|
||||
expect(
|
||||
settleDecision({ ok: false, reason: "generic" } as UploadResult),
|
||||
).toEqual({ removeFromQueue: false, toastDuplicate: false, flashId: null });
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user