git ssb

0+

mixmix / patchbay-scry



Commit a7a636c30eabb0a2a8334127297b6e6261213db3

/show : rename isPlaceholder to validResolution

mixmix committed on 9/6/2018, 3:21:16 AM
Parent: 0c597cad0564250a27ed9b8ade8b078dd52713b3

Files changed

views/show.jschanged
views/show.jsView
@@ -76,9 +76,9 @@
7676 })
7777 }
7878
7979 return computed([state.current, state.next, state.mode], (current, next, mode) => {
80- if (!isPlaceholder(current.resolution)) return
80 + if (validResolution(current.resolution)) return
8181 if (!mode.isEditing) return
8282 if (mode.isPublishing) return h('button', h('i.fa.fa-spin.fa-pulse'))
8383 if (mode.isResolving) return
8484
@@ -100,9 +100,9 @@
100100 'grid-template-columns': `minmax(10rem, auto) repeat(${times.length}, 4rem)`
101101 }
102102
103103 const getChosenClass = i => {
104- if (isPlaceholder(resolution)) return ''
104 + if (!validResolution(resolution)) return ''
105105 return resolution[i] ? '-chosen' : '-not-chosen'
106106 }
107107
108108 return [
@@ -174,9 +174,9 @@
174174 }
175175
176176 function ScryShowResolution (times, resolution) {
177177 return computed([state.mode.isResolving, state.next.resolution], (isResolving, nextResolution) => {
178- if (!isPlaceholder(resolution)) {
178 + if (!isResolving && validResolution(resolution)) {
179179 return times.map((_, i) => {
180180 const style = { 'grid-column': i + 2 } // grid-columns start at 1 D:
181181 const isChoice = Boolean(resolution[i])
182182 const className = isChoice ? '-chosen' : ''
@@ -262,9 +262,9 @@
262262 resolution = resolution.map((_, i) => doc.resolution.choices.includes(i))
263263 }
264264
265265 var isEditing = false
266- if (!myRow && isPlaceholder(resolution)) {
266 + if (!myRow && !validResolution(resolution)) {
267267 rows.push({ author: myFeedId, position: myPosition })
268268 isEditing = true
269269 }
270270
@@ -328,18 +328,19 @@
328328 })
329329 }
330330 }
331331
332-function isPlaceholder (arr) {
333- return arr.every(el => el === null)
332 +function validResolution (arr) {
333 + // valid as in not a dummy resolution that's a placeholder
334 + return arr.every(el => el !== null)
334335 }
335336
336337 // component
337338
338339 function ScryShowClosesAt ({ closesAt, resolution }) {
339340 return h('div.closes-at', computed([closesAt, resolution], (t, resolution) => {
340341 if (!t) return
341- if (!isPlaceholder(resolution)) return
342 + if (validResolution(resolution)) return
342343
343344 const distance = t - new Date()
344345 if (distance < 0) return 'This scry has closed, but a resolution has yet to be declared.'
345346

Built with git-ssb-web