calendar
All repositories: gitoria
2.5 KB
// lib/push-plan.hl — the SERVER's copy of reminders.hl `planBetween` / `missed` (calendar#9 part 2): the same rules, but the// instants come from hl:time `fromLocal` (the zone database of the server) instead of the browser's `Intl`, which the server// has not. NOT in reminders.hl because Hybriel refuses a static that calls hl:time `fromLocal` in a component's browser build// ("'viaStatic' is a static … whose initializer reaches 'instantOf', a name the realm 'client' … cannot bind"; repro// .scratch/hltime-client/, reported). When that works, delete this file and call reminders.hl with a zone.import { fromLocal } from 'hl:time'import { prevDay } from '../components/month-view/dates.hl'import { bodyOf, lateBodyOf } from '../components/month-view/reminders.hl'// 'YYYY-MM-DDTHH:MM:SS' in a zone → epoch msstatic instantIn = (wall, zone) => {return fromLocal({ year = toNumber(wall.slice(0, 4)) month = toNumber(wall.slice(5, 7)) day = toNumber(wall.slice(8, 10)) hour = toNumber(wall.slice(11, 13)) minute = toNumber(wall.slice(14, 16)) }, zone)}// events { id title allDay startDate startTime place zone rows } → their reminders with sinceMs < at <= nowMs (an all-day event's// day is read in `deviceZone`)static dueBetween = (events, sinceMs, nowMs, deviceZone, todayText) => {out = []let i = 0while (i < events.length) {let ev = events[i]let zone = ev.allDay ? deviceZone : ev.zonelet start = instantIn(ev.startDate + 'T' + (ev.allDay ? '00:00' : ev.startTime) + ':00', zone)let j = 0while (j < ev.rows.length) {let r = ev.rows[j]let at = 0if (r.unit == 'minutes') { at = start - toNumber(r.n) * 60000 }else if (r.unit == 'hours') { at = start - toNumber(r.n) * 3600000 }else {let day = ev.startDatelet k = toNumber(r.n)while (k > 0) { day = prevDay(day) k = k - 1 }at = instantIn(day + 'T' + r.time + ':00', zone)}if (at > sinceMs && at <= nowMs) {out.push({ id = ev.id key = ev.id + ':' + at at = at start = start title = ev.title body = bodyOf(ev, r) late = lateBodyOf(ev, todayText) })}j = j + 1}i = i + 1}return out}// …of events that have not started yet, one per event (the newest of its reminders)static dueNow = (events, sinceMs, nowMs, deviceZone, todayText) => {all = dueBetween(events, sinceMs, nowMs, deviceZone, todayText)out = []let i = 0while (i < all.length) {let q = all[i]let newest = q.start > nowMslet j = 0while (j < all.length) {if (all[j].id == q.id && all[j].at > q.at) { newest = false }j = j + 1}if (newest) { out.push(q) }i = i + 1}return out}
Branches
Latest commits
- ce16a4efdeploy: backup copies index files first and *.mpack data last (hot-copy skew, hybriel #203)mre
- f490bc8cdeploy: Web Push gate tests/push.mjs (PUSH_GATE_PORT)mre
- 3af29fc8calendar mission 008 (A8): report, README, LOG, push-shots.mjsmre
- f91f3663calendar mission 008 (A8): push only asked of the browser when the app has the VAPID settings (pushAvailable); real-FCM E2E scripts (push-real-app.mjs, push-real.mjs)mre
- bf571badcalendar mission 008 (A8): Turn off on this device (unsubscribes the browser, server drops the device, choice kept), subscribe/refresh when the app is shown again; push gate part 3mre
- 50985708calendar mission 008 (A7): Web Push report, README, mission, LOGmre
- ee318774calendar mission 008 (A7): push-real.mjs, push sent log linemre
- ebda0fd1calendar mission 008 (A7): server-side reminder plan on hl:time (push-plan.hl; hl:time fromLocal in a browser static is refused: repro .scratch/hltime-client), push gate 9/9mre
- d063dad3calendar mission 008 (A7): Web Push (WIP): lib/push.hl subscriptions + sender clock, faces calPushSave/calPushOff, button subscribes, VAPID tool, tests/push.mjs; instantOf on hl:timemre
- cf175c80calendar mission 008 (A7): re-vendor Hybriel master 0e3c9830 (bin 9d957fed, plugins whole: hl:crypto Web Push primitives, hl:web sendPush)mre
- 9bf3c38bcalendar mission 008: re-vendor Hybriel f9833544 (gates old = new); Web Push stopped: hl:crypto half missing on mastermre
- 186f969bcalendar mission 007: signed-in gate for the first-pointer race (fails on 3c5604f), README theme section, reportmre
- ba9b4955calendar mission 006: first pointer event no longer re-runs the month (stale overwrite race), gate check, e2e settings cleanup, reportmre
- bd730759calendar mission 006: theme move (WIP): brief, report, LOG, STATUSmre
- b117b153calendar mission 006 WIP: reminder row fields keep 44 px; e2e script flagsmre
- 53e3b0debrowser gate: Log out through the user menu, theme colour rgb(15, 20, 25)mre
- 90bf9e2ecalendar mission 006 WIP: theme dbe3de7, theme shell (AppHeader/MainMenu/UserMenu/Sidebar/ContentFirst), styles cut to the app's own rules, check-theme gate, e2e toolsmre
- 3c5604f9identkit: refuse a taken ident port, cold-start deadline, abort on dead ident, clear no-code error (as notes)mre
- 4996bbe7paths: projects moved into /media/STORAGE/projects/WorldAPI/mre
- f5bf0803calendar mission 004: re-vendor Hybriel to the shared static build 0f396652; compose cache volume + tmpfs; notify-paths gate in deploy.sh; gate start waits 150 s; reportmre