mirror of
https://github.com/penpot/penpot.git
synced 2025-01-06 14:50:20 -05:00
Implement pagesbar toggle.
This commit is contained in:
parent
9e0edbc082
commit
ede2d4becd
5 changed files with 42 additions and 12 deletions
|
@ -124,9 +124,10 @@
|
|||
(reify
|
||||
rs/UpdateEvent
|
||||
(-apply-update [_ state]
|
||||
(assoc state :workspace {:project projectid
|
||||
:page pageid
|
||||
:toolboxes {}}))
|
||||
(let [s {:project projectid
|
||||
:page pageid
|
||||
:toolboxes {}}]
|
||||
(update state :workspace merge s)))
|
||||
|
||||
IPrintWithWriter
|
||||
(-pr-writer [mv writer _]
|
||||
|
|
25
frontend/uxbox/data/workspace.cljs
Normal file
25
frontend/uxbox/data/workspace.cljs
Normal file
|
@ -0,0 +1,25 @@
|
|||
(ns uxbox.data.workspace
|
||||
(:require [uxbox.rstore :as rs]
|
||||
[uxbox.router :as r]
|
||||
[uxbox.state :as st]
|
||||
[uxbox.schema :as sc]
|
||||
[uxbox.time :as time]
|
||||
[bouncer.validators :as v]))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Events
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defn toggle-pagesbar
|
||||
[]
|
||||
(reify
|
||||
rs/UpdateEvent
|
||||
(-apply-update [_ state]
|
||||
(println "KAKAKA" (get-in state [:workspace :visible-pagebar]))
|
||||
(update-in state [:workspace :visible-pagebar] (fnil not false)))
|
||||
|
||||
IPrintWithWriter
|
||||
(-pr-writer [mv writer _]
|
||||
(-write writer "#<event:u.s.p/toggle-pagebar>"))))
|
||||
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
(rs/init {:user {:fullname "Cirilla"
|
||||
:avatar "http://lorempixel.com/50/50/"}
|
||||
:dashboard {:section :dashboard/projects}
|
||||
:workspace {}
|
||||
:projects-by-id {}
|
||||
:pages-by-id {}}))
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
[uxbox.rstore :as rs]
|
||||
[uxbox.state :as s]
|
||||
[uxbox.data.projects :as dp]
|
||||
[uxbox.data.workspace :as dw]
|
||||
[uxbox.ui.icons.dashboard :as icons]
|
||||
[uxbox.ui.icons :as i]
|
||||
[uxbox.ui.lightbox :as lightbox]
|
||||
|
@ -29,6 +30,10 @@
|
|||
(dp/project-pages % pid))) $
|
||||
(l/focus-atom $ s/state)))
|
||||
|
||||
(def ^:static workspace-state
|
||||
(as-> (l/in [:workspace]) $
|
||||
(l/focus-atom $ s/state)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Header
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
@ -45,13 +50,14 @@
|
|||
|
||||
(defn header-render
|
||||
[own]
|
||||
(let [page (rum/react page-state)]
|
||||
(let [page (rum/react page-state)
|
||||
toggle #(rs/emit! (dw/toggle-pagesbar))]
|
||||
(html
|
||||
[:header#workspace-bar.workspace-bar
|
||||
[:div.main-icon
|
||||
(nav/link (r/route-for :dashboard/projects) i/logo-icon)]
|
||||
[:div.project-tree-btn
|
||||
{:on-click (constantly nil)}
|
||||
{:on-click toggle}
|
||||
i/project-tree
|
||||
[:span (:name page)]]
|
||||
[:div.workspace-options
|
||||
|
@ -145,7 +151,6 @@
|
|||
|
||||
(defn- project-sidebar-pageitem-render
|
||||
[own parent page numpages]
|
||||
(println "pageitem-render" (:id page))
|
||||
(letfn [(on-edit [e]
|
||||
(let [data {:edit true :form page}]
|
||||
(reset! parent data)))]
|
||||
|
@ -228,8 +233,7 @@
|
|||
:type "text"
|
||||
:value (get-in @parent [:form :name] "")
|
||||
:on-change on-change
|
||||
:on-key-up on-key-up
|
||||
}]
|
||||
:on-key-up on-key-up}]
|
||||
[:button.btn-primary.btn-small
|
||||
{:disabled (str/empty? (str/trim (get-in @parent [:form :name] "")))
|
||||
:on-click on-save}
|
||||
|
@ -247,11 +251,11 @@
|
|||
(defn project-sidebar-render
|
||||
[own]
|
||||
(let [local (:rum/local own)
|
||||
page (rum/react page-state)
|
||||
workspace (rum/react workspace-state)
|
||||
project (rum/react project-state)]
|
||||
(html
|
||||
[:div#project-bar.project-bar
|
||||
(when-not (:visible project true)
|
||||
(when-not (:visible-pagebar workspace false)
|
||||
{:class "toggle"})
|
||||
(if (:edit @local)
|
||||
(project-sidebar-form local)
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
:common
|
||||
{:dependencies [[org.clojure/clojure "1.7.0"]
|
||||
[funcool/cats "1.2.0"]]}
|
||||
[funcool/cats "1.2.1"]]}
|
||||
|
||||
;; Backend profile
|
||||
|
||||
|
@ -44,7 +44,6 @@
|
|||
[bouncer "0.3.3"]
|
||||
[funcool/promesa "0.6.0"]
|
||||
[funcool/beicon "0.3.0"]
|
||||
[funcool/cats "1.2.0"]
|
||||
[cljsjs/moment "2.10.6-0"]
|
||||
[figwheel-sidecar "0.5.0-2" :scope "test"]
|
||||
[bidi "1.21.0"]
|
||||
|
|
Loading…
Reference in a new issue