diff --git a/frontend/uxbox/data/projects.cljs b/frontend/uxbox/data/projects.cljs index b38e474e9..807ae211c 100644 --- a/frontend/uxbox/data/projects.cljs +++ b/frontend/uxbox/data/projects.cljs @@ -125,6 +125,7 @@ rs/UpdateEvent (-apply-update [_ state] (let [s {:project projectid + :toolboxes #{} :page pageid}] (update state :workspace merge s))) diff --git a/frontend/uxbox/data/workspace.cljs b/frontend/uxbox/data/workspace.cljs index def5bf42d..7a5eda2c9 100644 --- a/frontend/uxbox/data/workspace.cljs +++ b/frontend/uxbox/data/workspace.cljs @@ -21,3 +21,21 @@ IPrintWithWriter (-pr-writer [mv writer _] (-write writer "#")))) + +(defn toggle-toolbox + [toolname] + (reify + rs/UpdateEvent + (-apply-update [_ state] + (let [key (keyword (str (name toolname) "-enabled")) + val (get-in state [:workspace key] false) + state (assoc-in state [:workspace key] (not val))] + (if val + (update-in state [:workspace :toolboxes] disj toolname) + (update-in state [:workspace :toolboxes] conj toolname)))) + + IPrintWithWriter + (-pr-writer [mv writer _] + (-write writer "#")))) + + diff --git a/frontend/uxbox/ui/workspace.cljs b/frontend/uxbox/ui/workspace.cljs index 382615790..9561f5764 100644 --- a/frontend/uxbox/ui/workspace.cljs +++ b/frontend/uxbox/ui/workspace.cljs @@ -37,10 +37,9 @@ ;; Canvas (workarea) - ;; (working-area conn @open-toolboxes page project shapes (rum/react ws/zoom) (rum/react ws/grid?)) - ;; ;; Aside - ;; (when-not (empty? @open-toolboxes) - ;; (aside conn open-toolboxes page shapes)) + + ;; Aside + ;; (wa/aside) ]]])) (defn workspace-will-mount diff --git a/frontend/uxbox/ui/workspace/workarea.cljs b/frontend/uxbox/ui/workspace/workarea.cljs index 189cda99d..33e3cc78c 100644 --- a/frontend/uxbox/ui/workspace/workarea.cljs +++ b/frontend/uxbox/ui/workspace/workarea.cljs @@ -207,30 +207,58 @@ :name "viewport" :mixins [rum/reactive]})) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Aside +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defn aside-render + [own] + (let [workspace (rum/react wb/workspace-state)] + [:aside#settings-bar.settings-bar + [:div.settings-bar-inside + [:p "foo bar"] + #_(when (:tools open-setting-boxes) + (tools open-toolboxes)) + + #_(when (:icons open-setting-boxes) + (icon-sets open-toolboxes)) + + #_(when (:components open-setting-boxes) + (components open-toolboxes components)) + + #_(when (:layers open-setting-boxes) + (layers conn open-toolboxes page shapes))]])) + +(def aside + (util/component + {:render aside-render + :name "aside" + :mixins [rum/reactive]})) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Work Area ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defn working-area-render [own] - (html - [:section.workspace-canvas - {:class "no-tool-bar"} - #_{:class (when (empty? open-setting-boxes) - "no-tool-bar") - :on-scroll (constantly nil)} - #_(when (:selected page) - (element-options conn - page-cursor - project-cursor - zoom-cursor - shapes-cursor)) - (coordinates) - (viewport)])) + (let [workspace (rum/react wb/workspace-state)] + (html + [:section.workspace-canvas + {:class (when (empty? (:toolboxes workspace)) "no-tool-bar") + :on-scroll (constantly nil)} + + #_(when (:selected page) + (element-options conn + page-cursor + project-cursor + zoom-cursor + shapes-cursor)) + (coordinates) + (viewport)]))) (def workarea (util/component {:render working-area-render :name "workarea" - :mixins []})) + :mixins [rum/reactive]}))