Skip to content

Commit 9b5ba7e

Browse files
committed
The voting component is hidden once user gives the initial vote. (Will be shown if the page is reloaded though)
1 parent 1125bc8 commit 9b5ba7e

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/cljs/cloodle/client.cljs

+9-5
Original file line numberDiff line numberDiff line change
@@ -332,14 +332,17 @@
332332

333333
(if-let [saved-participant (if (= status 200) (:body response))]
334334

335-
(om/transact! app-state :participants #(conj % saved-participant)))))
335+
(do
336+
(om/transact! app-state :participants #(conj % saved-participant))
337+
(om/transact! app-state :vote-saved-this-session (fn [_] true))))))
336338

337339
(recur))))))
338340

339341

340342
(render-state [this state]
341343

342-
(ddom/div {:className "vote-component"}
344+
(ddom/div {:className "vote-component"
345+
:style (display (not (:vote-saved-this-session app-state)))}
343346
(ddom/h2 "Vote on the options")
344347
(ddom/p "Use the sliders to express your preferences.")
345348
(ddom/div {:className "row form-group"}
@@ -454,14 +457,14 @@
454457

455458
(defn get-existing-event[cloodle-code output-channel]
456459
(go
457-
(let [response (<! (http/get (str "api/event/" cloodle-code)))
458-
status (:status response)]
460+
(let [response (<! (http/get (str "api/event/" cloodle-code)))]
459461
(print (str "GOT FROM SERVER " (:body response)))
460462
(let [event (:body response)
461463

462464
new-event (merge event {:new-participant { :name ""
463465
:selections {}
464466
}
467+
:vote-saved-this-session false
465468
})]
466469

467470
(put! output-channel new-event)))))
@@ -487,7 +490,8 @@
487490
{:name "Conan The Barbarian"}
488491
{:name "Junior"}]
489492
:participants []
490-
:cloodle-code ""}]
493+
:cloodle-code ""
494+
:vote-saved-this-session false}]
491495
(put! state-destination new-event-state))))))
492496

493497

0 commit comments

Comments
 (0)