git ssb

0+

mixmix / patchbay-scry



Commit fdb2ee6f55290529cd2d95134844044dd149a47c

/show (fix) better editing of resolved state

mixmix committed on 9/6/2018, 3:34:19 AM
Parent: a7a636c30eabb0a2a8334127297b6e6261213db3

Files changed

views/show.jschanged
views/show.jsView
@@ -93,17 +93,19 @@
9393 })
9494 }
9595
9696 function ScryShowResults () {
97- return computed(state.current, ({ title, closesAt, times, rows, resolution }) => {
97 + return computed([state.current, state.next.resolution, state.mode], (current, nextResolution, { isResolving }) => {
98 + const { times, rows, resolution } = current
9899 const style = {
99100 display: 'grid',
100101 'grid-template-columns': `minmax(10rem, auto) repeat(${times.length}, 4rem)`
101102 }
102103
103104 const getChosenClass = i => {
104- if (!validResolution(resolution)) return ''
105- return resolution[i] ? '-chosen' : '-not-chosen'
105 + const relevant = isResolving ? nextResolution : resolution
106 + if (!validResolution(relevant)) return ''
107 + return relevant[i] ? '-chosen' : '-not-chosen'
106108 }
107109
108110 return [
109111 h('ScryShowResults', { style }, [
@@ -260,8 +262,9 @@
260262 var resolution = Array(times.length).fill(null)
261263 if (doc.resolution) {
262264 resolution = resolution.map((_, i) => doc.resolution.choices.includes(i))
263265 }
266 + var nextResolution = resolution.map(el => el || false)
264267
265268 var isEditing = false
266269 if (!myRow && !validResolution(resolution)) {
267270 rows.push({ author: myFeedId, position: myPosition })
@@ -277,9 +280,9 @@
277280 resolution
278281 })
279282 state.next.set({
280283 position: Array.from(myPosition),
281- resolution: Array.from(resolution)
284 + resolution: nextResolution
282285 })
283286 state.mode.set({
284287 isEditing,
285288 isPublishing: false,

Built with git-ssb-web