mirror of
https://github.com/penpot/penpot.git
synced 2025-07-04 03:27:16 +02:00
Add missing fields on loaded image collections.
This commit is contained in:
parent
6c43164ed1
commit
abead1aa9e
1 changed files with 26 additions and 8 deletions
|
@ -45,16 +45,33 @@
|
||||||
(rx/empty))))
|
(rx/empty))))
|
||||||
|
|
||||||
(defn initialize
|
(defn initialize
|
||||||
[]
|
[type id]
|
||||||
(Initialize.))
|
(Initialize. type id))
|
||||||
|
|
||||||
|
;; --- Select a Collection
|
||||||
|
|
||||||
|
(defrecord SelectCollection [type id]
|
||||||
|
rs/WatchEvent
|
||||||
|
(-apply-watch [_ state stream]
|
||||||
|
(rx/of (r/navigate :dashboard/images
|
||||||
|
{:type type :id id}))))
|
||||||
|
|
||||||
|
(defn select-collection
|
||||||
|
([type]
|
||||||
|
(select-collection type nil))
|
||||||
|
([type id]
|
||||||
|
{:pre [(keyword? type)]}
|
||||||
|
(SelectCollection. type id)))
|
||||||
|
|
||||||
;; --- Color Collections Fetched
|
;; --- Color Collections Fetched
|
||||||
|
|
||||||
(defrecord CollectionsFetched [items]
|
(defrecord CollectionsFetched [items]
|
||||||
rs/UpdateEvent
|
rs/UpdateEvent
|
||||||
(-apply-update [_ state]
|
(-apply-update [_ state]
|
||||||
(reduce (fn [acc {:keys [id] :as item}]
|
(reduce (fn [state item]
|
||||||
(assoc-in acc [:images-by-id id] item))
|
(let [id (:id item)
|
||||||
|
item (assoc item :type :own)]
|
||||||
|
(assoc-in state [:images-by-id id] item)))
|
||||||
state
|
state
|
||||||
items)))
|
items)))
|
||||||
|
|
||||||
|
@ -80,10 +97,11 @@
|
||||||
(defrecord CollectionCreated [item]
|
(defrecord CollectionCreated [item]
|
||||||
rs/UpdateEvent
|
rs/UpdateEvent
|
||||||
(-apply-update [_ state]
|
(-apply-update [_ state]
|
||||||
(-> state
|
(let [item (assoc item :type :own)]
|
||||||
(assoc-in [:images-by-id (:id item)] item)
|
(-> state
|
||||||
(assoc-in [:dashboard :collection-id] (:id item))
|
(assoc-in [:images-by-id (:id item)] item)
|
||||||
(assoc-in [:dashboard :collection-type] :own))))
|
(assoc-in [:dashboard :collection-id] (:id item))
|
||||||
|
(assoc-in [:dashboard :collection-type] :own)))))
|
||||||
|
|
||||||
(defn collection-created
|
(defn collection-created
|
||||||
[item]
|
[item]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue