gitoria

calendar

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit384d3d23384d3d23|||PR give calendar months their own addressAtlas384d3d23/components/month-view/month-view.hl

41.7 KB

  1. // month-view.hl — THE MONTH VIEW: prev / next buttons on top, the month's name and the year between them, the
  2. // days below (weeks start on Monday; the days of the neighbouring months are dimmed; today is marked).
  3. // THE CALENDAR'S COPY of the pure-Hybriel month view of components.hybriel.worldapi.org (no .js), plus the user's
  4. // events on the days and the editor for them (add: click a day; edit / delete: click an event). Events come from
  5. // events.hl, one server round trip per change (faces calLoad / calSave / calDelete in calendar.hl). The date
  6. // arithmetic is written here (plain integers), so it runs the same on the server (first render) and in the browser.
  7. // What only the browser knows — today in the user's time zone, the month and weekday names in the user's language,
  8. // the time zone's name (`Date` and `Intl` are browser globals of View handlers) — is read the moment the pointer, a
  9. // finger or the keyboard reaches the month view; until then the server's UTC date and language-neutral names (month number, dots) show — the server never knows
  10. // the language, so it never guesses one: names appear once, in the browser's language, and stay.
  11. // The page reads `year` and `month` (1–12) as its own members. USE ONE PER PAGE: a composed component's
  12. // members are the page's state (COMPONENTS.md §12).
  13. import { serverToday } from '../../lib/clock.hl'
  14. import { pad, daysIn, before } from '../../lib/dates.hl'
  15. import { namesFor } from '../../lib/names.hl'
  16. import { userIdOfSession } from '../../lib/users.hl'
  17. import { eventsBetween, upcoming } from '../../lib/events.hl'
  18. import { defaultsOf } from '../../lib/settings.hl'
  19. import { pushConfigured } from '../../lib/util.hl'
  20. import { navigate, notify, subscribePush } from 'hl:web'
  21. import { plan, missed, shift, describe, withIndex, defaultRows } from '../../lib/reminders.hl'
  22. // the request's Accept-Language, handed in by the page (calendar.hl reads it from `headers`, hybriel #105): the first
  23. // render already writes the names
  24. acceptLanguage = null
  25. Hybrid known = namesFor(acceptLanguage)
  26. Boolean namesKnown = known != null
  27. String today = serverToday()
  28. monthAddress = null
  29. String addressedMonth = validMonth(monthAddress) ? monthAddress : today.slice(0, 7)
  30. Number year = toNumber(addressedMonth.slice(0, 4))
  31. Number month = toNumber(addressedMonth.slice(5, 7))
  32. String prevUrl = '/?m=' + (month == 1 ? year - 1 : year) + '-' + (month == 1 ? '12' : ('' + (100 + month - 1)).slice(1))
  33. String nextUrl = '/?m=' + (month == 12 ? year + 1 : year) + '-' + (month == 12 ? '01' : ('' + (100 + month + 1)).slice(1))
  34. Hybrid monthNames = namesKnown ? known.months : ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']
  35. Hybrid weekdayNames = namesKnown ? known.days : ['·', '·', '·', '·', '·', '·', '·']
  36. String title = monthNames[month - 1] + ' ' + year
  37. Hybrid base = build(year, month, today)
  38. Hybrid weekdays = weekdayNames
  39. session = null
  40. userId = userIdOfSession(session)
  41. Boolean signedIn = userId != null
  42. String winFirst = base[0].date
  43. String winLast = base[41].date
  44. Hybrid events = signedIn ? eventsBetween(userId, winFirst, winLast) : []
  45. Hybrid days = fill(base, events)
  46. // the reminders (ticket calendar#4): the events of the next days with the reminders that apply (`soon`, kept with the page
  47. // state, so an offline page still knows them), the calendar's defaults in words, the timers the browser holds
  48. Hybrid soon = signedIn ? upcoming(userId, shift(today, -2), shift(today, 9)) : []
  49. String defaultText = signedIn ? describe(defaultsOf(userId)) : ''
  50. Hybrid defRows = signedIn ? defaultsOf(userId) : []
  51. Boolean fCustom = false
  52. Hybrid remRows = []
  53. Hybrid setRows = []
  54. Hybrid timers = []
  55. Number lastArm = 0
  56. // P1: arm() is called from several places at once (page load, pageshow, visibilitychange, the server's answer); its notify calls wait
  57. // for the browser, so a second run started in between showed the same missed reminder again and left timers behind. One at a time.
  58. Number arming = 0
  59. Number armAgain = 0
  60. String notifyState = 'unknown'
  61. String setError = ''
  62. Boolean settingsOpen = false
  63. String askClass = 'hidden'
  64. String blockedClass = 'hidden'
  65. String plannedText = ''
  66. String pushText = ''
  67. Boolean pushTried = false
  68. Boolean pushAvailable = pushConfigured
  69. String pushOffClass = 'hidden'
  70. Boolean pushIsOff = false
  71. Boolean pushOn = false
  72. String fId = ''
  73. String fTitle = ''
  74. Boolean fAllDay = false
  75. String fStartDate = ''
  76. String fStartTime = '09:00'
  77. String fEndDate = ''
  78. String fEndTime = '10:00'
  79. String fPlace = ''
  80. String fNotes = ''
  81. String fZone = 'UTC'
  82. String formClass = 'closed'
  83. String formError = ''
  84. String formHeading = 'New event'
  85. Boolean isNew = true
  86. String formKind = 'timed'
  87. String ownClass = 'quiet'
  88. String calClass = ''
  89. String defaultClass = ''
  90. String rowsClass = 'hidden'
  91. String addClass = 'quiet hidden'
  92. String timedButton = ''
  93. String alldayButton = 'quiet'
  94. String deleteClass = 'danger hidden'
  95. String prevLabel = namesKnown ? known.prev : '‹'
  96. String nextLabel = namesKnown ? known.next : '›'
  97. Number seen = 0
  98. Number paged = monthAddress != null ? 1 : 0
  99. validMonth(String text) {
  100. if (text == null || text.length != 7 || text.slice(4, 5) != '-') { return false }
  101. y = toNumber(text.slice(0, 4))
  102. m = toNumber(text.slice(5, 7))
  103. return y != null && y >= 1000 && y <= 9999 && m != null && m >= 1 && m <= 12 && text == y + '-' + ('' + (100 + m)).slice(1)
  104. }
  105. // 0 = Monday … 6 = Sunday (Sakamoto's method gives 0 = Sunday)
  106. weekdayOf(Number y, Number m, Number d) {
  107. t = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4]
  108. yy = m < 3 ? y - 1 : y
  109. sun = (yy + (yy - yy % 4) / 4 - (yy - yy % 100) / 100 + (yy - yy % 400) / 400 + t[m - 1] + d) % 7
  110. return (sun + 6) % 7
  111. }
  112. // 42 days (six weeks of seven), so the view keeps its height from month to month
  113. build(Number y, Number m, String todayText) {
  114. py = m == 1 ? y - 1 : y
  115. pm = m == 1 ? 12 : m - 1
  116. ny = m == 12 ? y + 1 : y
  117. nm = m == 12 ? 1 : m + 1
  118. lead = weekdayOf(y, m, 1)
  119. n = daysIn(y, m)
  120. pn = daysIn(py, pm)
  121. out = []
  122. let day = 1 - lead
  123. let w = 0
  124. while (w < 6) {
  125. let i = 0
  126. while (i < 7) {
  127. let cy = y
  128. let cm = m
  129. let cd = day
  130. let cls = ''
  131. if (day < 1) { cy = py cm = pm cd = pn + day cls = 'outside' }
  132. if (day > n) { cy = ny cm = nm cd = day - n cls = 'outside' }
  133. date = cy + '-' + pad(cm) + '-' + pad(cd)
  134. if (date == todayText) { cls = 'today' }
  135. out.push({ n = cd date = date cls = cls })
  136. day = day + 1
  137. i = i + 1
  138. }
  139. w = w + 1
  140. }
  141. return out
  142. }
  143. // the events that touch a day, as four chips on the day cell (a nested `for` does not repaint when the outer list is
  144. // reassigned: hybriel #86 — so the chips are fixed members of the day: t = text, c = class, v = event id).
  145. // Timed events start with their time on the first day. More than four: the fourth chip says "+N more".
  146. fill(Hybrid list, Hybrid evs) {
  147. out = []
  148. let i = 0
  149. while (i < list.length) {
  150. d = list[i]
  151. hit = []
  152. let j = 0
  153. while (j < evs.length) {
  154. e = evs[j]
  155. if (!before(d.date, e.first) && !before(e.last, d.date)) { hit.push(e) }
  156. j = j + 1
  157. }
  158. row = { n = d.n date = d.date cls = d.cls addLabel = 'Add event on ' + d.date }
  159. let k = 0
  160. while (k < 4) {
  161. let text = ''
  162. let cls = 'unused'
  163. let id = ''
  164. if (k < hit.length && (hit.length <= 4 || k < 3)) {
  165. e = hit[k]
  166. text = (e.allDay || d.date != e.first ? '' : e.startTime + ' ') + e.title
  167. cls = 'event'
  168. id = e.id
  169. }
  170. if (k == 3 && hit.length > 4) { text = '+' + (hit.length - 3) + ' more' cls = 'more' }
  171. row['t' + k] = text
  172. row['c' + k] = cls
  173. row['v' + k] = id
  174. k = k + 1
  175. }
  176. out.push(row)
  177. i = i + 1
  178. }
  179. return out
  180. }
  181. // the form's fields for a new event on `date` (all text; allDay a Boolean); zone = the browser's time zone name
  182. blank(String date, String zone) {
  183. return { id = '' title = '' allDay = false startDate = date startTime = '09:00' endDate = date endTime = '10:00' place = '' notes = '' zone = zone custom = false rows = [] }
  184. }
  185. show(Number y, Number m, Hybrid evs) {
  186. year = y
  187. month = m
  188. title = monthNames[m - 1] + ' ' + y
  189. base = build(y, m, today)
  190. winFirst = base[0].date
  191. winLast = base[41].date
  192. events = evs
  193. days = fill(base, evs)
  194. }
  195. // Layout only (mission 006): the theme (theme/theme.hl, `html month-view …`) tiles the day cells and takes the frames and radii away, buttons
  196. // and fields come from the theme (44 px taps, 16 px fields). Colours: the semantic WorldAPI tokens as css variables, each with its palette
  197. // value as fallback (a component's browser module cannot import tokens.hl itself); the app sets --color-accent in its styles.hl.
  198. // PHONE FIRST: a day cell has no side padding (its event chips are 44 px tall and as wide as the cell); the wide layout is from 60rem.
  199. Style {
  200. monthView { display = 'grid' gap = '.5rem'
  201. header { display = 'flex' flexWrap = 'wrap' alignItems = 'center' justifyContent = 'space-between' gap = '.5rem'
  202. // sync of components.hybriel 4922f9c (MC): the prev / next buttons are 44 px targets on any width (the theme gave 36 px high at 1280)
  203. button { minWidth = '2.75rem' minHeight = '2.75rem' }
  204. // Existing public IDs keep the paging targets above the theme desktop button minimum.
  205. '#month-prev, #month-next' {
  206. minWidth = '2.75rem'
  207. minHeight = '2.75rem'
  208. display = 'inline-flex'
  209. alignItems = 'center'
  210. justifyContent = 'center'
  211. }
  212. }
  213. // calendar#14: on a phone the month name and the Reminder settings button did not fit in one row, so the name broke into two lines
  214. // ("Oktobe / r 2026"). The name never breaks; the button drops to its own row on the right when the row is too narrow.
  215. '#settings-open' { marginLeft = 'auto' }
  216. h2 { margin = '0' fontSize = '1.1rem' color = 'var(--color-text-strong, rgb(245, 250, 255))' textAlign = 'center' flex = '1 1 auto' whiteSpace = 'nowrap' textTransform = 'capitalize' }
  217. '.hidden' { display = 'none' }
  218. }
  219. // the 7-column grid is the weekday row's and the days' only: it used to be `month-view ol`, so it also caught the reminder
  220. // lists (the settings dialog's rows stood in 7 narrow columns, calendar#11)
  221. '#month-weekdays, #month-days' { display = 'grid' gridTemplateColumns = 'repeat(7, minmax(0, 1fr))' margin = '0' padding = '0' listStyle = 'none' }
  222. '#month-weekdays' {
  223. li { margin = '0' padding = '.3rem 0' fontSize = '.8rem' fontWeight = '600' color = 'var(--color-text-muted, rgb(145, 150, 155))' textAlign = 'center' }
  224. }
  225. '#month-days' {
  226. li {
  227. position = 'relative'
  228. minHeight = '3.5rem'
  229. margin = '0'
  230. padding = '.2rem 0'
  231. textAlign = 'right'
  232. background = 'var(--color-surface, rgb(35, 40, 45))'
  233. cursor = 'pointer'
  234. overflow = 'hidden'
  235. }
  236. // The add action covers the cell; the date stays visible above it.
  237. 'button.day-add' {
  238. position = 'absolute'
  239. inset = '0'
  240. width = '100%'
  241. height = '100%'
  242. minWidth = '0'
  243. minHeight = '0'
  244. padding = '0'
  245. border = '0'
  246. borderRadius = '0'
  247. background = 'transparent'
  248. focusVisible {
  249. outline = '2px solid var(--color-accent)'
  250. outlineOffset = '-2px'
  251. }
  252. }
  253. time {
  254. pointerEvents = 'none'
  255. position = 'relative'
  256. display = 'block'
  257. paddingRight = '.25rem'
  258. color = 'var(--color-text, rgb(195, 200, 205))'
  259. fontSize = '.95rem'
  260. }
  261. 'li.outside' { background = 'var(--color-background, rgb(25, 30, 35))'
  262. time { color = 'var(--color-text-muted, rgb(145, 150, 155))' }
  263. }
  264. 'li.today' { outline = '2px solid var(--color-accent, #569bd4)' outlineOffset = '-2px'
  265. time { color = 'var(--color-accent, #569bd4)' fontWeight = '800' }
  266. }
  267. }
  268. // the notifications section of the reminder settings: the state in words, then one full-width button per action (44 px taps)
  269. notifyBox { display = 'grid' gap = '.5rem'
  270. h3 { margin = '0' fontSize = '.85rem' fontWeight = '600' color = 'var(--color-text-muted, rgb(145, 150, 155))' }
  271. p { margin = '0' fontSize = '.85rem' color = 'var(--color-text-muted, rgb(145, 150, 155))'
  272. empty { display = 'none' }
  273. }
  274. button { width = '100%' }
  275. }
  276. reminderBox { display = 'grid' gap = '.4rem'
  277. h3 { margin = '0' fontSize = '.85rem' fontWeight = '600' color = 'var(--color-text-muted, rgb(145, 150, 155))' }
  278. p { margin = '0' fontSize = '.85rem' color = 'var(--color-text-muted, rgb(145, 150, 155))' }
  279. }
  280. // the reminder lists (the event's own, the calendar's defaults): one row per reminder, the full width
  281. '#rem-rows, #set-rows' { display = 'grid' gridTemplateColumns = 'minmax(0, 1fr)' gap = '.5rem' margin = '0' padding = '0' listStyle = 'none' }
  282. // PHONE: a reminder is `[number] [unit, the rest of the width] [×]` and, for "days before, at", the time under them; every
  283. // field is at least a tap (2.75rem) high (the theme); the unit's select takes the width the number and × leave
  284. reminderRow { display = 'grid' gridTemplateColumns = '5rem minmax(0, 1fr) 2.75rem' alignItems = 'center' gap = '.4rem'
  285. input { minWidth = '0' width = '100%' }
  286. select { minWidth = '0' width = '100%' gridColumn = '2' }
  287. 'input[type=time]' { gridColumn = '1 / 3' }
  288. button { gridColumn = '3' gridRow = '1' minWidth = '2.75rem' minHeight = '2.75rem' padding = '0' }
  289. }
  290. 'reminder-row.other' { 'input[type=time]' { display = 'none' } }
  291. // ---- the events on the days and the editors (moved here from styles.hl, calendar#16; the markup is this file's) ----
  292. // PHONE: a cell is 48 px wide, so a chip is the cell's width and at least the tap (44 px, the theme's button size) high; its
  293. // text is cut with an ellipsis. The cell has no side padding so the chip may be that wide.
  294. dayEvents {
  295. position = 'relative'
  296. pointerEvents = 'none'
  297. display = 'grid'
  298. gap = '.15rem'
  299. marginTop = '.2rem'
  300. textAlign = 'left'
  301. }
  302. 'button.unused' { display = 'none' }
  303. 'button.hidden' { display = 'none' }
  304. 'button.event, button.more' {
  305. pointerEvents = 'auto'
  306. display = 'block'
  307. minWidth = '0'
  308. width = '100%'
  309. padding = '.15rem .2rem'
  310. overflow = 'hidden'
  311. fontSize = '.75rem'
  312. fontWeight = '500'
  313. lineHeight = '1.3'
  314. textAlign = 'left'
  315. textOverflow = 'ellipsis'
  316. whiteSpace = 'nowrap'
  317. color = 'var(--color-accent)'
  318. background = 'var(--color-background-sunken)'
  319. }
  320. 'button.more' { color = 'var(--color-text-muted)' background = 'transparent' }
  321. '#notify-ask' { color = 'var(--color-accent-text)' background = 'var(--color-accent)' }
  322. // the switches (time/all day, the event's own reminders or the calendar's): the chosen one is the accent, the other `quiet`
  323. kindSwitch { display = 'flex' flexWrap = 'wrap' gap = '.5rem'
  324. 'button:not(.quiet)' { color = 'var(--color-accent-text)' background = 'var(--color-accent)' }
  325. }
  326. formButtons { display = 'flex' flexWrap = 'wrap' gap = '.5rem'
  327. 'button.danger' { marginLeft = 'auto' }
  328. }
  329. // the editors (event, reminder settings): a full-page scrim with one panel
  330. eventEditor { position = 'fixed' inset = '0' zIndex = '40' display = 'grid' placeItems = 'center' padding = '1rem' background = 'color-mix(in srgb, var(--color-background-sunken) 82%, transparent)'
  331. form { display = 'grid' gap = '.7rem' width = '100%' maxWidth = '28rem' maxHeight = '100%' overflowY = 'auto' padding = '1rem' background = 'var(--color-surface)' borderRadius = 'var(--radius-large)' }
  332. h2 { margin = '0' }
  333. label { display = 'grid' gap = '.2rem' margin = '0' fontSize = '.85rem' fontWeight = '400' color = 'var(--color-text-muted)' }
  334. input { width = '100%' color = 'var(--color-text-strong)' }
  335. textarea { width = '100%' color = 'var(--color-text-strong)' }
  336. }
  337. 'event-editor.closed' { display = 'none' }
  338. // the settings dialog is a popover (top layer): the browser's popover defaults (fit-content box, border, margin) give way to the full-page scrim
  339. 'event-editor[popover]' { width = '100%' height = '100%' maxWidth = 'none' maxHeight = 'none' margin = '0' border = '0' overflow = 'hidden' color = 'var(--color-text)' }
  340. 'event-editor[popover]:not(:popover-open)' { display = 'none' }
  341. fieldRow { display = 'grid' gridTemplateColumns = 'minmax(0, 1fr) minmax(0, 1fr)' gap = '.5rem' }
  342. 'form.allday' { 'label.timed' { display = 'none' }
  343. fieldRow { gridTemplateColumns = 'minmax(0, 1fr)' }
  344. }
  345. '@media (min-width: 60rem)' {
  346. // the desktop's chips are small on purpose (a pointer; four of them stand in one cell): under 44 px, deliberately
  347. 'button.event, button.more' { minHeight = '0' padding = '.05rem .3rem' borderRadius = 'var(--radius-small)' }
  348. '#month-days' { li { minHeight = '5rem' padding = '.3rem' } }
  349. // the editor's panel is 28rem wide there: the time stands in the row's line again
  350. reminderRow { gridTemplateColumns = '5rem minmax(0, 1fr) 7.5rem 2.75rem'
  351. 'input[type=time]' { gridColumn = '3' }
  352. button { gridColumn = '4' }
  353. }
  354. 'reminder-row.other' { select { gridColumn = '2 / 4' } }
  355. }
  356. }
  357. View {
  358. monthView { on pointerover(e) { emit monthEnv(e) } on focusin(e) { emit monthEnv(e) } on touchstart(e) { emit monthEnv(e) }
  359. header {
  360. a { id = "month-prev" href = prevUrl class = "button quiet" title = prevLabel "‹" }
  361. h2 { id = "month-title" title }
  362. a { id = "month-next" href = nextUrl class = "button quiet" title = nextLabel "›" } if (signedIn) { button { id = "settings-open" type = "button" class = "quiet" popovertarget = "settingseditor" popovertargetaction = "show" "Reminder settings" } }
  363. }
  364. ol { id = "month-weekdays" for (name of weekdays) { li { name } } }
  365. ol { id = "month-days"
  366. for (d of days) {
  367. li { class = d.cls
  368. if (signedIn) { button { type = "button" class = "day-add" 'aria-label' = d.addLabel on click() { addDay(d.date) } } }
  369. time { datetime = d.date d.n }
  370. dayEvents {
  371. button { class = d.c0 type = "button" value = d.v0 d.t0 on click() { pickEvent(d.v0, d.date) } }
  372. button { class = d.c1 type = "button" value = d.v1 d.t1 on click() { pickEvent(d.v1, d.date) } }
  373. button { class = d.c2 type = "button" value = d.v2 d.t2 on click() { pickEvent(d.v2, d.date) } }
  374. button { class = d.c3 type = "button" value = d.v3 d.t3 on click() { pickEvent(d.v3, d.date) } }
  375. }
  376. }
  377. }
  378. }
  379. eventEditor { id = "eventeditor" class = formClass
  380. form { id = "eventform" class = formKind
  381. on submit(e) {
  382. e.preventDefault()
  383. emit saveEvent(e)
  384. }
  385. h2 { id = "formheading" formHeading }
  386. kindSwitch {
  387. button { id = "kind-timed" type = "button" class = timedButton "At a time" on click(e) { emit setKind(false) } }
  388. button { id = "kind-allday" type = "button" class = alldayButton "All day" on click(e) { emit setKind(true) } }
  389. }
  390. label { "Title"
  391. input { id = "f-title" name = "title" maxlength = "200" autocomplete = "off" required = "required" value = fTitle on input(e) { emit setF('title', e.target.value) } }
  392. }
  393. fieldRow {
  394. label { "From"
  395. input { id = "f-startdate" name = "startDate" type = "date" required = "required" value = fStartDate on input(e) { emit setF('startDate', e.target.value) } }
  396. }
  397. label { class = "timed" "at"
  398. input { id = "f-starttime" name = "startTime" type = "time" value = fStartTime on input(e) { emit setF('startTime', e.target.value) } }
  399. }
  400. }
  401. fieldRow {
  402. label { "To"
  403. input { id = "f-enddate" name = "endDate" type = "date" value = fEndDate on input(e) { emit setF('endDate', e.target.value) } }
  404. }
  405. label { class = "timed" "at"
  406. input { id = "f-endtime" name = "endTime" type = "time" value = fEndTime on input(e) { emit setF('endTime', e.target.value) } }
  407. }
  408. }
  409. label { "Place"
  410. input { id = "f-place" name = "place" maxlength = "200" autocomplete = "off" value = fPlace on input(e) { emit setF('place', e.target.value) } }
  411. }
  412. label { "Notes"
  413. textarea { id = "f-notes" name = "notes" rows = "4" maxlength = "5000" value = fNotes on input(e) { emit setF('notes', e.target.value) } }
  414. }
  415. reminderBox {
  416. h3 { "Reminders" }
  417. kindSwitch {
  418. button { id = "rem-calendar" type = "button" class = calClass "Calendar's" on click(e) { emit setCustom(false) } }
  419. button { id = "rem-own" type = "button" class = ownClass "Own" on click(e) { emit setCustom(true) } }
  420. }
  421. p { id = "rem-default-text" class = defaultClass defaultText }
  422. ol { id = "rem-rows" class = rowsClass
  423. for (r of remRows) {
  424. reminderRow { class = r.cls
  425. input { type = "number" min = "0" value = r.n on change(e) { emit setRem('rem', r.i, 'n', e.target.value) } }
  426. select { value = r.unit on change(e) { emit setRem('rem', r.i, 'unit', e.target.value) }
  427. option { value = "minutes" "minutes before" }
  428. option { value = "hours" "hours before" }
  429. option { value = "days" "days before, at" }
  430. }
  431. input { type = "time" value = r.time on change(e) { emit setRem('rem', r.i, 'time', e.target.value) } }
  432. button { type = "button" class = "quiet" "×" on click(e) { emit delRem('rem', r.i) } }
  433. }
  434. }
  435. }
  436. button { id = "rem-add" type = "button" class = addClass "Add reminder" on click(e) { emit addRem('rem') } }
  437. }
  438. p { id = "formerror" class = "message" formError }
  439. formButtons {
  440. button { id = "event-save" type = "submit" "Save" }
  441. button { id = "event-cancel" type = "button" class = "quiet" "Cancel" on click(e) { emit closeForm(e) } }
  442. button { id = "event-delete" type = "button" class = deleteClass "Delete" on click(e) { emit deleteEvent(e) } }
  443. }
  444. }
  445. }
  446. eventEditor { id = "settingseditor" popover = "manual" popoverOpen = settingsOpen on toggle(Hybrid e) { emit settingsToggled(e) } on keydown(Hybrid e) { emit settingsKey(e) }
  447. form { id = "settingsform" class = "timed"
  448. on submit(e) {
  449. e.preventDefault()
  450. emit saveSettings(e)
  451. }
  452. h2 { "Reminder settings" }
  453. notifyBox {
  454. h3 { "Notifications on this device" }
  455. p { id = "notify-blocked" class = blockedClass "Notifications are blocked for this site in the browser settings." }
  456. p { id = "notify-planned" plannedText }
  457. p { id = "push-state" pushText }
  458. button { id = "notify-ask" type = "button" class = askClass "Turn on notifications" on click(e) { emit askNotify(e) } }
  459. button { id = "push-test" type = "button" class = pushOffClass "Send a test notification" on click(e) { emit pushTest(e) } }
  460. button { id = "push-off" type = "button" class = pushOffClass "Turn off on this device" on click(e) { emit pushOff(e) } }
  461. }
  462. reminderBox {
  463. h3 { "Default reminders" }
  464. p { class = "muted" "Every event without reminders of its own is reminded like this:" }
  465. ol { id = "set-rows"
  466. for (r of setRows) {
  467. reminderRow { class = r.cls
  468. input { type = "number" min = "0" value = r.n on change(e) { emit setRem('set', r.i, 'n', e.target.value) } }
  469. select { value = r.unit on change(e) { emit setRem('set', r.i, 'unit', e.target.value) }
  470. option { value = "minutes" "minutes before" }
  471. option { value = "hours" "hours before" }
  472. option { value = "days" "days before, at" }
  473. }
  474. input { type = "time" value = r.time on change(e) { emit setRem('set', r.i, 'time', e.target.value) } }
  475. button { type = "button" class = "quiet" "×" on click(e) { emit delRem('set', r.i) } }
  476. }
  477. }
  478. }
  479. button { id = "set-add" type = "button" class = "quiet" "Add reminder" on click(e) { emit addRem('set') } }
  480. }
  481. p { id = "settingserror" class = "message" setError }
  482. formButtons {
  483. button { id = "set-save" type = "submit" "Save" }
  484. button { id = "set-cancel" type = "button" class = "quiet" popovertarget = "settingseditor" popovertargetaction = "hide" autofocus = "autofocus" "Cancel" }
  485. }
  486. }
  487. }
  488. input { id = "month-view-goto" type = "hidden" on change(e) { emit monthGoto(e.target.value) } }
  489. }
  490. }
  491. // the events of the six weeks shown, from the server (none while signed out)
  492. loadEvents(Number y, Number m) {
  493. if (!signedIn) { return [] }
  494. b = build(y, m, today)
  495. r = emit server calLoad(b[0].date, b[41].date)
  496. if (r != null && r.soon != null) { takeSoon(r) }
  497. return r == null || r.events == null ? [] : r.events
  498. }
  499. // the browser's today, language and time zone, once: today follows the user's time zone, the names their language
  500. on monthEnv(Hybrid e) {
  501. browserEnv()
  502. // every ten minutes of use the timers are set again (a long-open page keeps the next week planned)
  503. if (signedIn && Date.now() - lastArm > 600000) { arm() }
  504. }
  505. // the device's IANA time zone, read from the browser each time (arm can run before the first pointer set fZone)
  506. deviceZone() {
  507. z = Intl.DateTimeFormat().resolvedOptions().timeZone
  508. return z != null && z != '' ? z : 'UTC'
  509. }
  510. browserEnv() {
  511. if (seen == 1) { return null }
  512. seen = 1
  513. serverDay = today
  514. now = new Date()
  515. lang = navigator.language != null ? navigator.language : 'en'
  516. zone = Intl.DateTimeFormat().resolvedOptions().timeZone
  517. browserDay = ('' + (10000 + now.getFullYear())).slice(1) + '-' + pad(now.getMonth() + 1) + '-' + pad(now.getDate())
  518. if (browserDay != serverDay) { today = browserDay }
  519. // the server already wrote the names of a language it knows: they stay, so paging never switches them
  520. if (!namesKnown) {
  521. mf = Intl.DateTimeFormat(lang, { month = 'long' timeZone = 'UTC' })
  522. df = Intl.DateTimeFormat(lang, { weekday = 'short' timeZone = 'UTC' })
  523. ms = []
  524. ds = []
  525. let i = 0
  526. while (i < 12) { ms.push(mf.format(new Date(Date.UTC(2024, i, 15, 12)))) i = i + 1 }
  527. i = 0
  528. while (i < 7) { ds.push(df.format(new Date(Date.UTC(2024, 0, 1 + i, 12)))) i = i + 1 }
  529. // (only what differs is assigned: a same-valued assignment still repaints the title and the days)
  530. if (ms.join('|') != monthNames.join('|')) { monthNames = ms }
  531. if (ds.join('|') != weekdayNames.join('|')) { weekdayNames = ds weekdays = ds }
  532. de = lang.slice(0, 2) == 'de'
  533. pl = de ? 'Voriger Monat' : 'Previous month'
  534. nl = de ? 'Nächster Monat' : 'Next month'
  535. if (pl != prevLabel) { prevLabel = pl }
  536. if (nl != nextLabel) { nextLabel = nl }
  537. }
  538. fZone = zone != null && zone != '' ? zone : 'UTC'
  539. readPermission()
  540. // calendar#9: a phone freezes or drops an app it switched away from, and its timers with it. Whenever the app is
  541. // shown again the timers are set again, and what came due meanwhile is shown at once (arm → missed)
  542. // Nothing is repainted unless the browser's day is not the server's: the server already drew this month with its events,
  543. // and a round trip here, answered while the user pages or taps a day, used to put the month back or swallow the tap.
  544. if (browserDay == serverDay) {
  545. if (!namesKnown) {
  546. named = monthNames[month - 1] + ' ' + year
  547. if (named != title) { title = named }
  548. }
  549. } else if (paged == 0) {
  550. // the month shown follows the corrected today only while the user has not paged yet (also when they page meanwhile)
  551. y = toNumber(today.slice(0, 4))
  552. m = toNumber(today.slice(5, 7))
  553. evs = loadEvents(y, m)
  554. if (paged == 0) { show(y, m, evs) } else { show(year, month, events) }
  555. } else { show(year, month, events) }
  556. // (offline the server did not answer: the timers are set from the reminders the page already holds)
  557. arm()
  558. }
  559. // ---- the reminders: notifications the browser holds a timer for (they fire while the app or its worker is open, also offline) ----
  560. // the server's newest answer about the reminders to come; the timers are set again from it
  561. takeSoon(Hybrid r) {
  562. soon = r.soon
  563. if (r.defaults != null) { defaultText = r.defaults }
  564. if (r.defaultRows != null) { defRows = r.defaultRows }
  565. arm()
  566. }
  567. // one timer per reminder that is still to come within a week; the old timers are dropped first. Before that, calendar#9:
  568. // the reminders that came due since this device last planned or showed one, while no timer could fire (the app switched
  569. // away and frozen, dropped, or closed), are shown now — late, for events that have not started yet
  570. arm() {
  571. if (arming == 1) {
  572. armAgain = 1
  573. return null
  574. }
  575. arming = 1
  576. armOnce()
  577. while (armAgain == 1) {
  578. armAgain = 0
  579. armOnce()
  580. }
  581. arming = 0
  582. return null
  583. }
  584. armOnce() {
  585. if (!signedIn) { return null }
  586. let i = 0
  587. while (i < timers.length) { clearTimeout(timers[i]) i = i + 1 }
  588. nowMs = Date.now()
  589. readPermission()
  590. let since = remindedUntil(nowMs)
  591. if (notifyState == 'granted') {
  592. since = pushedSince(since)
  593. late = missed(soon, since, nowMs, today, deviceZone())
  594. i = 0
  595. while (i < late.length) {
  596. q = late[i]
  597. notify(q.title, { body = q.late tag = q.key icon = '/icons/icon-192.png' })
  598. i = i + 1
  599. }
  600. }
  601. remember(nowMs)
  602. list = plan(soon, nowMs, 604800000, deviceZone())
  603. ids = []
  604. i = 0
  605. while (i < list.length) {
  606. // `p` is a new binding on every pass (hybriel #106): each timer keeps ITS reminder
  607. p = list[i]
  608. ids.push(setTimeout(() => {
  609. remember(p.at)
  610. notify(p.title, { body = p.body tag = p.key icon = '/icons/icon-192.png' })
  611. }, p.at - nowMs))
  612. i = i + 1
  613. }
  614. timers = ids
  615. lastArm = nowMs
  616. // calendar#9 part 2: a device that already allowed notifications is subscribed to Web Push once per page (its own handler:
  617. // the browser's subscribe can take long and must not hold the timers)
  618. if (!pushTried && notifyState == 'granted') {
  619. pushTried = true
  620. emit pushEnsure(1)
  621. }
  622. plannedText = list.length == 0 ? '' : (list.length == 1 ? '1 reminder' : list.length + ' reminders') + ' set for the next 7 days'
  623. }
  624. // P1: a device with push gets its reminders from the server, even when the page is closed. A reminder the server pushed
  625. // (shown, tapped, swiped away) must not be shown again by this page as "missed": the later of the page's own instant and the
  626. // server's. Without a subscription, or if the server does not answer, the page's own instant stays.
  627. pushedSince(Number own) {
  628. if (!pushAvailable || pushOffKept()) { return own }
  629. reg = navigator.serviceWorker != null ? navigator.serviceWorker.getRegistration() : null
  630. sub = reg != null && reg.pushManager != null ? reg.pushManager.getSubscription() : null
  631. if (sub == null) { return own }
  632. r = emit server calPushedUntil(sub.endpoint)
  633. return r != null && r.since != null && r.since > own ? r.since : own
  634. }
  635. // the instant up to which this device has planned or shown the user's reminders (the browser's localStorage); none
  636. // kept yet → the last 12 hours count as missed
  637. remindedKey() {
  638. return 'calendar-reminded-until-' + userId
  639. }
  640. remindedUntil(Number nowMs) {
  641. store = window.localStorage
  642. kept = store != null ? store.getItem(remindedKey()) : null
  643. return kept != null && kept != '' ? toNumber(kept) : nowMs - 43200000
  644. }
  645. remember(Number at) {
  646. store = window.localStorage
  647. if (store == null) { return null }
  648. kept = store.getItem(remindedKey())
  649. if (kept == null || kept == '' || toNumber(kept) < at) { store.setItem(remindedKey(), '' + at) }
  650. }
  651. // ONE state for the notification section (C13): `pushOn` (this device is subscribed to push) and `notifyState` / `pushIsOff` decide
  652. // every control at once — "Turn on" only while not on, test + off only while on, the blocked hint only when blocked
  653. readPermission() {
  654. n = window.Notification
  655. notifyState = n == null ? 'unsupported' : n.permission
  656. pushIsOff = pushOffKept()
  657. showControls()
  658. }
  659. showControls() {
  660. askClass = !pushOn && (notifyState == 'default' || (notifyState == 'granted' && pushIsOff)) ? '' : 'hidden'
  661. blockedClass = notifyState == 'denied' ? '' : 'hidden'
  662. pushOffClass = pushOn ? '' : 'hidden'
  663. if (!pushOn && notifyState == 'unsupported') { pushText = 'This browser cannot show notifications.' }
  664. if (!pushOn && pushText == '') { pushText = 'Reminders show while the calendar is open on this device.' }
  665. }
  666. // the button is the click the browser wants before it allows notifications
  667. on askNotify(Hybrid e) {
  668. browserEnv()
  669. notify('Notifications are on', { body = 'Your reminders show up here.' })
  670. pushTried = true
  671. pushOffKeep(false)
  672. readPermission()
  673. emit pushEnsure(1)
  674. }
  675. // "Turn off on this device": the browser drops its push subscription and the server forgets the device. The choice is kept
  676. // (localStorage) so that this device is not subscribed again at the next page; "Turn on notifications" undoes it.
  677. on pushOff(Hybrid e) {
  678. browserEnv()
  679. pushOffKeep(true)
  680. reg = navigator.serviceWorker != null ? navigator.serviceWorker.getRegistration() : null
  681. sub = reg != null && reg.pushManager != null ? reg.pushManager.getSubscription() : null
  682. if (sub != null) {
  683. endpoint = sub.endpoint
  684. sub.unsubscribe()
  685. emit server calPushOff(endpoint)
  686. }
  687. pushOn = false
  688. pushText = 'Reminders show while the calendar is open on this device.'
  689. readPermission()
  690. }
  691. // "Send a test notification": the server sends ONE push to this device in ~10 seconds; leave the app and it arrives like a reminder
  692. on pushTest(Hybrid e) {
  693. browserEnv()
  694. reg = navigator.serviceWorker != null ? navigator.serviceWorker.getRegistration() : null
  695. sub = reg != null && reg.pushManager != null ? reg.pushManager.getSubscription() : null
  696. if (sub == null) {
  697. pushText = 'This device is not subscribed: tap "Turn on notifications" first.'
  698. return null
  699. }
  700. r = emit server calPushTest(sub.endpoint)
  701. pushText = r != null && r.ok ? 'A test notification is on its way (about 10 seconds). Close the calendar or lock the phone now: "Calendar test - Push works on this device" should appear.' : 'The test could not be started: ' + (r != null && r.error != null ? r.error : 'no answer')
  702. }
  703. pushOffKey() {
  704. return 'calendar-push-off-' + userId
  705. }
  706. pushOffKept() {
  707. store = window.localStorage
  708. return store != null && store.getItem(pushOffKey()) == '1'
  709. }
  710. pushOffKeep(Boolean off) {
  711. store = window.localStorage
  712. if (store == null) { return null }
  713. if (off) { store.setItem(pushOffKey(), '1') } else { store.removeItem(pushOffKey()) }
  714. pushIsOff = off
  715. }
  716. // calendar#9 part 2: this device's Web Push subscription goes to the server, which sends the reminders to it when the page
  717. // is closed. No push (no key on the server, no browser support, refused) leaves the page's own timers as they were.
  718. on pushEnsure(Number n) {
  719. if (!signedIn || !pushAvailable || notifyState != 'granted' || pushOffKept()) { return null }
  720. sub = subscribePush()
  721. if (sub == null) {
  722. pushText = 'Reminders show while the calendar is open on this device.'
  723. pushOn = false
  724. showControls()
  725. return null
  726. }
  727. r = emit server calPushSave(sub, fZone)
  728. pushText = r != null && r.ok ? 'Reminders also reach this device when the calendar is closed.' : 'Reminders show while the calendar is open on this device.'
  729. pushOn = r != null && r.ok
  730. showControls()
  731. }
  732. // the page is shown (first show included): a device that already allowed notifications is subscribed / its subscription
  733. // refreshed now, not at the user's first touch
  734. on client shown(Hybrid r) {
  735. if (seen == 0) { browserEnv() } else { arm() }
  736. }
  737. // from a host script (the date picker): "YYYY-MM-DD" → show that date's month
  738. on monthGoto(String text) {
  739. paged = 1
  740. y = toNumber(text.slice(0, 4))
  741. m = toNumber(text.slice(5, 7))
  742. navigate('/?m=' + y + '-' + pad(m))
  743. }
  744. // ---- the editor ----
  745. // the reminders switch: the calendar's or the event's own
  746. syncCustom() {
  747. calClass = fCustom ? 'quiet' : ''
  748. ownClass = fCustom ? '' : 'quiet'
  749. defaultClass = fCustom ? 'hidden' : ''
  750. rowsClass = fCustom ? '' : 'hidden'
  751. addClass = fCustom ? 'quiet' : 'quiet hidden'
  752. }
  753. // the classes that follow the form's kind and whether it edits an existing event
  754. syncForm() {
  755. formKind = fAllDay ? 'allday' : 'timed'
  756. timedButton = fAllDay ? 'quiet' : ''
  757. alldayButton = fAllDay ? '' : 'quiet'
  758. deleteClass = isNew ? 'danger hidden' : 'danger'
  759. }
  760. openForm(Hybrid fields, String heading, Boolean fresh) {
  761. fId = fields.id
  762. fTitle = fields.title
  763. fAllDay = fields.allDay
  764. fStartDate = fields.startDate
  765. fStartTime = fields.startTime
  766. fEndDate = fields.endDate
  767. fEndTime = fields.endTime
  768. fPlace = fields.place
  769. fNotes = fields.notes
  770. isNew = fresh
  771. fCustom = fields.custom
  772. remRows = withIndex(fields.rows)
  773. syncCustom()
  774. formHeading = heading
  775. formError = ''
  776. formClass = 'open'
  777. syncForm()
  778. }
  779. // Each day and chip carries its action's date or event id from the loop record.
  780. addDay(String date) {
  781. if (!signedIn) { return null }
  782. openForm(blank(date, fZone), 'New event', true)
  783. }
  784. pickEvent(String id, String date) {
  785. if (!signedIn) { return null }
  786. // The overflow chip has always opened a new event for its day.
  787. if (id == '') { addDay(date) return null }
  788. let j = 0
  789. while (j < events.length) {
  790. ev = events[j]
  791. if (ev.id == id) {
  792. fields = { id = ev.id title = ev.title allDay = ev.allDay startDate = ev.startDate startTime = ev.startTime endDate = ev.endDate endTime = ev.endTime place = ev.place notes = ev.notes zone = fZone custom = ev.custom rows = ev.rows }
  793. openForm(fields, 'Edit event', false)
  794. return null
  795. }
  796. j = j + 1
  797. }
  798. }
  799. on setF(String name, String value) {
  800. if (name == 'title') { fTitle = value }
  801. if (name == 'startDate') { fStartDate = value }
  802. if (name == 'startTime') { fStartTime = value }
  803. if (name == 'endDate') { fEndDate = value }
  804. if (name == 'endTime') { fEndTime = value }
  805. if (name == 'place') { fPlace = value }
  806. if (name == 'notes') { fNotes = value }
  807. }
  808. on setCustom(Boolean own) {
  809. fCustom = own
  810. // switching to own reminders starts from the calendar's, so nothing has to be typed for the usual case
  811. if (own && remRows.length == 0) { remRows = withIndex(defaultRows) }
  812. syncCustom()
  813. }
  814. // one reminder row of the event editor (which = 'rem') or of the settings (which = 'set')
  815. on setRem(String which, Number i, String field, String value) {
  816. rows = which == 'rem' ? remRows : setRows
  817. if (i < 0 || i >= rows.length) { return null }
  818. out = []
  819. let k = 0
  820. while (k < rows.length) {
  821. r = rows[k]
  822. let n = r.n
  823. let unit = r.unit
  824. let time = r.time
  825. if (k == i && field == 'n') { n = value }
  826. if (k == i && field == 'unit') { unit = value }
  827. if (k == i && field == 'time') { time = value }
  828. out.push({ unit = unit n = n time = time })
  829. k = k + 1
  830. }
  831. if (which == 'rem') { remRows = withIndex(out) } else { setRows = withIndex(out) }
  832. }
  833. on addRem(String which) {
  834. rows = which == 'rem' ? remRows : setRows
  835. out = []
  836. let k = 0
  837. while (k < rows.length) { out.push({ unit = rows[k].unit n = rows[k].n time = rows[k].time }) k = k + 1 }
  838. out.push({ unit = 'minutes' n = '10' time = '09:00' })
  839. if (which == 'rem') { remRows = withIndex(out) } else { setRows = withIndex(out) }
  840. }
  841. on delRem(String which, Number i) {
  842. rows = which == 'rem' ? remRows : setRows
  843. out = []
  844. let k = 0
  845. while (k < rows.length) {
  846. if (k != i) { out.push({ unit = rows[k].unit n = rows[k].n time = rows[k].time }) }
  847. k = k + 1
  848. }
  849. if (which == 'rem') { remRows = withIndex(out) } else { setRows = withIndex(out) }
  850. }
  851. // ---- the calendar settings: the default reminders ----
  852. // the dialog is a MANUAL popover (a nested auto one would be closed with the menu that opened it; the menu's "Reminder settings" opens it declaratively, popovertarget — the menu lives in the shell, outside this
  853. // component): opening it is the event that reads the device's state and the calendar's defaults
  854. on settingsToggled(Hybrid e) {
  855. settingsOpen = e.newState == 'open'
  856. if (e.newState != 'open') { return null }
  857. // no pointer event of the month view may have come yet, so the page's browser state is read now —
  858. // the notification section is right on the first look (and a device that allowed notifications is subscribed)
  859. browserEnv()
  860. readPermission()
  861. r = emit server calSettingsLoad()
  862. if (r == null || r.error != null) {
  863. setError = r == null ? 'the settings need the server: you are offline' : r.error
  864. return null
  865. }
  866. setRows = withIndex(r.rows)
  867. setError = ''
  868. }
  869. // Escape closes it (a manual popover has no light dismiss: it must stay open when the menu, which opened it, closes)
  870. on settingsKey(Hybrid e) {
  871. if (e.key == 'Escape') { settingsOpen = false }
  872. }
  873. on saveSettings(Hybrid e) {
  874. r = emit server calSettingsSave(setRows)
  875. if (r == null || r.error != null) {
  876. setError = r == null ? 'the settings could not be saved (offline?)' : r.error
  877. return null
  878. }
  879. settingsOpen = false
  880. takeSoon(r)
  881. }
  882. on setKind(Boolean allDay) {
  883. fAllDay = allDay
  884. if (!allDay && fStartTime == '') { fStartTime = '09:00' }
  885. if (!allDay && fEndTime == '' && fEndDate != '') { fEndTime = '10:00' }
  886. syncForm()
  887. }
  888. on closeForm(Hybrid e) {
  889. formClass = 'closed'
  890. }
  891. // what the form holds, as the face takes it
  892. formFields() {
  893. return { id = fId title = fTitle allDay = fAllDay startDate = fStartDate startTime = fStartTime endDate = fEndDate endTime = fEndTime place = fPlace notes = fNotes zone = fZone custom = fCustom reminders = remRows }
  894. }
  895. // the event as the page shows it, for an event saved while offline (the server sends the real one when it is back)
  896. localView(Hybrid f) {
  897. allDay = f.allDay
  898. last = f.endDate != '' ? f.endDate : f.startDate
  899. mine = []
  900. let k = 0
  901. while (k < f.reminders.length) { mine.push({ unit = f.reminders[k].unit n = f.reminders[k].n time = f.reminders[k].time }) k = k + 1 }
  902. return { id = f.id title = f.title allDay = allDay first = f.startDate last = last
  903. startDate = f.startDate startTime = allDay ? '' : f.startTime endDate = f.endDate endTime = allDay ? '' : f.endTime
  904. place = f.place notes = f.notes start = f.startDate zone = f.zone custom = f.custom rows = f.custom ? mine : defRows }
  905. }
  906. on saveEvent(Hybrid e) {
  907. f = formFields()
  908. if (fTitle.trim() == '' || fStartDate == '') {
  909. formError = 'the event needs a title and a start date'
  910. return null
  911. }
  912. r = emit server calSave(f, winFirst, winLast)
  913. if (r == null) {
  914. // OFFLINE: the save waits in the app's queue (it is sent when the connection is back); here the event and its
  915. // reminders are set at once, so the notification still comes
  916. if (f.id == '') { f.id = 'local-' + Date.now() }
  917. emit server calSaveQueued(f, winFirst, winLast)
  918. v = localView(f)
  919. evs = []
  920. let k = 0
  921. while (k < events.length) { if (events[k].id != v.id) { evs.push(events[k]) } k = k + 1 }
  922. evs.push(v)
  923. mine = []
  924. k = 0
  925. while (k < soon.length) { if (soon[k].id != v.id) { mine.push(soon[k]) } k = k + 1 }
  926. mine.push({ id = v.id title = v.title allDay = v.allDay startDate = v.startDate startTime = v.startTime place = v.place zone = v.zone rows = v.rows })
  927. soon = mine
  928. formClass = 'closed'
  929. show(year, month, evs)
  930. arm()
  931. return null
  932. }
  933. if (r.error != null) {
  934. formError = r.error
  935. return null
  936. }
  937. formClass = 'closed'
  938. takeSoon(r)
  939. show(year, month, r.events)
  940. }
  941. on deleteEvent(Hybrid e) {
  942. r = emit server calDelete(fId, winFirst, winLast)
  943. if (r == null || r.error != null) {
  944. formError = r == null ? 'the event could not be deleted (offline?)' : r.error
  945. return null
  946. }
  947. formClass = 'closed'
  948. takeSoon(r)
  949. show(year, month, r.events)
  950. }

