tickets
All repositories: gitoria
3.5 KB
// components/inbox.hl — `/inbox` (ticket #20): the tickets ASSIGNED TO YOU, in two lists: pending and// review, across all projects. Personal: needs a login. Live: a ticket assigned to you, or moving into// or out of those states, appears / disappears without a reload.parent './main.hl'import { inboxRows } from '../lib/tickets.hl'import { siteName } from '../project.hl'import { userOfSession } from '../lib/users.hl'import { hintLook, subjectLook, ticketsLook } from '../lib/looks.hl'session = nullmyId = userOfSession(session) != null ? userOfSession(session).id : ''loggedIn = myId != ''loggedOut = myId == ''box = inboxRows(userOfSession(session))pending = box.pendingreview = box.reviewnoPending = pending.length == 0noReview = review.length == 0__title = siteName + ' | inbox'Style {'#loginhint' = hintLook + { }olTickets = ticketsLook + {@media {minWidth = '60rem'li {gridTemplateColumns = '8.5rem minmax(0, 1fr) auto'alignItems = 'center'gap = '1rem'}}}aSubject = subjectLook + { }'#reviewbox' {display = 'grid'gap = '.5rem'h2 {margin = '0'fontSize = '1.1rem'}}'#pendingbox' {display = 'grid'gap = '.5rem'h2 {margin = '0'fontSize = '1.1rem'}}}View {ticketBoard {h1 { id = "heading" "Inbox" }if (loggedOut) { p { id = "loginhint" "Log in with ident (top right) to see the tickets assigned to you." } }if (loggedIn) {section { id = "reviewbox"h2 { "Review" }if (noReview) { p { id = "reviewempty" class = "empty" "Nothing is waiting for your review." } }ol { id = "review" Style.olTicketsfor (row of review) {li {ticketState { class = row.stateSlug row.state }a { Style.aSubject href = row.href ticketRef { row.ref } row.subject }ticketMeta {a { href = row.projectHref row.projectTitle }time { row.updated }}}}}}section { id = "pendingbox"h2 { "Pending" }if (noPending) { p { id = "pendingempty" class = "empty" "Nothing is pending for you." } }ol { id = "pending" Style.olTicketsfor (row of pending) {li {ticketState { class = row.stateSlug row.state }a { Style.aSubject href = row.href ticketRef { row.ref } row.subject }ticketMeta {a { href = row.projectHref row.projectTitle }time { row.updated }}}}}}}}}// a row goes to the top of its list if it is assigned to me and in that state, and out of both otherwiseplace = (row) => {p = []r = []if (row.assigneeId == myId && row.state == 'pending') { p.push(row) }if (row.assigneeId == myId && row.state == 'review') { r.push(row) }for (x of pending) { if (x.id != row.id) { p.push(x) } }for (x of review) { if (x.id != row.id) { r.push(x) } }pending = preview = rnoPending = p.length == 0noReview = r.length == 0}on client ticketCreated(row) { place(row) }on client ticketEvent(ticketId, ev, row) { place(row) }on client signedIn(tag, info) {b = emit server myInbox()if (b != null && b.pending != null) {pending = b.pendingreview = b.reviewnoPending = b.pending.length == 0noReview = b.review.length == 0myId = b.meloggedIn = trueloggedOut = false}}on client signedOut(tag) {myId = ''loggedIn = falseloggedOut = true}on server myInbox(session) {u = userOfSession(session)if (u == null) { return { error = 'log in first' } }b = inboxRows(u)return { pending = b.pending review = b.review me = u.id }}
Branches
Latest commits
- 59c02e4dMerge e30: preserve edited state note labels in Markdownmre
- 30970796Log E30 deploy GOmre
- 7c8e6d83Limit edited state note fix to Markdown renderingmre
- 910536d0Log E30 reviewmre
- 36984386Preserve state transitions when their notes are editedmre
- d75cb946Log E30 startmre
- 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