Commit a7a636c30eabb0a2a8334127297b6e6261213db3
/show : rename isPlaceholder to validResolution
mixmix committed on 9/6/2018, 3:21:16 AMParent: 0c597cad0564250a27ed9b8ade8b078dd52713b3
Files changed
views/show.js | changed |
views/show.js | |||
---|---|---|---|
@@ -76,9 +76,9 @@ | |||
76 | 76 … | }) | |
77 | 77 … | } | |
78 | 78 … | ||
79 | 79 … | return computed([state.current, state.next, state.mode], (current, next, mode) => { | |
80 | - if (!isPlaceholder(current.resolution)) return | ||
80 … | + if (validResolution(current.resolution)) return | ||
81 | 81 … | if (!mode.isEditing) return | |
82 | 82 … | if (mode.isPublishing) return h('button', h('i.fa.fa-spin.fa-pulse')) | |
83 | 83 … | if (mode.isResolving) return | |
84 | 84 … | ||
@@ -100,9 +100,9 @@ | |||
100 | 100 … | 'grid-template-columns': `minmax(10rem, auto) repeat(${times.length}, 4rem)` | |
101 | 101 … | } | |
102 | 102 … | ||
103 | 103 … | const getChosenClass = i => { | |
104 | - if (isPlaceholder(resolution)) return '' | ||
104 … | + if (!validResolution(resolution)) return '' | ||
105 | 105 … | return resolution[i] ? '-chosen' : '-not-chosen' | |
106 | 106 … | } | |
107 | 107 … | ||
108 | 108 … | return [ | |
@@ -174,9 +174,9 @@ | |||
174 | 174 … | } | |
175 | 175 … | ||
176 | 176 … | function ScryShowResolution (times, resolution) { | |
177 | 177 … | return computed([state.mode.isResolving, state.next.resolution], (isResolving, nextResolution) => { | |
178 | - if (!isPlaceholder(resolution)) { | ||
178 … | + if (!isResolving && validResolution(resolution)) { | ||
179 | 179 … | return times.map((_, i) => { | |
180 | 180 … | const style = { 'grid-column': i + 2 } // grid-columns start at 1 D: | |
181 | 181 … | const isChoice = Boolean(resolution[i]) | |
182 | 182 … | const className = isChoice ? '-chosen' : '' | |
@@ -262,9 +262,9 @@ | |||
262 | 262 … | resolution = resolution.map((_, i) => doc.resolution.choices.includes(i)) | |
263 | 263 … | } | |
264 | 264 … | ||
265 | 265 … | var isEditing = false | |
266 | - if (!myRow && isPlaceholder(resolution)) { | ||
266 … | + if (!myRow && !validResolution(resolution)) { | ||
267 | 267 … | rows.push({ author: myFeedId, position: myPosition }) | |
268 | 268 … | isEditing = true | |
269 | 269 … | } | |
270 | 270 … | ||
@@ -328,18 +328,19 @@ | |||
328 | 328 … | }) | |
329 | 329 … | } | |
330 | 330 … | } | |
331 | 331 … | ||
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) | ||
334 | 335 … | } | |
335 | 336 … | ||
336 | 337 … | // component | |
337 | 338 … | ||
338 | 339 … | function ScryShowClosesAt ({ closesAt, resolution }) { | |
339 | 340 … | return h('div.closes-at', computed([closesAt, resolution], (t, resolution) => { | |
340 | 341 … | if (!t) return | |
341 | - if (!isPlaceholder(resolution)) return | ||
342 … | + if (validResolution(resolution)) return | ||
342 | 343 … | ||
343 | 344 … | const distance = t - new Date() | |
344 | 345 … | if (distance < 0) return 'This scry has closed, but a resolution has yet to be declared.' | |
345 | 346 … |
Built with git-ssb-web