Branches

Latest commits

  • 384d3d23|||PR give calendar months their own addressAtlas
  • fff2f537Merge branch 'calendar31-lib' into mainAtlas
  • 07cde3dc|||PR keep worker records out of the repo; README vendor is day72Atlas
  • a753b0ab|||PR move shared calendar logic to libAtlas
  • b32a921dMerge branch 'vendor-day72' into mainAtlas
  • 60a0dd19|||PR Hybriel day72 (00c9dbb8) instead of the withdrawn day73Atlas
  • 53f5464dMerge branch 'calendar26-day73' into mainAtlas
  • 338499ec|||PR Keep reminder settings open during editing and rejected savesAtlas
  • ad9e8d59|||PR Use framework page and popover state, Hybriel day73Atlas
  • cab224a1Re-vendor calendar to verified Hybriel day73Atlas
  • f9b8f918Merge branch 'calendar-vendor-day61' into mainAtlas
  • 66341793|||PR Vendor Hybriel day61Atlas
  • 36fc596bMerge branch 'vendor-day59' into mainAtlas
  • b37cc1da|||PR Vendor Hybriel day59Atlas
  • 05665102Merge branch 'vendor-day56' into mainAtlas
  • 687296fb|||PR Vendor Hybriel day56Atlas
  • a6166d4eMerge branch 'hl-standard-3' into mainAtlas
  • 6d0eb3b0|||PR Calendar day add buttons only when signed in (Kunibert minor)Atlas
  • add4b499|||PR Make calendar day actions keyboard accessibleAtlas
  • 79e49b4dMerge branch 'hl-standard' into mainAtlas