mirror of
https://github.com/penpot/penpot.git
synced 2025-08-07 14:38:33 +02:00
Update naming of lenses around all the project.
This commit is contained in:
parent
851eff897e
commit
537dfa241d
15 changed files with 40 additions and 40 deletions
|
@ -12,7 +12,7 @@
|
||||||
[uxbox.ui.users :as ui.u]
|
[uxbox.ui.users :as ui.u]
|
||||||
[uxbox.ui.util :as util]))
|
[uxbox.ui.util :as util]))
|
||||||
|
|
||||||
(def ^:static header-state
|
(def ^:static header-l
|
||||||
(as-> (l/in [:dashboard]) $
|
(as-> (l/in [:dashboard]) $
|
||||||
(l/focus-atom $ s/state)))
|
(l/focus-atom $ s/state)))
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
(defn header-render
|
(defn header-render
|
||||||
[own]
|
[own]
|
||||||
(let [local (rum/react header-state)
|
(let [local (rum/react header-l)
|
||||||
projects? (= (:section local) :dashboard/projects)
|
projects? (= (:section local) :dashboard/projects)
|
||||||
elements? (= (:section local) :dashboard/elements)
|
elements? (= (:section local) :dashboard/elements)
|
||||||
icons? (= (:section local) :dashboard/icons)
|
icons? (= (:section local) :dashboard/icons)
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
;; Lenses
|
;; Lenses
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(def ^:static dashboard-state
|
(def ^:static dashboard-l
|
||||||
(as-> (l/in [:dashboard]) $
|
(as-> (l/in [:dashboard]) $
|
||||||
(l/focus-atom $ st/state)))
|
(l/focus-atom $ st/state)))
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
(defn page-title-render
|
(defn page-title-render
|
||||||
[own coll]
|
[own coll]
|
||||||
(let [dashboard (rum/react dashboard-state)
|
(let [dashboard (rum/react dashboard-l)
|
||||||
own? (:builtin coll false)]
|
own? (:builtin coll false)]
|
||||||
(html
|
(html
|
||||||
[:div.dashboard-title {}
|
[:div.dashboard-title {}
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
|
|
||||||
(defn nav-render
|
(defn nav-render
|
||||||
[own]
|
[own]
|
||||||
(let [dashboard (rum/react dashboard-state)
|
(let [dashboard (rum/react dashboard-l)
|
||||||
collid (:collection-id dashboard)
|
collid (:collection-id dashboard)
|
||||||
own? (= (:collection-type dashboard) :own)
|
own? (= (:collection-type dashboard) :own)
|
||||||
builtin? (= (:collection-type dashboard) :builtin)
|
builtin? (= (:collection-type dashboard) :builtin)
|
||||||
|
@ -100,14 +100,14 @@
|
||||||
|
|
||||||
(defn grid-render
|
(defn grid-render
|
||||||
[own]
|
[own]
|
||||||
(let [dashboard (rum/react dashboard-state)
|
(let [dashboard (rum/react dashboard-l)
|
||||||
coll-type (:collection-type dashboard)
|
coll-type (:collection-type dashboard)
|
||||||
coll-id (:collection-id dashboard)
|
coll-id (:collection-id dashboard)
|
||||||
own? (= coll-type :own)
|
own? (= coll-type :own)
|
||||||
coll (get library/+icon-collections-by-id+ coll-id)]
|
coll (get library/+icon-collections-by-id+ coll-id)]
|
||||||
;; coll (case coll-type
|
;; coll (case coll-type
|
||||||
;; :builtin (get library/+color-collections-by-id+ coll-id)
|
;; :builtin (get library/+color-collections-by-id+ coll-id)
|
||||||
;; :own (rum/react collection-state))]
|
;; :own (rum/react collection-l))]
|
||||||
;; edit-cb #(lightbox/open! :icon-form {:coll coll :icon %})
|
;; edit-cb #(lightbox/open! :icon-form {:coll coll :icon %})
|
||||||
;; remove-cb #(rs/emit! (dd/remove-icon {:id (:id coll) :icon %}))]
|
;; remove-cb #(rs/emit! (dd/remove-icon {:id (:id coll) :icon %}))]
|
||||||
;; (println "KAKAKKA" coll-type coll-id coll)
|
;; (println "KAKAKKA" coll-type coll-id coll)
|
||||||
|
|
|
@ -149,7 +149,7 @@
|
||||||
;; Menu
|
;; Menu
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
;; (def ^:static menu-state
|
;; (def ^:static menu-l
|
||||||
;; (as-> (l/select-keys [:projects]) $
|
;; (as-> (l/select-keys [:projects]) $
|
||||||
;; (l/focus-atom $ s/state)))
|
;; (l/focus-atom $ s/state)))
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@
|
||||||
|
|
||||||
(defn menu-render
|
(defn menu-render
|
||||||
[]
|
[]
|
||||||
(let [state {:projects []} #_(rum/react menu-state)
|
(let [state {:projects []} #_(rum/react menu-l)
|
||||||
pcount (count (:projects state))]
|
pcount (count (:projects state))]
|
||||||
(html
|
(html
|
||||||
[:section#dashboard-bar.dashboard-bar
|
[:section#dashboard-bar.dashboard-bar
|
||||||
|
@ -226,7 +226,7 @@
|
||||||
;; Grid
|
;; Grid
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(def ^:static grid-state
|
(def ^:static grid-l
|
||||||
(as-> (l/select-keys [:projects-by-id]) $
|
(as-> (l/select-keys [:projects-by-id]) $
|
||||||
(l/focus-atom $ s/state)))
|
(l/focus-atom $ s/state)))
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@
|
||||||
(letfn [(on-click [e]
|
(letfn [(on-click [e]
|
||||||
(dom/prevent-default e)
|
(dom/prevent-default e)
|
||||||
(lightbox/open! :new-project))]
|
(lightbox/open! :new-project))]
|
||||||
(let [state (rum/react grid-state)]
|
(let [state (rum/react grid-l)]
|
||||||
(html
|
(html
|
||||||
[:section.dashboard-grid
|
[:section.dashboard-grid
|
||||||
[:h2 "Your projects"]
|
[:h2 "Your projects"]
|
||||||
|
|
|
@ -48,13 +48,13 @@
|
||||||
:user/avatar "http://lorempixel.com/50/50/"}))
|
:user/avatar "http://lorempixel.com/50/50/"}))
|
||||||
(def menu-open? (atom false))
|
(def menu-open? (atom false))
|
||||||
|
|
||||||
(def ^:static user-state
|
(def ^:static user-l
|
||||||
(as-> (l/in [:user]) $
|
(as-> (l/in [:user]) $
|
||||||
(l/focus-atom $ s/state)))
|
(l/focus-atom $ s/state)))
|
||||||
|
|
||||||
(defn user-render
|
(defn user-render
|
||||||
[own]
|
[own]
|
||||||
(let [user (rum/react user-state)
|
(let [user (rum/react user-l)
|
||||||
local (:rum/local own)]
|
local (:rum/local own)]
|
||||||
(html
|
(html
|
||||||
[:div.user-zone {:on-mouse-enter #(swap! local assoc :open true)
|
[:div.user-zone {:on-mouse-enter #(swap! local assoc :open true)
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
|
|
||||||
(defn- workspace-render
|
(defn- workspace-render
|
||||||
[own projectid]
|
[own projectid]
|
||||||
(let [workspace (rum/react wb/workspace-state)
|
(let [workspace (rum/react wb/workspace-l)
|
||||||
no-toolbars? (empty? (:toolboxes workspace))]
|
no-toolbars? (empty? (:toolboxes workspace))]
|
||||||
(html
|
(html
|
||||||
[:div
|
[:div
|
||||||
|
|
|
@ -15,28 +15,28 @@
|
||||||
;; Lenses
|
;; Lenses
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(def ^:static project-state
|
(def ^:static project-l
|
||||||
(as-> (ul/dep-in [:projects-by-id] [:workspace :project]) $
|
(as-> (ul/dep-in [:projects-by-id] [:workspace :project]) $
|
||||||
(l/focus-atom $ st/state)))
|
(l/focus-atom $ st/state)))
|
||||||
|
|
||||||
(def ^:static page-state
|
(def ^:static page-l
|
||||||
(as-> (ul/dep-in [:pages-by-id] [:workspace :page]) $
|
(as-> (ul/dep-in [:pages-by-id] [:workspace :page]) $
|
||||||
(l/focus-atom $ st/state)))
|
(l/focus-atom $ st/state)))
|
||||||
|
|
||||||
(def ^:static pages-state
|
(def ^:static pages-l
|
||||||
(as-> (ul/getter #(let [pid (get-in % [:workspace :project])]
|
(as-> (ul/getter #(let [pid (get-in % [:workspace :project])]
|
||||||
(dp/project-pages % pid))) $
|
(dp/project-pages % pid))) $
|
||||||
(l/focus-atom $ st/state)))
|
(l/focus-atom $ st/state)))
|
||||||
|
|
||||||
(def ^:static workspace-state
|
(def ^:static workspace-l
|
||||||
(as-> (l/in [:workspace]) $
|
(as-> (l/in [:workspace]) $
|
||||||
(l/focus-atom $ st/state)))
|
(l/focus-atom $ st/state)))
|
||||||
|
|
||||||
(def ^:static active-toolboxes-state
|
(def ^:static toolboxes-l
|
||||||
(as-> (l/in [:workspace :toolboxes]) $
|
(as-> (l/in [:workspace :toolboxes]) $
|
||||||
(l/focus-atom $ st/state)))
|
(l/focus-atom $ st/state)))
|
||||||
|
|
||||||
(def ^:static flags-state
|
(def ^:static flags-l
|
||||||
(as-> (l/in [:workspace :flags]) $
|
(as-> (l/in [:workspace :flags]) $
|
||||||
(l/focus-atom $ st/state)))
|
(l/focus-atom $ st/state)))
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@
|
||||||
(defonce mouse-b (rx/bus))
|
(defonce mouse-b (rx/bus))
|
||||||
(defonce mouse-s
|
(defonce mouse-s
|
||||||
(->> mouse-b
|
(->> mouse-b
|
||||||
(rx/filter #(= (:id %) (:id @page-state)))
|
(rx/filter #(= (:id %) (:id @page-l)))
|
||||||
(rx/map :coords)))
|
(rx/map :coords)))
|
||||||
|
|
||||||
;; Deltas
|
;; Deltas
|
||||||
|
|
|
@ -211,7 +211,7 @@
|
||||||
|
|
||||||
(defn- canvas-render
|
(defn- canvas-render
|
||||||
[own {:keys [width height id] :as page}]
|
[own {:keys [width height id] :as page}]
|
||||||
(let [workspace (rum/react wb/workspace-state)
|
(let [workspace (rum/react wb/workspace-l)
|
||||||
shapes-by-id (rum/react shapes-by-id)
|
shapes-by-id (rum/react shapes-by-id)
|
||||||
workspace-selected (:selected workspace)
|
workspace-selected (:selected workspace)
|
||||||
shapes (map #(get shapes-by-id %) (:shapes page))
|
shapes (map #(get shapes-by-id %) (:shapes page))
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
(defn- colorpalette-render
|
(defn- colorpalette-render
|
||||||
[own]
|
[own]
|
||||||
(let [local (:rum/local own)
|
(let [local (:rum/local own)
|
||||||
flags (rum/react wb/flags-state)
|
flags (rum/react wb/flags-l)
|
||||||
collections-by-id (rum/react collections-by-id-l)
|
collections-by-id (rum/react collections-by-id-l)
|
||||||
collections (vals collections-by-id)
|
collections (vals collections-by-id)
|
||||||
collection (if-let [collid (:selected @local)]
|
collection (if-let [collid (:selected @local)]
|
||||||
|
|
|
@ -56,8 +56,8 @@
|
||||||
(let [padding (* 0 zoom)
|
(let [padding (* 0 zoom)
|
||||||
ticks-mod (/ 100 zoom)
|
ticks-mod (/ 100 zoom)
|
||||||
step-size (/ 10 zoom)
|
step-size (/ 10 zoom)
|
||||||
flags (rum/react wb/flags-state)
|
flags (rum/react wb/flags-l)
|
||||||
page (rum/react wb/page-state)
|
page (rum/react wb/page-l)
|
||||||
enabled? (contains? flags :workspace/grid)
|
enabled? (contains? flags :workspace/grid)
|
||||||
vertical-ticks (range (- 0 wb/document-start-y)
|
vertical-ticks (range (- 0 wb/document-start-y)
|
||||||
(- (:width page) wb/document-start-y)
|
(- (:width page) wb/document-start-y)
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
|
|
||||||
(defn header-render
|
(defn header-render
|
||||||
[own]
|
[own]
|
||||||
(let [page (rum/react wb/page-state)
|
(let [page (rum/react wb/page-l)
|
||||||
flags (rum/react wb/flags-state)
|
flags (rum/react wb/flags-l)
|
||||||
toggle #(rs/emit! (dw/toggle-tool %))]
|
toggle #(rs/emit! (dw/toggle-tool %))]
|
||||||
(html
|
(html
|
||||||
[:header#workspace-bar.workspace-bar
|
[:header#workspace-bar.workspace-bar
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
(defn lateralmenu-render
|
(defn lateralmenu-render
|
||||||
[own]
|
[own]
|
||||||
(let [toolboxes (rum/react wb/active-toolboxes-state)
|
(let [toolboxes (rum/react wb/toolboxes-l)
|
||||||
toggle #(rs/emit! (dw/toggle-toolbox %))]
|
toggle #(rs/emit! (dw/toggle-toolbox %))]
|
||||||
(html
|
(html
|
||||||
[:div#tool-bar.tool-bar
|
[:div#tool-bar.tool-bar
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
(let [data {:edit true :form page}]
|
(let [data {:edit true :form page}]
|
||||||
(reset! parent data)))]
|
(reset! parent data)))]
|
||||||
|
|
||||||
(let [curpage (rum/react wb/page-state)
|
(let [curpage (rum/react wb/page-l)
|
||||||
active? (= (:id curpage) (:id page))
|
active? (= (:id curpage) (:id page))
|
||||||
deletable? (> numpages 1)
|
deletable? (> numpages 1)
|
||||||
navigate #(rs/emit! (dp/go-to (:project page) (:id page)))
|
navigate #(rs/emit! (dp/go-to (:project page) (:id page)))
|
||||||
|
@ -44,8 +44,8 @@
|
||||||
|
|
||||||
(defn- page-list-render
|
(defn- page-list-render
|
||||||
[own parent]
|
[own parent]
|
||||||
(let [project (rum/react wb/project-state)
|
(let [project (rum/react wb/project-l)
|
||||||
pages (rum/react wb/pages-state)
|
pages (rum/react wb/pages-l)
|
||||||
name (:name project)]
|
name (:name project)]
|
||||||
(html
|
(html
|
||||||
[:div.project-bar-inside
|
[:div.project-bar-inside
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
(defn- page-form-render
|
(defn- page-form-render
|
||||||
[own parent]
|
[own parent]
|
||||||
(let [form (:form @parent)
|
(let [form (:form @parent)
|
||||||
project @wb/project-state]
|
project @wb/project-l]
|
||||||
(letfn [(on-change [e]
|
(letfn [(on-change [e]
|
||||||
(let [value (dom/event->value e)]
|
(let [value (dom/event->value e)]
|
||||||
(swap! parent assoc-in [:form :name] value)))
|
(swap! parent assoc-in [:form :name] value)))
|
||||||
|
@ -116,8 +116,8 @@
|
||||||
(defn pagesmngr-render
|
(defn pagesmngr-render
|
||||||
[own]
|
[own]
|
||||||
(let [local (:rum/local own)
|
(let [local (:rum/local own)
|
||||||
flags (rum/react wb/flags-state)
|
flags (rum/react wb/flags-l)
|
||||||
project (rum/react wb/project-state)]
|
project (rum/react wb/project-l)]
|
||||||
(html
|
(html
|
||||||
[:div#project-bar.project-bar
|
[:div#project-bar.project-bar
|
||||||
(when-not (contains? flags :workspace/pagesmngr)
|
(when-not (contains? flags :workspace/pagesmngr)
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
(defn aside-render
|
(defn aside-render
|
||||||
[own]
|
[own]
|
||||||
(println "aside-render")
|
(println "aside-render")
|
||||||
(let [toolboxes (rum/react wb/active-toolboxes-state)]
|
(let [toolboxes (rum/react wb/toolboxes-l)]
|
||||||
(html
|
(html
|
||||||
[:aside#settings-bar.settings-bar
|
[:aside#settings-bar.settings-bar
|
||||||
[:div.settings-bar-inside
|
[:div.settings-bar-inside
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
|
|
||||||
(defn draw-tools-render
|
(defn draw-tools-render
|
||||||
[open-toolboxes]
|
[open-toolboxes]
|
||||||
(let [workspace (rum/react wb/workspace-state)
|
(let [workspace (rum/react wb/workspace-l)
|
||||||
close #(rs/emit! (dw/toggle-toolbox :draw))
|
close #(rs/emit! (dw/toggle-toolbox :draw))
|
||||||
tools (->> (into [] +draw-tools+)
|
tools (->> (into [] +draw-tools+)
|
||||||
(sort-by (comp :priority second)))]
|
(sort-by (comp :priority second)))]
|
||||||
|
@ -109,7 +109,7 @@
|
||||||
|
|
||||||
(defn layers-render
|
(defn layers-render
|
||||||
[own]
|
[own]
|
||||||
(let [workspace (rum/react wb/workspace-state)
|
(let [workspace (rum/react wb/workspace-l)
|
||||||
selected (:selected workspace)
|
selected (:selected workspace)
|
||||||
shapes-by-id (rum/react shapes-by-id)
|
shapes-by-id (rum/react shapes-by-id)
|
||||||
page (rum/react (focus-page (:page workspace)))
|
page (rum/react (focus-page (:page workspace)))
|
||||||
|
@ -182,7 +182,7 @@
|
||||||
|
|
||||||
(defn- select-icon
|
(defn- select-icon
|
||||||
[icon]
|
[icon]
|
||||||
(if (= (:drawing @wb/workspace-state) icon)
|
(if (= (:drawing @wb/workspace-l) icon)
|
||||||
(rs/emit! (dw/select-for-drawing nil))
|
(rs/emit! (dw/select-for-drawing nil))
|
||||||
(rs/emit! (dw/select-for-drawing icon))))
|
(rs/emit! (dw/select-for-drawing icon))))
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
|
|
||||||
(defn viewport-render
|
(defn viewport-render
|
||||||
[own]
|
[own]
|
||||||
(let [workspace (rum/react wb/workspace-state)
|
(let [workspace (rum/react wb/workspace-l)
|
||||||
page (rum/react wb/page-state)
|
page (rum/react wb/page-l)
|
||||||
drawing? (:drawing workspace)
|
drawing? (:drawing workspace)
|
||||||
zoom 1]
|
zoom 1]
|
||||||
(html
|
(html
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue