|
@@ -1,5 +1,6 @@
|
|
(ns lineup.views
|
|
(ns lineup.views
|
|
(:require
|
|
(:require
|
|
|
|
+ [lineup.components.schedule :refer [schedule]]
|
|
[lineup.events :as events]
|
|
[lineup.events :as events]
|
|
[lineup.subs :as subs]
|
|
[lineup.subs :as subs]
|
|
[re-com.core :as re-com]
|
|
[re-com.core :as re-com]
|
|
@@ -7,7 +8,7 @@
|
|
|
|
|
|
(defn- top-bar [mode]
|
|
(defn- top-bar [mode]
|
|
[re-com/h-box
|
|
[re-com/h-box
|
|
- :style {:padding-right "10px"}
|
|
|
|
|
|
+ :class "top-bar"
|
|
:justify :between
|
|
:justify :between
|
|
:align :center
|
|
:align :center
|
|
:children
|
|
:children
|
|
@@ -18,87 +19,11 @@
|
|
:label (if (= mode :edit) "done" "edit")
|
|
:label (if (= mode :edit) "done" "edit")
|
|
:on-click #(re-frame/dispatch [::events/toggle-mode (if (= mode :edit) :normal :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-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
|
|
|
|
- [corner index task]
|
|
|
|
- "BOX"]])
|
|
|
|
-
|
|
|
|
-(defn- schedule []
|
|
|
|
- (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 []
|
|
(defn main-panel []
|
|
(let [mode (re-frame/subscribe [::subs/mode])]
|
|
(let [mode (re-frame/subscribe [::subs/mode])]
|
|
[re-com/v-box
|
|
[re-com/v-box
|
|
:gap "10px"
|
|
:gap "10px"
|
|
- :height "100%"
|
|
|
|
|
|
+ :height "100%"
|
|
:children
|
|
:children
|
|
[[top-bar @mode]
|
|
[[top-bar @mode]
|
|
(if (= @mode :edit)
|
|
(if (= @mode :edit)
|