gitoria

tickets

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitbc2fde32bc2fde32Merge branch 'main' into t36-stylemrebc2fde32/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

  • 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
  • 8542fc8aTickets conductor: T36 proof reviewedmre
  • 35980936inbox: preserve desktop columns after list styles were scopedmre
  • 2a5b8b91Tickets conductor: T36 cap stop, resumed for proofmre
  • c077a5cbstyles: format Style with nested language rulesmre
  • ccdde2beticket: format Style with nested language rulesmre
  • d083535bticket_list: nest Style rules and bare media queriesmre
  • c24608ebmarkdown: format Style with nested language rulesmre
  • de964b3bsettings: format Style with nested language rulesmre
  • 03c1de05new_project: format Style with nested language rulesmre
  • bd76cfa6connect: format Style with nested language rulesmre
  • 01fad593inbox: format Style with nested language rulesmre
  • 79dc9392you: format Style with nested language rulesmre
  • 78073baamain: format Style with nested language rulesmre
  • 6a82097fTickets conductor: Arachne W228 on day35 flakemre