mirror of
https://github.com/penpot/penpot.git
synced 2025-02-10 00:58:26 -05:00
💄 Refactor clear selected files
This commit is contained in:
parent
c2332331ce
commit
4b2a4c8fa3
7 changed files with 26 additions and 28 deletions
|
@ -60,7 +60,6 @@
|
|||
(s/def ::set-of-uuid
|
||||
(s/every ::us/uuid :kind set?))
|
||||
|
||||
(declare clear-selected-files)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Data Fetching
|
||||
|
@ -149,10 +148,8 @@
|
|||
|
||||
ptk/WatchEvent
|
||||
(watch [_ state stream]
|
||||
(rx/concat
|
||||
(->> (rp/query :search-files params)
|
||||
(rx/map #(partial fetched %)))
|
||||
(rx/of (clear-selected-files)))))))
|
||||
(->> (rp/query :search-files params)
|
||||
(rx/map #(partial fetched %)))))))
|
||||
|
||||
;; --- Fetch Files
|
||||
|
||||
|
@ -164,10 +161,8 @@
|
|||
(ptk/reify ::fetch-files
|
||||
ptk/WatchEvent
|
||||
(watch [_ state stream]
|
||||
(rx/concat
|
||||
(->> (rp/query :files params)
|
||||
(rx/map #(partial fetched %)))
|
||||
(rx/of (clear-selected-files)))))))
|
||||
(->> (rp/query :files params)
|
||||
(rx/map #(partial fetched %)))))))
|
||||
|
||||
;; --- Fetch Shared Files
|
||||
|
||||
|
@ -179,10 +174,8 @@
|
|||
(ptk/reify ::fetch-shared-files
|
||||
ptk/WatchEvent
|
||||
(watch [_ state stream]
|
||||
(rx/concat
|
||||
(->> (rp/query :shared-files {:team-id team-id})
|
||||
(rx/map #(partial fetched %)))
|
||||
(rx/of (clear-selected-files)))))))
|
||||
(->> (rp/query :shared-files {:team-id team-id})
|
||||
(rx/map #(partial fetched %)))))))
|
||||
|
||||
;; --- Fetch recent files
|
||||
|
||||
|
@ -195,10 +188,8 @@
|
|||
ptk/WatchEvent
|
||||
(watch [_ state stream]
|
||||
(let [params {:team-id team-id}]
|
||||
(rx/concat
|
||||
(->> (rp/query :recent-files params)
|
||||
(rx/map #(recent-files-fetched team-id %)))
|
||||
(rx/of (clear-selected-files)))))))
|
||||
(->> (rp/query :recent-files params)
|
||||
(rx/map #(recent-files-fetched team-id %)))))))
|
||||
|
||||
(defn recent-files-fetched
|
||||
[team-id files]
|
||||
|
|
|
@ -86,12 +86,14 @@
|
|||
:project-id project-id}
|
||||
|
||||
mdata {:on-success
|
||||
(st/emitf (dm/success (tr "dashboard.success-move-file"))
|
||||
(if navigate?
|
||||
(rt/nav :dashboard-files
|
||||
{:team-id team-id
|
||||
:project-id project-id})
|
||||
(dd/fetch-recent-files {:team-id team-id})))}]
|
||||
#(do
|
||||
(st/emit! (dm/success (tr "dashboard.success-move-file")))
|
||||
(if navigate?
|
||||
(st/emit! (rt/nav :dashboard-files
|
||||
{:team-id team-id
|
||||
:project-id project-id}))
|
||||
(st/emit! (dd/fetch-recent-files {:team-id team-id})
|
||||
(dd/clear-selected-files))))}]
|
||||
|
||||
(st/emitf (dd/move-files (with-meta data mdata))))))
|
||||
|
||||
|
|
|
@ -94,7 +94,8 @@
|
|||
(mf/use-effect
|
||||
(mf/deps (:id project))
|
||||
(fn []
|
||||
(st/emit! (dd/fetch-files {:project-id (:id project)}))))
|
||||
(st/emit! (dd/fetch-files {:project-id (:id project)})
|
||||
(dd/clear-selected-files))))
|
||||
|
||||
[:*
|
||||
[:& header {:team team :project project}]
|
||||
|
|
|
@ -321,7 +321,8 @@
|
|||
|
||||
mdata {:on-success
|
||||
(st/emitf (dm/success (tr "dashboard.success-move-file"))
|
||||
(dd/fetch-recent-files {:team-id team-id}))}]
|
||||
(dd/fetch-recent-files {:team-id team-id})
|
||||
(dd/clear-selected-files))}]
|
||||
(st/emit! (dd/move-files (with-meta data mdata)))))))]
|
||||
|
||||
[:section.dashboard-grid {:on-drag-enter on-drag-enter
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
(reverse))]
|
||||
(mf/use-effect
|
||||
(mf/deps team)
|
||||
#(st/emit! (dd/fetch-shared-files {:team-id (:id team)})))
|
||||
#(st/emit! (dd/fetch-shared-files {:team-id (:id team)})
|
||||
(dd/clear-selected-files)))
|
||||
|
||||
[:*
|
||||
[:header.dashboard-header
|
||||
|
|
|
@ -162,7 +162,8 @@
|
|||
(mf/use-effect
|
||||
(mf/deps team)
|
||||
(fn []
|
||||
(st/emit! (dd/fetch-recent-files {:team-id (:id team)}))))
|
||||
(st/emit! (dd/fetch-recent-files {:team-id (:id team)})
|
||||
(dd/clear-selected-files))))
|
||||
|
||||
(when (seq projects)
|
||||
[:*
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
(mf/use-effect
|
||||
(mf/deps team search-term)
|
||||
(st/emitf (dd/search-files {:team-id (:id team)
|
||||
:search-term search-term})))
|
||||
:search-term search-term})
|
||||
(dd/clear-selected-files)))
|
||||
|
||||
[:*
|
||||
[:header.dashboard-header
|
||||
|
|
Loading…
Add table
Reference in a new issue