The new reader app replaces the old UI: Checklist with a rail (focus pills, Next to expire, today's dailies, pinned routines), Timeline in a new and a classic look, Routines, Archive and a Settings area, in a Structured (default) and a Relaxed interface. It follows the approved Round 6 B and Round 7 mockups, corrected screen by screen with the owner. Reader data moves to a v2 store (gacha-tracker:v2:*). Existing v1 data is migrated on first load, a recovery copy is written first, and the v1 keys are never removed, so a rollback finds them unchanged. Redeem codes for Genshin arrive as their own feed. Also: live's urgency ramp, editable per theme; completion and section-complete fireworks; a returning-user tour; the design mockups, specs, plans, reviews and handoff record. Co-Authored-By: Claude Opus 5.5 <[email protected]>
80 lines
2.3 KiB
TypeScript
80 lines
2.3 KiB
TypeScript
import { expect, test } from "bun:test";
|
|
import { renderToStaticMarkup as render } from "react-dom/server";
|
|
import { UpdatesPanel } from "../src/client/components/redesign/UpdatesPanel.tsx";
|
|
import { migrateLegacy } from "../src/client/state/reader/migration.ts";
|
|
const at = "2026-10-16T12:00:00.000Z";
|
|
test("codes and source age have distinct compact update rows, with no panel when empty", () => {
|
|
const s = migrateLegacy({}, ["genshin"], at, () => "account:test"),
|
|
feed = {
|
|
schemaVersion: 1 as const,
|
|
generatedAt: at,
|
|
events: [],
|
|
sources: [],
|
|
};
|
|
const common = {
|
|
state: s,
|
|
feed,
|
|
now: Date.parse(at),
|
|
onSources: () => {},
|
|
onAction: async () => ({ ok: true as const }),
|
|
};
|
|
expect(render(<UpdatesPanel {...common} />)).toBe("");
|
|
const html = render(
|
|
<UpdatesPanel
|
|
{...common}
|
|
codes={{
|
|
schemaVersion: 1,
|
|
sources: [],
|
|
codes: [
|
|
{
|
|
id: "code",
|
|
game: "genshin",
|
|
code: "TEST",
|
|
reward: null,
|
|
expiresAt: null,
|
|
firstObservedAt: at,
|
|
sourceUrl: "https://example.com",
|
|
},
|
|
],
|
|
}}
|
|
/>,
|
|
);
|
|
expect(html).toContain("New redeem codes");
|
|
expect(html).not.toContain("New since you last looked");
|
|
expect(html).not.toContain("Older schedules");
|
|
});
|
|
test("the source-age notice can be hidden for one, three or seven days", async () => {
|
|
const s = migrateLegacy({}, ["genshin"], at, () => "account:test");
|
|
const feed = {
|
|
schemaVersion: 1 as const,
|
|
generatedAt: at,
|
|
events: [],
|
|
sources: [
|
|
{
|
|
sourceId: "genshin-events",
|
|
game: "genshin" as const,
|
|
url: "https://example.com",
|
|
lastSuccessAt: null,
|
|
lastConfirmedAt: null,
|
|
contentChangedAt: null,
|
|
eventCount: 0,
|
|
parsedCount: null,
|
|
statesNoEvents: false,
|
|
},
|
|
],
|
|
};
|
|
const html = render(
|
|
<UpdatesPanel
|
|
state={s}
|
|
feed={feed}
|
|
now={Date.parse(at)}
|
|
onSources={() => {}}
|
|
onAction={async () => ({ ok: true as const })}
|
|
/>,
|
|
);
|
|
expect(html).toContain("Event data may be out of date");
|
|
expect(html).toContain('aria-label="Hide this notice"');
|
|
for (const label of [">1 day<", ">3 days<", ">7 days<"])
|
|
expect(html).toContain(label);
|
|
});
|