Add Timelog: show the timer in the tab title and simplify the code
This is the first commit of the project, at the state that runs on timelog.minhtrannhat.com. Changes in this state: - Remove redundant UI text from the sidebar, timer and insights pages. - Show the remaining time and tag in the browser tab title while a session runs. - Put the shared record type and the due and end helpers in src/shared/record.ts. - Remove the startup tag migration and the one-time Forest import script. The live data does not need them. - Remove unused CSS, Playwright ignore rules and duplicate helpers. - Do not track Forest CSV exports, because they contain private data. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
38 files changed
+2069
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import { expect, test } from "bun:test";
|
||||
import { dueMs, recordEnd, type TimeRecord } from "../src/shared/record.ts";
|
||||
|
||||
const base: TimeRecord = {
|
||||
id: "session_record_test", startMs: 1_000_000, endMs: null, targetSeconds: 60, tag: "Study", note: "",
|
||||
treeType: "", isSuccess: null, source: "timer", rawStart: null, rawEnd: null, deleted: false,
|
||||
};
|
||||
|
||||
test("a running session ends now until it is due", () => {
|
||||
expect(dueMs(base)).toBe(1_060_000);
|
||||
expect(recordEnd(base, 1_030_000)).toBe(1_030_000);
|
||||
expect(recordEnd(base, 2_000_000)).toBe(1_060_000);
|
||||
});
|
||||
|
||||
test("a finished record keeps its own end", () => {
|
||||
expect(recordEnd({ ...base, endMs: 1_010_000 }, 2_000_000)).toBe(1_010_000);
|
||||
});
|
||||
Reference in new issue
Block a user