gitoriaLog in with ident

calendar

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Branchmain2881119fcalendar mission 001 (4/4): code order — README layout + same-output test, STATUS, LOG, report; tests/letcount.py (sub-folders), tests/realdata-baseline.mjs, tests/realdata-compare.pymremain/components/calendar.hl

3.1 KB

  1. // components/calendar.hl — `/`: the month view under the app header, with the user's private events (ticket calendar#2).
  2. // The faces below are what the month view calls (`emit server …`, the trailing `session` is always the server's since
  3. // hybriel #16): thin wrappers — the session and the window are checked here, the events live in lib/events.hl (the
  4. // answer: calendarView / settingsView, the six weeks on screen), the default reminders in lib/settings.hl.
  5. // Signed out: no session user → nothing is read or written.
  6. parent './main.hl'
  7. import MonthView from './month-view/month-view.hl'
  8. import { userIdOfSession } from '../lib/users.hl'
  9. import { saveEvent, deleteEvent, calendarView, settingsView } from '../lib/events.hl'
  10. import { saveDefaults } from '../lib/settings.hl'
  11. import { validWindow } from '../lib/events-helpers.hl'
  12. __title = 'Calendar'
  13. // the request's headers (hybriel #105, names lowercase): the month view writes its names in the request's language on
  14. // the first render (calendar#6)
  15. headers = null
  16. String requestLanguage = headers != null && headers['accept-language'] != null ? headers['accept-language'] : ''
  17. View {
  18. calendarPage {
  19. MonthView { acceptLanguage = requestLanguage }
  20. }
  21. }
  22. on server calLoad(first, last, session) {
  23. u = userIdOfSession(session)
  24. if (u == null) { return { error = 'log in with ident first' } }
  25. if (!validWindow(first, last)) { return { error = 'not a date' } }
  26. return calendarView(u, first, last)
  27. }
  28. on server calSave(fields, first, last, session) {
  29. u = userIdOfSession(session)
  30. if (u == null) { return { error = 'log in with ident first' } }
  31. if (!validWindow(first, last)) { return { error = 'not a date' } }
  32. if (fields == null || hlTypeName(fields) != 'Hybrid') { return { error = 'the event must be an object' } }
  33. r = saveEvent(u, fields)
  34. if (r.error != null) { return { error = r.error } }
  35. return calendarView(u, first, last)
  36. }
  37. on server calDelete(id, first, last, session) {
  38. u = userIdOfSession(session)
  39. if (u == null) { return { error = 'log in with ident first' } }
  40. if (!validWindow(first, last)) { return { error = 'not a date' } }
  41. r = deleteEvent(u, id)
  42. if (r.error != null) { return { error = r.error } }
  43. return calendarView(u, first, last)
  44. }
  45. // the calendar settings: the default reminders (rows)
  46. on server calSettingsLoad(session) {
  47. u = userIdOfSession(session)
  48. if (u == null) { return { error = 'log in with ident first' } }
  49. return settingsView(u)
  50. }
  51. on server calSettingsSave(rows, session) {
  52. u = userIdOfSession(session)
  53. if (u == null) { return { error = 'log in with ident first' } }
  54. r = saveDefaults(u, rows)
  55. if (r.error != null) { return { error = r.error } }
  56. return settingsView(u)
  57. }
  58. // the same save as calSave, sent while the server cannot be reached: a statement-form emit the offline layer queues and
  59. // replays (an event that is also emitted in value form is never queued — hence its own name)
  60. on server calSaveQueued(fields, first, last, session) {
  61. u = userIdOfSession(session)
  62. if (u == null) { return { error = 'log in with ident first' } }
  63. if (fields == null || hlTypeName(fields) != 'Hybrid') { return { error = 'the event must be an object' } }
  64. r = saveEvent(u, fields)
  65. if (r.error != null) { return { error = r.error } }
  66. return { ok = true }
  67. }

Branches

  • mainmain branch

Latest commits

  • 2881119fcalendar mission 001 (4/4): code order — README layout + same-output test, STATUS, LOG, report; tests/letcount.py (sub-folders), tests/realdata-baseline.mjs, tests/realdata-compare.pymre
  • 3b2a4cd0calendar mission 001 (3/4): code order — let only where reassigned (147 dropped incl. components/month-view; 110 left: 67 reassigned, 43 loop-bound); gates 78/0 (3 of 4 runs; 1 known 'next month' flake) + 18/0, live-data run = step 2mre
  • f5ce6b1dcalendar mission 001 (2/4): code order — topics, map, thin faces: lib/util.hl, lib/events(-helpers).hl (+calendarView/settingsView/soonOf), lib/settings.hl, lib/users.hl (+userOfLoginCode, tagOf), lib/api(-helpers).hl; project.hl = map; login route takes &req/&sessions (failed-login reason now kept); gates 78/0 + 18/0mre
  • c6fbd011calendar mission 001 (1/4): code order — files moved: lib/events.hl, lib/users.hl, components/styles.hl (imports only); gates 78/0 + 18/0, live-data run identicalmre
  • d6c59290calendar: Hybriel master 06617221 (plugin allocators 3a781359 + 413f60e4, mpackdb 2cb7ae5e, http1 773de63e); gates 78/0 + 18/0mre
  • 7bd0337ccalendar: Hybriel master 190aa11d (fc838894 GC correctness, #126 closure scopes, #127); gates 78/0 + 18/0mre
  • ff41310ccalendar: Hybriel master 8efba065 (#126 memory, #48 lambda copy; audit: no & needed)mre
  • 14ba08c7antcolony#40: mission references point to the moved missionsmre
  • 99c73346antcolony#40: history (LOG.md), worker briefs (missions/) and reports moved here from antcolony, numbered per project; old numbers in antcolony docs/mission-map.mdmre
  • 76edaa62calendar: Hybriel master ff51cf46 (re-vendor round, static workaround removed)mre
  • 90a3fc2cdeploy.sh: back up live storage/.sessions/.env before every deploy (newest 5 kept)mre
  • 6722b72ddeploy.sh: never send .git or .gitignore to Byrodinmre
  • be099807State of 2026-09-27, before the move to gitoriamre