0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-03 12:59:12 -05:00

🐛 Fix navigation on dashboard when file is moved to other team.

This commit is contained in:
Andrey Antukh 2021-06-17 09:06:07 +02:00 committed by Andrés Moya
parent 231a133f23
commit 376d0663c2
3 changed files with 25 additions and 16 deletions

View file

@ -16,6 +16,7 @@
- Remove unnecesary redirect from history when user goes to workspace from dashboard [Taiga 1820](https://tree.taiga.io/project/penpot/issue/1820). - Remove unnecesary redirect from history when user goes to workspace from dashboard [Taiga 1820](https://tree.taiga.io/project/penpot/issue/1820).
- Fix tooltip position on view application [Taiga 1819](https://tree.taiga.io/project/penpot/issue/1819). - Fix tooltip position on view application [Taiga 1819](https://tree.taiga.io/project/penpot/issue/1819).
- Fix dashboard navigation on moving file to other team [Taiga 1817](https://tree.taiga.io/project/penpot/issue/1817).
### :arrow_up: Deps updates ### :arrow_up: Deps updates
### :boom: Breaking changes ### :boom: Breaking changes

View file

@ -688,13 +688,19 @@
(defn go-to-files (defn go-to-files
[project-id] ([project-id]
(ptk/reify ::go-to-files (ptk/reify ::go-to-files
ptk/WatchEvent ptk/WatchEvent
(watch [_ state stream] (watch [_ state stream]
(let [team-id (:current-team-id state)] (let [team-id (:current-team-id state)]
(rx/of (rt/nav :dashboard-files {:team-id team-id (rx/of (rt/nav :dashboard-files {:team-id team-id
:project-id project-id})))))) :project-id project-id}))))))
([team-id project-id]
(ptk/reify ::go-to-files
ptk/WatchEvent
(watch [_ state stream]
(rx/of (rt/nav :dashboard-files {:team-id team-id
:project-id project-id}))))))
(defn go-to-search (defn go-to-search
([] (go-to-search nil)) ([] (go-to-search nil))

View file

@ -72,19 +72,19 @@
(:projects current-team)) (:projects current-team))
on-new-tab on-new-tab
(fn [event] (fn [_]
(let [pparams {:project-id (:project-id file) (let [pparams {:project-id (:project-id file)
:file-id (:id file)} :file-id (:id file)}
qparams {:page-id (first (get-in file [:data :pages]))}] qparams {:page-id (first (get-in file [:data :pages]))}]
(st/emit! (rt/nav-new-window :workspace pparams qparams)))) (st/emit! (rt/nav-new-window :workspace pparams qparams))))
on-duplicate on-duplicate
(fn [event] (fn [_]
(apply st/emit! (map dd/duplicate-file files)) (apply st/emit! (map dd/duplicate-file files))
(st/emit! (dm/success (tr "dashboard.success-duplicate-file")))) (st/emit! (dm/success (tr "dashboard.success-duplicate-file"))))
delete-fn delete-fn
(fn [event] (fn [_]
(apply st/emit! (map dd/delete-file files)) (apply st/emit! (map dd/delete-file files))
(st/emit! (dm/success (tr "dashboard.success-delete-file")))) (st/emit! (dm/success (tr "dashboard.success-delete-file"))))
@ -111,16 +111,18 @@
(st/emit! (dm/success (tr "dashboard.success-move-files"))) (st/emit! (dm/success (tr "dashboard.success-move-files")))
(st/emit! (dm/success (tr "dashboard.success-move-file")))) (st/emit! (dm/success (tr "dashboard.success-move-file"))))
(if (or navigate? (not= team-id current-team-id)) (if (or navigate? (not= team-id current-team-id))
(st/emit! (dd/go-to-files project-id)) (st/emit! (dd/go-to-files team-id project-id))
(st/emit! (dd/fetch-recent-files) (st/emit! (dd/fetch-recent-files)
(dd/clear-selected-files)))) (dd/clear-selected-files))))
on-move on-move
(fn [team-id project-id] (fn [team-id project-id]
(let [data {:ids (set (map :id files)) (let [params {:ids (set (map :id files))
:project-id project-id} :project-id project-id}]
mdata {:on-success #(on-move-success team-id project-id)}] (fn []
(st/emitf (dd/move-files (with-meta data mdata))))) (st/emit! (dd/move-files
(with-meta params
{:on-success #(on-move-success team-id project-id)}))))))
add-shared add-shared
(st/emitf (dd/set-file-shared (assoc file :is-shared true))) (st/emitf (dd/set-file-shared (assoc file :is-shared true)))
@ -155,7 +157,7 @@
:on-accept del-shared}))) :on-accept del-shared})))
on-export-files on-export-files
(fn [event] (fn [_]
(->> (uw/ask-many! (->> (uw/ask-many!
{:cmd :export-file {:cmd :export-file
:team-id current-team-id :team-id current-team-id