0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-04-05 03:21:26 -05:00

Usability fixes on icons and images events.

This commit is contained in:
Andrey Antukh 2016-10-19 23:58:52 +02:00
parent 217e6bd70b
commit a8dd40900c
2 changed files with 18 additions and 14 deletions

View file

@ -88,11 +88,12 @@
(defrecord CollectionCreated [item]
rs/UpdateEvent
(-apply-update [_ state]
(let [item (assoc item :type :own)]
(-> state
(assoc-in [:icon-colls-by-id (:id item)] item)
(assoc-in [:dashboard :collection-id] (:id item))
(assoc-in [:dashboard :collection-type] :own)))))
(let [{:keys [id] :as item} (assoc item :type :own)]
(update state :image-colls-by-id assoc id item)))
rs/WatchEvent
(-apply-watch [_ state stream]
(rx/of (select-collection :own (:id item)))))
(defn collection-created
[item]
@ -166,8 +167,9 @@
rs/WatchEvent
(-apply-watch [_ state s]
(->> (rp/req :delete/icon-collection id)
(rx/ignore))))
(let [type (get-in state [:dashboard :images :type])]
(->> (rp/req :delete/icon-collection id)
(rx/map #(select-collection type))))))
(defn delete-collection
[id]

View file

@ -90,11 +90,12 @@
(defrecord CollectionCreated [item]
rs/UpdateEvent
(-apply-update [_ state]
(let [item (assoc item :type :own)]
(-> state
(assoc-in [:image-colls-by-id (:id item)] item)
(assoc-in [:dashboard :images :id] (:id item))
(assoc-in [:dashboard :type] :own)))))
(let [{:keys [id] :as item} (assoc item :type :own)]
(update state :image-colls-by-id assoc id item)))
rs/WatchEvent
(-apply-watch [_ state stream]
(rx/of (select-collection :own (:id item)))))
(defn collection-created
[item]
@ -168,8 +169,9 @@
rs/WatchEvent
(-apply-watch [_ state s]
(->> (rp/req :delete/image-collection id)
(rx/ignore))))
(let [type (get-in state [:dashboard :images :type])]
(->> (rp/req :delete/image-collection id)
(rx/map #(select-collection type))))))
(defn delete-collection
[id]