git ssb

0+

mixmix / patchbay-scry



Commit edcc95e36db325ce7977d1fe7522bf3633615898

add participants count

mixmix committed on 9/4/2018, 11:14:25 AM
Parent: 6071577daff8cc01e7241b5799fb112902aec545

Files changed

views/show.jschanged
views/show.mcsschanged
views/show.jsView
@@ -64,8 +64,9 @@
6464
6565 return [
6666 h('ScryShowResults', { style }, [
6767 times.map(ScryShowTime),
68 + ScryShowSummary(rows),
6869 rows.map(ScryShowRow)
6970 ])
7071 ]
7172 })
@@ -119,8 +120,28 @@
119120 })
120121 ]
121122 }
122123
124 + function ScryShowSummary (rows) {
125 + if (!rows.length) return
126 +
127 + const participants = rows.filter(r => r.position[0] !== null).length
128 +
129 + const counts = rows[0].position.map((_, i) => {
130 + return rows.reduce((acc, row) => {
131 + if (row.position[i] === true) acc += 1
132 + return acc
133 + }, 0)
134 + })
135 + return [
136 + h('div.participants', participants === 1
137 + ? `${participants} participant`
138 + : `${participants} participants`
139 + ),
140 + counts.map(n => h('div.count', `${n}${tick()}`))
141 + ]
142 + }
143 +
123144 function fetchState () {
124145 scuttle.poll.async.get(poll.key, (err, doc) => {
125146 if (err) return console.error(err)
126147
views/show.mcssView
@@ -87,8 +87,18 @@
8787 cursor: pointer
8888 width: 20px
8989 }
9090 }
91 +
92 + div.participants {
93 + color: hsla(0, 0%, 50%, 1)
94 + font-weight: 600
95 + }
96 + div.count {
97 + color: hsla(0, 0%, 50%, 1)
98 + font-weight: 600
99 + text-align: center
100 + }
91101 }
92102
93103 ScryShowTime {
94104 display: grid

Built with git-ssb-web