Study - New Outline stage (hierarchical I./A./1. points, linked to chunks, in all exports); the chunk stage is now "Chunks" - Home cards: passages shown as ranges, tags capped with "+N more" Reader - Side-by-side translations and a Compare tab per verse - Typeface, line spacing, verse-number settings; text and column scale with the screen - Highlights/bookmarks sheet with named colours (synced); BSB footnote spacing fix - Cmd-K palette (passages, studies, notes, marks), keyboard shortcuts and "?" help Flow and safety - Toasts with Undo replace most confirm()/alert() - Back/Forward move between pages - Server refuses saves over a newer copy (409); keep-mine / use-other banner; opening a study no longer re-stamps it - Latest chapter request wins when flipping quickly Offline and data - Save books, plan days or a whole BSB/NET for offline - Service worker fixes: helloao /api/ URLs were skipped and responses cloned too late - Settings: download/restore a full backup Accessibility - Sheets trap focus and close on Escape, skip link, focus ring, reduced motion, theme contrast raised to 4.5:1 (with a test) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
19 lines
975 B
JavaScript
19 lines
975 B
JavaScript
// Stops one device from silently overwriting a study another device has saved since. The browser sends
|
|
// the `lastEdited` of the server copy it last saw (X-Base-Edited); if the server's copy has moved past
|
|
// that, the save is refused with 409 and the person chooses whose version to keep.
|
|
|
|
// stored: the server copy's lastEdited (null when there is none); base: what the client last saw
|
|
// (null/undefined when it never synced this study); force: the person chose "keep mine".
|
|
export function isSaveConflict({ stored, base, force = false }) {
|
|
if (force || stored == null) return false;
|
|
if (!Number.isFinite(base)) return false; // a device that never saw the server's copy has nothing to compare
|
|
return stored > base;
|
|
}
|
|
|
|
// Reads the base header; anything that isn't a plain number is treated as "unknown".
|
|
export function parseBase(header) {
|
|
if (header == null || header === '') return null;
|
|
const n = Number(header);
|
|
return Number.isFinite(n) ? n : null;
|
|
}
|