mirror of
https://github.com/penpot/penpot.git
synced 2025-01-24 07:29:08 -05:00
Many other naming changes on state keys.
This commit is contained in:
parent
7b7fd7680f
commit
2a30b2737c
8 changed files with 30 additions and 30 deletions
|
@ -62,7 +62,7 @@
|
|||
(-apply-update [_ state]
|
||||
(let [{:keys [version value]} data]
|
||||
(-> state
|
||||
(update :color-collections merge value)
|
||||
(update :colors-collections merge value)
|
||||
(assoc ::version version)))))
|
||||
|
||||
(defn collections-fetched
|
||||
|
@ -97,7 +97,7 @@
|
|||
:created-at (dt/now)
|
||||
:type :own
|
||||
:colors #{}}]
|
||||
(assoc-in state [:color-collections id] item)))
|
||||
(assoc-in state [:colors-collections id] item)))
|
||||
|
||||
rs/WatchEvent
|
||||
(-apply-watch [_ state stream]
|
||||
|
@ -117,7 +117,7 @@
|
|||
(let [builtin? #(= :builtin (:type %))
|
||||
xform (remove (comp builtin? second))
|
||||
version (get state ::version)
|
||||
value (->> (get state :color-collections)
|
||||
value (->> (get state :colors-collections)
|
||||
(into {} xform))
|
||||
store {:key "color-collections"
|
||||
:version version
|
||||
|
@ -135,7 +135,7 @@
|
|||
(defrecord RenameCollection [id name]
|
||||
rs/UpdateEvent
|
||||
(-apply-update [_ state]
|
||||
(assoc-in state [:color-collections id :name] name))
|
||||
(assoc-in state [:colors-collections id :name] name))
|
||||
|
||||
rs/WatchEvent
|
||||
(-apply-watch [_ state s]
|
||||
|
@ -150,7 +150,7 @@
|
|||
(defrecord DeleteCollection [id]
|
||||
rs/UpdateEvent
|
||||
(-apply-update [_ state]
|
||||
(update state :color-collections dissoc id))
|
||||
(update state :colors-collections dissoc id))
|
||||
|
||||
rs/WatchEvent
|
||||
(-apply-watch [_ state s]
|
||||
|
@ -168,7 +168,7 @@
|
|||
rs/UpdateEvent
|
||||
(-apply-update [_ state]
|
||||
(let [replacer #(-> (disj % from) (conj to))]
|
||||
(update-in state [:color-collections id :colors] (fnil replacer #{}))))
|
||||
(update-in state [:colors-collections id :colors] (fnil replacer #{}))))
|
||||
|
||||
rs/WatchEvent
|
||||
(-apply-watch [_ state s]
|
||||
|
@ -184,7 +184,7 @@
|
|||
(defrecord RemoveColors [id colors]
|
||||
rs/UpdateEvent
|
||||
(-apply-update [_ state]
|
||||
(update-in state [:color-collections id :colors]
|
||||
(update-in state [:colors-collections id :colors]
|
||||
#(set/difference % colors)))
|
||||
|
||||
rs/WatchEvent
|
||||
|
@ -228,7 +228,7 @@
|
|||
rs/UpdateEvent
|
||||
(-apply-update [_ state]
|
||||
(let [selected (get-in state [:dashboard :colors :selected])]
|
||||
(update-in state [:color-collections id :colors] set/union selected)))
|
||||
(update-in state [:colors-collections id :colors] set/union selected)))
|
||||
|
||||
rs/WatchEvent
|
||||
(-apply-watch [_ state stream]
|
||||
|
@ -246,8 +246,8 @@
|
|||
(-apply-update [_ state]
|
||||
(let [selected (get-in state [:dashboard :colors :selected])]
|
||||
(-> state
|
||||
(update-in [:color-collections from :colors] set/difference selected)
|
||||
(update-in [:color-collections to :colors] set/union selected))))
|
||||
(update-in [:colors-collections from :colors] set/difference selected)
|
||||
(update-in [:colors-collections to :colors] set/union selected))))
|
||||
|
||||
rs/WatchEvent
|
||||
(-apply-watch [_ state stream]
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
(reduce (fn [state item]
|
||||
(let [id (:id item)
|
||||
item (assoc item :type :own)]
|
||||
(assoc-in state [:icon-collections id] item)))
|
||||
(assoc-in state [:icons-collections id] item)))
|
||||
state
|
||||
items)))
|
||||
|
||||
|
@ -90,7 +90,7 @@
|
|||
rs/UpdateEvent
|
||||
(-apply-update [_ state]
|
||||
(let [{:keys [id] :as item} (assoc item :type :own)]
|
||||
(update state :icon-collections assoc id item)))
|
||||
(update state :icons-collections assoc id item)))
|
||||
|
||||
rs/WatchEvent
|
||||
(-apply-watch [_ state stream]
|
||||
|
@ -124,7 +124,7 @@
|
|||
(defrecord CollectionUpdated [item]
|
||||
rs/UpdateEvent
|
||||
(-apply-update [_ state]
|
||||
(update-in state [:icon-collections (:id item)] merge item)))
|
||||
(update-in state [:icons-collections (:id item)] merge item)))
|
||||
|
||||
(defn collection-updated
|
||||
[item]
|
||||
|
@ -135,7 +135,7 @@
|
|||
(defrecord UpdateCollection [id]
|
||||
rs/WatchEvent
|
||||
(-apply-watch [_ state s]
|
||||
(let [item (get-in state [:icon-collections id])]
|
||||
(let [item (get-in state [:icons-collections id])]
|
||||
(->> (rp/req :update/icon-collection item)
|
||||
(rx/map :payload)
|
||||
(rx/map collection-updated)))))
|
||||
|
@ -149,7 +149,7 @@
|
|||
(defrecord RenameCollection [id name]
|
||||
rs/UpdateEvent
|
||||
(-apply-update [_ state]
|
||||
(assoc-in state [:icon-collections id :name] name))
|
||||
(assoc-in state [:icons-collections id :name] name))
|
||||
|
||||
rs/WatchEvent
|
||||
(-apply-watch [_ state s]
|
||||
|
@ -164,7 +164,7 @@
|
|||
(defrecord DeleteCollection [id]
|
||||
rs/UpdateEvent
|
||||
(-apply-update [_ state]
|
||||
(update state :icon-collections dissoc id))
|
||||
(update state :icons-collections dissoc id))
|
||||
|
||||
rs/WatchEvent
|
||||
(-apply-watch [_ state s]
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
(reduce (fn [state item]
|
||||
(let [id (:id item)
|
||||
item (assoc item :type :own)]
|
||||
(assoc-in state [:image-collections id] item)))
|
||||
(assoc-in state [:images-collections id] item)))
|
||||
state
|
||||
items)))
|
||||
|
||||
|
@ -90,7 +90,7 @@
|
|||
rs/UpdateEvent
|
||||
(-apply-update [_ state]
|
||||
(let [{:keys [id] :as item} (assoc item :type :own)]
|
||||
(update state :image-collections assoc id item)))
|
||||
(update state :images-collections assoc id item)))
|
||||
|
||||
rs/WatchEvent
|
||||
(-apply-watch [_ state stream]
|
||||
|
@ -124,7 +124,7 @@
|
|||
(defrecord CollectionUpdated [item]
|
||||
rs/UpdateEvent
|
||||
(-apply-update [_ state]
|
||||
(update-in state [:image-collections (:id item)] merge item)))
|
||||
(update-in state [:images-collections (:id item)] merge item)))
|
||||
|
||||
(defn collection-updated
|
||||
[item]
|
||||
|
@ -135,7 +135,7 @@
|
|||
(defrecord UpdateCollection [id]
|
||||
rs/WatchEvent
|
||||
(-apply-watch [_ state s]
|
||||
(let [item (get-in state [:image-collections id])]
|
||||
(let [item (get-in state [:images-collections id])]
|
||||
(->> (rp/req :update/image-collection item)
|
||||
(rx/map :payload)
|
||||
(rx/map collection-updated)))))
|
||||
|
@ -149,7 +149,7 @@
|
|||
(defrecord RenameCollection [id name]
|
||||
rs/UpdateEvent
|
||||
(-apply-update [_ state]
|
||||
(assoc-in state [:image-collections id :name] name))
|
||||
(assoc-in state [:images-collections id :name] name))
|
||||
|
||||
rs/WatchEvent
|
||||
(-apply-watch [_ state s]
|
||||
|
@ -164,7 +164,7 @@
|
|||
(defrecord DeleteCollection [id]
|
||||
rs/UpdateEvent
|
||||
(-apply-update [_ state]
|
||||
(update state :image-collections dissoc id))
|
||||
(update state :images-collections dissoc id))
|
||||
|
||||
rs/WatchEvent
|
||||
(-apply-watch [_ state s]
|
||||
|
|
|
@ -33,11 +33,11 @@
|
|||
:undo {}
|
||||
:profile nil
|
||||
:workspace nil
|
||||
:image-collections nil
|
||||
:color-collections colors/collections
|
||||
:icon-collections nil
|
||||
:images-collections nil
|
||||
:images nil
|
||||
:icons-collections nil
|
||||
:icons nil
|
||||
:colors-collections colors/collections
|
||||
:shapes nil
|
||||
:projects nil
|
||||
:pages nil})
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
(l/derive st/state)))
|
||||
|
||||
(def collections-ref
|
||||
(-> (l/key :color-collections)
|
||||
(-> (l/key :colors-collections)
|
||||
(l/derive st/state)))
|
||||
|
||||
;; --- Page Title
|
||||
|
@ -105,7 +105,7 @@
|
|||
(tr "ds.num-elements" (t/c colors))]])))
|
||||
|
||||
(def ^:private storage-num-colors-ref
|
||||
(-> (comp (l/in [:color-collections nil :colors])
|
||||
(-> (comp (l/in [:colors-collections nil :colors])
|
||||
(l/lens count))
|
||||
(l/derive st/state)))
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
(l/derive st/state)))
|
||||
|
||||
(def ^:private collections-ref
|
||||
(-> (l/key :icon-collections)
|
||||
(-> (l/key :icons-collections)
|
||||
(l/derive st/state)))
|
||||
|
||||
(def ^:private icons-ref
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
(l/derive st/state)))
|
||||
|
||||
(def ^:private collections-ref
|
||||
(-> (l/key :image-collections)
|
||||
(-> (l/key :images-collections)
|
||||
(l/derive st/state)))
|
||||
|
||||
(def ^:private images-ref
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
(l/derive st/state)))
|
||||
|
||||
(def ^:private collections-ref
|
||||
(-> (l/key :image-collections)
|
||||
(-> (l/key :images-collections)
|
||||
(l/derive st/state)))
|
||||
|
||||
(def ^:private images-ref
|
||||
|
|
Loading…
Add table
Reference in a new issue