gitoria

ident

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commite23efdfce23efdfcident#40.3: the identity list is one component (components/identitylist.hl); its delete and face dropIdentity move with itmree23efdfc/components/timezone.hl

2.4 KB

  1. // components/timezone.hl — THE TIME ZONE of the signed-in account (ident#40.3), placed by components/home.hl on `/`. The host passes in
  2. // the account's current zone (timeZone); this component owns the input, the browser's zone and the save (face changeTimeZone, which
  3. // asks lib/accounts.hl setTimeZone). The host shows the messages: $parent.status(message, notice) and, after a save, $parent.zoneSaved(zone).
  4. import { accountOfSession, setTimeZone } from '../lib/accounts.hl'
  5. timeZone = ''
  6. tzInput = timeZone
  7. View {
  8. section { id = "timezonesection"
  9. h2 { "Time zone" }
  10. p { class = "lead" "Taken from your browser at your first login. Currently " strong { id = "timezone" timeZone } "." }
  11. p { id = "digestnote" class = "lead" "Your daily mail of notifications comes at 17:00 in this time zone." }
  12. form { id = "tzform"
  13. on submit(e) {
  14. e.preventDefault()
  15. emit saveZone(e)
  16. }
  17. label { "Time zone (IANA name, e.g. Europe/Vienna)"
  18. input { id = "tzinput" name = "timeZone" autocomplete = "off" maxlength = "64" required = "required" value = tzInput on input(e) { emit setTz(e.target.value) } }
  19. }
  20. formButtons {
  21. button { id = "savetz" type = "submit" "Save time zone" }
  22. button { id = "browsertz" type = "button" class = "quiet" "Use this browser's" on click(e) { emit useBrowserZone(e) } }
  23. }
  24. }
  25. }
  26. }
  27. on setTz(v) { tzInput = v }
  28. // the browser's own time zone (IANA name) and whether a name is one it knows (`Intl` is a
  29. // browser global of client code, hybriel#18)
  30. browserZone = () => { return Intl.DateTimeFormat().resolvedOptions().timeZone }
  31. knownZone = (v) => { return v == 'UTC' || Intl.supportedValuesOf('timeZone').includes(v) }
  32. on useBrowserZone(e) { tzInput = browserZone() }
  33. on saveZone(e) {
  34. $parent.status('', '')
  35. v = tzInput.trim()
  36. if (!knownZone(v)) {
  37. $parent.status('this browser does not know the time zone “' + v + '”', '')
  38. return null
  39. }
  40. r = emit server changeTimeZone(v)
  41. if (r == null) {
  42. $parent.status('the server did not answer — try again', '')
  43. return null
  44. }
  45. if (r.error != null) {
  46. $parent.status(r.error, '')
  47. return null
  48. }
  49. tzInput = r.timeZone
  50. $parent.zoneSaved(r.timeZone)
  51. }
  52. // A face runs on a BLANK instance (its arguments and its imports only); the account comes from the session.
  53. on server changeTimeZone(tz, session) {
  54. let me = accountOfSession(&session)
  55. if (me == null) { return { error = 'you are not signed in' } }
  56. r = setTimeZone(me.id, tz)
  57. if (r.error != null) { return r }
  58. return { timeZone = r.account.timeZone }
  59. }

Branches

Latest commits

  • e23efdfcident#40.3: the identity list is one component (components/identitylist.hl); its delete and face dropIdentity move with itmre
  • e24b59a6ident#40.3: the time zone is one component (components/timezone.hl); its face changeTimeZone moves with itmre
  • 8cbc5717ident#40.3: the email step is one component (components/emailstep.hl) placed by home.hl and embed.hlmre
  • 6fad3bd2Merge branch 'f3-codestep' into mainIdent
  • 51e387f2|||PR ident#40 the code step is one component (components/codestep.hl) placed by home.hl and embed.hl; its verify face, setCode, browserZone and verify call exist once (#40.2)mre
  • c28bddeeMerge branch 'f2-shell' into mainIdent
  • c3a40ff6|||PR ident#40 one shell for the app and /start (account part off on /start, #40.1); startshell.hl removed; unused signOut faces gone (#40.4)mre
  • 060f3870ident#40.4: use the shell sign-out faces in regression gatesmre
  • 9b94aa6aMerge branch 'f1b-cleanup' into mainIdent
  • edcfce3f|||PR ident#41 ident#43 ident#44 login error page as a component (same status codes and text, pixel-identical), declarations and route wiring cleaned upmre
  • 3ac85995ident#43 ident#44: plain declarations for never-reassigned lets, one envString helper, named route functions and audience rule out of project.hlmre
  • c7eef14aMerge branch 'nv1-navigate' into mainIdent
  • 644f9775|||PR ident#36 navigate() instead of window.location in the shell, start shell and homemre
  • 4ca2f921deploy.sh: tar --hard-dereference so backups hold no hard linksmre
  • 23971fb7ident#49: media queries in the language's @media formmre
  • 73f4f97dident: re-vendor to hybriel day38b (mpackdb store-open fix)mre
  • aa056c03ident: a startup error prints its message before exit 1 (hybriel#247)mre
  • ee37a861ident#G48: gitoria's registration gets the wildcard origin of its repo addresses at load (gate tests/gitoria-origin.mjs)mre
  • dc6d486fident#27: the docs gate expects the new Access entry in the main menumre
  • d277633cident#27: README: identity access and the introspect endpointmre