gitoria

tickets

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit0bf3fefa0bf3fefaMission 030: edited state note labelmre0bf3fefa/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

  • 0bf3fefaMission 030: edited state note labelmre
  • 691565c6Log neutral-ticket rule checkmre
  • bc3bdecerecords: day38b live, #94 purgedmre
  • f6c5aa0dMerge main (records)mre
  • e23d42acconnect gate: wait for hydration before clicking Disconnectmre
  • a5d45d00records: D38 cause, GOmre
  • 19eeb938records: D38 gates, two day38b failuresmre
  • f8e42a85Re-vendor tickets to Hybriel set day38b (1e554d7)mre
  • 51645016Merge purge-94 (#94, identity rule)mre
  • 94d6ca2arecords: D38 startedmre
  • 9df09aacmission 029: day38b re-vendor + deploymre
  • d2834f65records: #94 backup planmre
  • 4467d8cbrecords: #94 purge readymre
  • aa2d124eREADME: the #94 purge gatemre
  • e843ff7cOne-time purge of miserit-anthar#94 (#94, identity rule): idempotent step in lib/migrate.hl, fixture gate tests/purge94.mjsmre
  • 506a4efdmission 028: #94, identity rulemre
  • 78c7f48eRefine mpackdb holdmre
  • 3d7d89c8Record mpackdb hold until day38mre
  • f1bf7195#51 done; my subscription idmre
  • 9870b945status: #51 proof greenmre