Commit fdb2ee6f55290529cd2d95134844044dd149a47c
/show (fix) better editing of resolved state
mixmix committed on 9/6/2018, 3:34:19 AMParent: a7a636c30eabb0a2a8334127297b6e6261213db3
Files changed
views/show.js | changed |
views/show.js | |||
---|---|---|---|
@@ -93,17 +93,19 @@ | |||
93 | 93 … | }) | |
94 | 94 … | } | |
95 | 95 … | ||
96 | 96 … | 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 | ||
98 | 99 … | const style = { | |
99 | 100 … | display: 'grid', | |
100 | 101 … | 'grid-template-columns': `minmax(10rem, auto) repeat(${times.length}, 4rem)` | |
101 | 102 … | } | |
102 | 103 … | ||
103 | 104 … | 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' | ||
106 | 108 … | } | |
107 | 109 … | ||
108 | 110 … | return [ | |
109 | 111 … | h('ScryShowResults', { style }, [ | |
@@ -260,8 +262,9 @@ | |||
260 | 262 … | var resolution = Array(times.length).fill(null) | |
261 | 263 … | if (doc.resolution) { | |
262 | 264 … | resolution = resolution.map((_, i) => doc.resolution.choices.includes(i)) | |
263 | 265 … | } | |
266 … | + var nextResolution = resolution.map(el => el || false) | ||
264 | 267 … | ||
265 | 268 … | var isEditing = false | |
266 | 269 … | if (!myRow && !validResolution(resolution)) { | |
267 | 270 … | rows.push({ author: myFeedId, position: myPosition }) | |
@@ -277,9 +280,9 @@ | |||
277 | 280 … | resolution | |
278 | 281 … | }) | |
279 | 282 … | state.next.set({ | |
280 | 283 … | position: Array.from(myPosition), | |
281 | - resolution: Array.from(resolution) | ||
284 … | + resolution: nextResolution | ||
282 | 285 … | }) | |
283 | 286 … | state.mode.set({ | |
284 | 287 … | isEditing, | |
285 | 288 … | isPublishing: false, |
Built with git-ssb-web