0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-14 02:58:39 -05:00

Remove IPrintWritter impl from dashboard events.

This commit is contained in:
Andrey Antukh 2016-03-15 20:55:02 +02:00
parent 7a6bcb5d47
commit e631d2a3ef

View file

@ -63,44 +63,28 @@
(assoc-in $ [:dashboard :section] section) (assoc-in $ [:dashboard :section] section)
(update $ :dashboard merge-if-not-exists (update $ :dashboard merge-if-not-exists
{:collection-type :builtin {:collection-type :builtin
:collection-id 1}))) :collection-id 1})))))
IPrintWithWriter
(-pr-writer [mv writer _]
(-write writer "#<event:u.d.d/initialize>"))))
(defn set-project-ordering (defn set-project-ordering
[order] [order]
(reify (reify
rs/UpdateEvent rs/UpdateEvent
(-apply-update [_ state] (-apply-update [_ state]
(assoc-in state [:dashboard :project-order] order)) (assoc-in state [:dashboard :project-order] order))))
IPrintWithWriter
(-pr-writer [mv writer _]
(-write writer "#<event:u.d.d/set-project-ordering>"))))
(defn set-project-filtering (defn set-project-filtering
[term] [term]
(reify (reify
rs/UpdateEvent rs/UpdateEvent
(-apply-update [_ state] (-apply-update [_ state]
(assoc-in state [:dashboard :project-filter] term)) (assoc-in state [:dashboard :project-filter] term))))
IPrintWithWriter
(-pr-writer [mv writer _]
(-write writer "#<event:u.d.d/set-project-filtering>"))))
(defn clear-project-filtering (defn clear-project-filtering
[] []
(reify (reify
rs/UpdateEvent rs/UpdateEvent
(-apply-update [_ state] (-apply-update [_ state]
(assoc-in state [:dashboard :project-filter] "")) (assoc-in state [:dashboard :project-filter] ""))))
IPrintWithWriter
(-pr-writer [mv writer _]
(-write writer "#<event:u.d.d/clear-project-filtering>"))))
(defn set-collection-type (defn set-collection-type
[type] [type]
@ -115,22 +99,14 @@
(-apply-update [_ state] (-apply-update [_ state]
(as-> state $ (as-> state $
(assoc-in $ [:dashboard :collection-type] type) (assoc-in $ [:dashboard :collection-type] type)
(select-first $))) (select-first $))))))
IPrintWithWriter
(-pr-writer [mv writer _]
(-write writer "#<event:u.d.d/set-collection-type>")))))
(defn set-collection (defn set-collection
[id] [id]
(reify (reify
rs/UpdateEvent rs/UpdateEvent
(-apply-update [_ state] (-apply-update [_ state]
(assoc-in state [:dashboard :collection-id] id)) (assoc-in state [:dashboard :collection-id] id))))
IPrintWithWriter
(-pr-writer [mv writer _]
(-write writer "#<event:u.d.d/set-collection>"))))
(defn mk-color-collection (defn mk-color-collection
[] []
@ -143,22 +119,14 @@
(-> state (-> state
(assoc-in [:colors-by-id id] coll) (assoc-in [:colors-by-id id] coll)
(assoc-in [:dashboard :collection-id] id) (assoc-in [:dashboard :collection-id] id)
(assoc-in [:dashboard :collection-type] :own)))) (assoc-in [:dashboard :collection-type] :own))))))
IPrintWithWriter
(-pr-writer [mv writer _]
(-write writer "#<event:u.d.d/mk-color-collection>"))))
(defn rename-color-collection (defn rename-color-collection
[id name] [id name]
(reify (reify
rs/UpdateEvent rs/UpdateEvent
(-apply-update [_ state] (-apply-update [_ state]
(assoc-in state [:colors-by-id id :name] name)) (assoc-in state [:colors-by-id id :name] name))))
IPrintWithWriter
(-pr-writer [mv writer _]
(-write writer "#<event:u.d.d/rename-color-collection>"))))
(defn delete-color-collection (defn delete-color-collection
[id] [id]
@ -167,11 +135,7 @@
(-apply-update [_ state] (-apply-update [_ state]
(let [state (update state :colors-by-id dissoc id) (let [state (update state :colors-by-id dissoc id)
colls (sort-by :id (vals (:colors-by-id state)))] colls (sort-by :id (vals (:colors-by-id state)))]
(assoc-in state [:dashboard :collection-id] (:id (first colls))))) (assoc-in state [:dashboard :collection-id] (:id (first colls)))))))
IPrintWithWriter
(-pr-writer [mv writer _]
(-write writer "#<event:u.d.d/rename-color-collection>"))))
(defn replace-color (defn replace-color
"Add or replace color in a collection." "Add or replace color in a collection."
@ -185,11 +149,7 @@
(disj $ from) (disj $ from)
(conj $ to) (conj $ to)
(assoc-in state [:colors-by-id id :colors] $)) (assoc-in state [:colors-by-id id :colors] $))
state)) state))))
IPrintWithWriter
(-pr-writer [mv writer _]
(-write writer "#<event:u.d.d/replace-color>"))))
(defn remove-color (defn remove-color
"Remove color in a collection." "Remove color in a collection."
@ -202,9 +162,5 @@
(as-> colors $ (as-> colors $
(disj $ color) (disj $ color)
(assoc-in state [:colors-by-id id :colors] $)) (assoc-in state [:colors-by-id id :colors] $))
state)) state))))
IPrintWithWriter
(-pr-writer [mv writer _]
(-write writer "#<event:u.d.d/remove-color>"))))