|
@@ -18,55 +18,81 @@
|
|
|
:label (if (= mode :edit) "done" "edit")
|
|
|
:on-click #(re-frame/dispatch [::events/toggle-mode (if (= mode :edit) :normal :edit)])]]])
|
|
|
|
|
|
+(defn- corner [index task]
|
|
|
+ (if (:complete? task)
|
|
|
+ [:i
|
|
|
+ {:class "zmdi zmdi-check-circle zmdi-hc-3x"
|
|
|
+ :style {:color "green"
|
|
|
+ :position "absolute"
|
|
|
+ :top "3px"
|
|
|
+ :right "5px"}}]
|
|
|
+ [:div
|
|
|
+ {:style {:position "absolute"
|
|
|
+ :top "3px"
|
|
|
+ :right "5px"
|
|
|
+ :font-size "large"}}
|
|
|
+ (inc index)]))
|
|
|
+
|
|
|
(defn- slot [index task]
|
|
|
[re-com/box
|
|
|
:width "300px"
|
|
|
:height "300px"
|
|
|
:style {:padding "10px"
|
|
|
- :border "3px solid black"
|
|
|
- :border-radius "10px"
|
|
|
- :background-color "white"}
|
|
|
+ :border-width "8px"
|
|
|
+ :border-style "solid"
|
|
|
+ :border-color (if (:complete? task) "green" "black")
|
|
|
+ :border-radius "25px"
|
|
|
+ :background-color "white"
|
|
|
+ :position "relative"
|
|
|
+ :cursor "pointer"}
|
|
|
+ :attr {:on-click #(re-frame/dispatch [::events/toggle-task-complete index])}
|
|
|
:child
|
|
|
[:div
|
|
|
- {:style {:width "100%"
|
|
|
- :height "100%"
|
|
|
- :cursor "pointer"}
|
|
|
- :on-click #(re-frame/dispatch [::events/toggle-task-complete index])}
|
|
|
- "BOX"
|
|
|
- (when (:complete? task)
|
|
|
- "COMPLETE!")]])
|
|
|
+ [corner index task]
|
|
|
+ "BOX"]])
|
|
|
|
|
|
(defn- schedule []
|
|
|
- (let [task-list (re-frame/subscribe [::subs/schedule])
|
|
|
- list-complete? (re-frame/subscribe [::subs/complete])]
|
|
|
- [re-com/scroller
|
|
|
- :v-scroll :off
|
|
|
- :h-scroll :auto
|
|
|
- :style {:padding "20px 10px"}
|
|
|
- :width "100%"
|
|
|
- :child
|
|
|
- [re-com/h-box
|
|
|
- :gap "10px"
|
|
|
- :align :center
|
|
|
- :children
|
|
|
- (concat
|
|
|
- [[re-com/box
|
|
|
- :height "150px"
|
|
|
- :width "150px"
|
|
|
- :child
|
|
|
- [:img
|
|
|
- {:src "go.png"}]]]
|
|
|
- (map-indexed
|
|
|
- (fn [index task]
|
|
|
- ^{:key (str "slot-" index)}
|
|
|
- [slot index task])
|
|
|
- @task-list)
|
|
|
- [[re-com/box
|
|
|
- :height "150px"
|
|
|
- :width "150px"
|
|
|
- :child
|
|
|
- [:img
|
|
|
- {:src (if @list-complete? "clapping.gif" "clapping.png")}]]])]]))
|
|
|
+ (let [schedule-data (re-frame/subscribe [::subs/schedule])
|
|
|
+ list-complete? (re-frame/subscribe [::subs/complete])
|
|
|
+ schedule-name (:name @schedule-data)
|
|
|
+ task-list (:tasks @schedule-data)]
|
|
|
+ [re-com/v-box
|
|
|
+ :gap "10px"
|
|
|
+ :height "100%"
|
|
|
+ :children
|
|
|
+ [(when (string? schedule-name)
|
|
|
+ [re-com/title
|
|
|
+ :label schedule-name
|
|
|
+ :level :level3])
|
|
|
+ [re-com/scroller
|
|
|
+ :v-scroll :off
|
|
|
+ :h-scroll :auto
|
|
|
+ :style {:padding "20px 10px"}
|
|
|
+ :width "100%"
|
|
|
+ :child
|
|
|
+ [re-com/h-box
|
|
|
+ :gap "10px"
|
|
|
+ :align :center
|
|
|
+ :children
|
|
|
+ (concat
|
|
|
+ [[re-com/box
|
|
|
+ :height "150px"
|
|
|
+ :width "150px"
|
|
|
+ :child
|
|
|
+ [:img
|
|
|
+ {:src "go.png"}]]]
|
|
|
+ (map-indexed
|
|
|
+ (fn [index task]
|
|
|
+ ^{:key (str "slot-" index)}
|
|
|
+ [slot index task])
|
|
|
+ task-list)
|
|
|
+ [[re-com/box
|
|
|
+ :height "150px"
|
|
|
+ :width "150px"
|
|
|
+ :child
|
|
|
+ [:img
|
|
|
+ {:src (if @list-complete? "clapping.gif" "clapping.png")}]]])]]]]))
|
|
|
+
|
|
|
|
|
|
(defn main-panel []
|
|
|
(let [mode (re-frame/subscribe [::subs/mode])]
|