gitoria

tickets

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitaa4e192caa4e192cTickets conductor: brief 027 push protocol changemreaa4e192c/components/inbox.hl

3.5 KB

  1. // components/inbox.hl — `/inbox` (ticket #20): the tickets ASSIGNED TO YOU, in two lists: pending and
  2. // review, across all projects. Personal: needs a login. Live: a ticket assigned to you, or moving into
  3. // or out of those states, appears / disappears without a reload.
  4. parent './main.hl'
  5. import { inboxRows } from '../lib/tickets.hl'
  6. import { siteName } from '../project.hl'
  7. import { userOfSession } from '../lib/users.hl'
  8. import { hintLook, subjectLook, ticketsLook } from '../lib/looks.hl'
  9. session = null
  10. myId = userOfSession(session) != null ? userOfSession(session).id : ''
  11. loggedIn = myId != ''
  12. loggedOut = myId == ''
  13. box = inboxRows(userOfSession(session))
  14. pending = box.pending
  15. review = box.review
  16. noPending = pending.length == 0
  17. noReview = review.length == 0
  18. __title = siteName + ' | inbox'
  19. Style {
  20. '#loginhint' = hintLook + { }
  21. olTickets = ticketsLook + {
  22. @media {
  23. minWidth = '60rem'
  24. li {
  25. gridTemplateColumns = '8.5rem minmax(0, 1fr) auto'
  26. alignItems = 'center'
  27. gap = '1rem'
  28. }
  29. }
  30. }
  31. aSubject = subjectLook + { }
  32. '#reviewbox' {
  33. display = 'grid'
  34. gap = '.5rem'
  35. h2 {
  36. margin = '0'
  37. fontSize = '1.1rem'
  38. }
  39. }
  40. '#pendingbox' {
  41. display = 'grid'
  42. gap = '.5rem'
  43. h2 {
  44. margin = '0'
  45. fontSize = '1.1rem'
  46. }
  47. }
  48. }
  49. View {
  50. ticketBoard {
  51. h1 { id = "heading" "Inbox" }
  52. if (loggedOut) { p { id = "loginhint" "Log in with ident (top right) to see the tickets assigned to you." } }
  53. if (loggedIn) {
  54. section { id = "reviewbox"
  55. h2 { "Review" }
  56. if (noReview) { p { id = "reviewempty" class = "empty" "Nothing is waiting for your review." } }
  57. ol { id = "review" Style.olTickets
  58. for (row of review) {
  59. li {
  60. ticketState { class = row.stateSlug row.state }
  61. a { Style.aSubject href = row.href ticketRef { row.ref } row.subject }
  62. ticketMeta {
  63. a { href = row.projectHref row.projectTitle }
  64. time { row.updated }
  65. }
  66. }
  67. }
  68. }
  69. }
  70. section { id = "pendingbox"
  71. h2 { "Pending" }
  72. if (noPending) { p { id = "pendingempty" class = "empty" "Nothing is pending for you." } }
  73. ol { id = "pending" Style.olTickets
  74. for (row of pending) {
  75. li {
  76. ticketState { class = row.stateSlug row.state }
  77. a { Style.aSubject href = row.href ticketRef { row.ref } row.subject }
  78. ticketMeta {
  79. a { href = row.projectHref row.projectTitle }
  80. time { row.updated }
  81. }
  82. }
  83. }
  84. }
  85. }
  86. }
  87. }
  88. }
  89. // a row goes to the top of its list if it is assigned to me and in that state, and out of both otherwise
  90. place = (row) => {
  91. p = []
  92. r = []
  93. if (row.assigneeId == myId && row.state == 'pending') { p.push(row) }
  94. if (row.assigneeId == myId && row.state == 'review') { r.push(row) }
  95. for (x of pending) { if (x.id != row.id) { p.push(x) } }
  96. for (x of review) { if (x.id != row.id) { r.push(x) } }
  97. pending = p
  98. review = r
  99. noPending = p.length == 0
  100. noReview = r.length == 0
  101. }
  102. on client ticketCreated(row) { place(row) }
  103. on client ticketEvent(ticketId, ev, row) { place(row) }
  104. on client signedIn(tag, info) {
  105. b = emit server myInbox()
  106. if (b != null && b.pending != null) {
  107. pending = b.pending
  108. review = b.review
  109. noPending = b.pending.length == 0
  110. noReview = b.review.length == 0
  111. myId = b.me
  112. loggedIn = true
  113. loggedOut = false
  114. }
  115. }
  116. on client signedOut(tag) {
  117. myId = ''
  118. loggedIn = false
  119. loggedOut = true
  120. }
  121. on server myInbox(session) {
  122. u = userOfSession(session)
  123. if (u == null) { return { error = 'log in first' } }
  124. b = inboxRows(u)
  125. return { pending = b.pending review = b.review me = u.id }
  126. }

Branches

Latest commits

  • aa4e192cTickets conductor: brief 027 push protocol changemre
  • c5d28fb5Tickets conductor: S51 startedmre
  • fd6ca1e6Tickets conductor: brief 027 waker design, push-test projectmre
  • e448e656Tickets conductor: STATUS #51mre
  • 1c10857bTickets conductor: P51 eval, brief 027mre
  • e725969dTickets conductor: #51 directionmre
  • 1b5c63ddTickets conductor: P51 startedmre
  • 9f13fbdaTickets conductor: brief 026 prioritymre
  • acc477d9Tickets conductor: brief 026 + Vinzenz recommendationsmre
  • 9233a734Tickets conductor: brief 026 completemre
  • 5da589fdTickets conductor: brief 026 + Gitoria's answermre
  • a3cd5329Tickets conductor: tickets#51 opened, brief 026 draftmre
  • 6f6e5797Tickets conductor: STATUS wordingmre
  • 957de51fTickets conductor: T36 live, #36 review, #50 donemre
  • bc2fde32Merge branch 'main' into t36-stylemre
  • b7ca093atests: wait for the new row and normalize editor marker spacesmre
  • 41da3525Tickets conductor: flake cause, T36 deploy stepmre
  • 64c477e6Tickets conductor: deploy waits for Arachnemre
  • 467d7286Tickets conductor: T36 done, deploy questionmre
  • fed5ca81ticket_list: remove repeated selected-state coloursmre