calendar
All repositories: gitoria
4.3 KB
// components/calendar.hl — `/`: the month view under the app header, with the user's private events (ticket calendar#2).// The faces below are what the month view calls (`emit server …`, the trailing `session` is always the server's since// hybriel #16): thin wrappers — the session and the window are checked here, the events live in lib/events.hl (the// answer: calendarView / settingsView, the six weeks on screen), the default reminders in lib/settings.hl.// Signed out: no session user → nothing is read or written.parent './main.hl'import MonthView from './month-view/month-view.hl'import { userIdOfSession } from '../lib/users.hl'import { saveEvent, deleteEvent, calendarView, settingsView } from '../lib/events.hl'import { saveDefaults } from '../lib/settings.hl'import { savePush, dropPush, hasPush, testPush, pushedUntil } from '../lib/push.hl'import { validWindow } from '../lib/events-helpers.hl'__title = 'Calendar'// the request's headers (hybriel #105, names lowercase): the month view writes its names in the request's language on// the first render (calendar#6)headers = nullString requestLanguage = headers != null && headers['accept-language'] != null ? headers['accept-language'] : ''View {calendarPage {MonthView { acceptLanguage = requestLanguage }}}on server calLoad(first, last, session) {u = userIdOfSession(session)if (u == null) { return { error = 'log in with ident first' } }if (!validWindow(first, last)) { return { error = 'not a date' } }return calendarView(u, first, last)}on server calSave(fields, first, last, session) {u = userIdOfSession(session)if (u == null) { return { error = 'log in with ident first' } }if (!validWindow(first, last)) { return { error = 'not a date' } }if (fields == null || hlTypeName(fields) != 'Hybrid') { return { error = 'the event must be an object' } }r = saveEvent(u, fields)if (r.error != null) { return { error = r.error } }return calendarView(u, first, last)}on server calDelete(id, first, last, session) {u = userIdOfSession(session)if (u == null) { return { error = 'log in with ident first' } }if (!validWindow(first, last)) { return { error = 'not a date' } }r = deleteEvent(u, id)if (r.error != null) { return { error = r.error } }return calendarView(u, first, last)}// the calendar settings: the default reminders (rows)on server calSettingsLoad(session) {u = userIdOfSession(session)if (u == null) { return { error = 'log in with ident first' } }return settingsView(u)}on server calSettingsSave(rows, session) {u = userIdOfSession(session)if (u == null) { return { error = 'log in with ident first' } }r = saveDefaults(u, rows)if (r.error != null) { return { error = r.error } }return settingsView(u)}// the same save as calSave, sent while the server cannot be reached: a statement-form emit the offline layer queues and// replays (an event that is also emitted in value form is never queued — hence its own name)on server calSaveQueued(fields, first, last, session) {u = userIdOfSession(session)if (u == null) { return { error = 'log in with ident first' } }if (fields == null || hlTypeName(fields) != 'Hybrid') { return { error = 'the event must be an object' } }r = saveEvent(u, fields)if (r.error != null) { return { error = r.error } }return { ok = true }}// Web Push (calendar#9): this device's push subscription and zone — stored, so a reminder reaches it with the page closedon server calPushSave(sub, zone, session) {u = userIdOfSession(session)if (u == null) { return { error = 'log in with ident first' } }return savePush(u, sub, zone)}// "Send a test notification": one test push to this device in a few seconds (calendar#12: a phone owner can see that push reaches it)on server calPushTest(endpoint, session) {u = userIdOfSession(session)if (u == null) { return { error = 'log in with ident first' } }return testPush(u, endpoint)}// P1: up to when the server has pushed this device's reminders (the page does not show those again as missed)on server calPushedUntil(endpoint, session) {u = userIdOfSession(session)if (u == null) { return { since = 0 } }return pushedUntil(u, endpoint)}// this device stops getting pusheson server calPushOff(endpoint, session) {u = userIdOfSession(session)if (u == null) { return { error = 'log in with ident first' } }return dropPush(u, endpoint)}
Branches
Latest commits
- e9fec7bb|||PR HL-STANDARD clean-up: typed parameters, plain locals, by-reference cacheAtlas
- eff166a4Re-vendor complete Hybriel plugins and runtime to day44mre
- cef81394Wait for the DST fixture page instead of an unused socketmre
- 42434f47Check lazy-session cookies after login with a stored anonymous fixturemre
- 728e84e3Re-vendor complete Hybriel day41 plugin directoriesmre
- cbd7ff43Backup tar: --hard-dereference, so mpackdb sidecars are never stored as hard links (Tracker's finding)mre
- 59d1da0acalendar: plain declarations instead of needless let in 9 files (calendar#17): 49 declarations that are never reassigned; reassigned ones and the timer closure's p stay letmre
- f5415cf9calendar: the Style blocks in the language's nested form (calendar#16): rules named after the View's own elements with their children nested, pseudo-classes and @media nested, merged duplicate select rule; same CSS, shots identical in Chrome at 4 sizesmre
- edb7c947calendar: the sign-in callback keeps the session it finds and signs it in (same cookie, nothing signed out; ident#28); security gate 56+4 failing → 60 passedmre
- bf8cc0fcStyles move into their components: the shell's styles into main.hl, the events and the editors into the month view's Style block; styles.hl keeps only the theme inherit, the accent and the message line; .gitignore ignores a bin symlink too; tests/styles-shots.mjs for the before/after pixel comparemre
- 5d8579d7README: login.js stays by caramboleyo's explicit rulemre
- cc759328Merge sb3-standby: calendar deploys through its standbymre
- f2fcdc6dcalendar: a standby container (port 45015, profile standby, reminder clock off) and a /health page; deploy hands over through standby-swap.sh without a gapmre
- 229643f7Merge branch 'cal-14'mre
- 1110b26fcalendar#14: the month name no longer breaks into two lines on a phone (Reminder settings drops to its own row when the header is too narrow), gate checks for one-line title and all header controls on screenmre
- 490c658aident#31: the selector's sign-in returns to the page the user started on (return attribute = the login callback with next), gate checkmre
- 18095868calendar: Reminder settings button opens its dialog again (the dialog's open handler still closed the removed user menu and stopped); old e2e and gate scripts use the new headermre
- 6eee4b5acalendar header: the selector alone top right plus Log out as before the theme missions; Reminder settings back on the month page (WIP: the settings test still fails)mre
- 0b909decident selector back in the header (creator 2026-10-24): selector top right signed in and out on phone and desktop, no second Log in button, new gate checks (WIP: gates not re-run after the last edits)mre
- 0c8f9364Merge branch 'sy-sync'mre