mirror of
https://github.com/penpot/penpot.git
synced 2025-01-22 06:32:38 -05:00
Merge pull request #3081 from penpot/hiru-cancel-remove-graphics
✨ Allow to cancel and resume later remove graphics
This commit is contained in:
commit
e481f1cc99
2 changed files with 19 additions and 8 deletions
|
@ -1895,7 +1895,7 @@
|
|||
[file-id file-name]
|
||||
(ptk/reify ::remove-graphics
|
||||
ptk/WatchEvent
|
||||
(watch [it state _]
|
||||
(watch [it state stream]
|
||||
(let [file-data (wsh/get-file state file-id)
|
||||
|
||||
grid-gap 50
|
||||
|
@ -1915,7 +1915,9 @@
|
|||
media)
|
||||
|
||||
shape-grid
|
||||
(ctst/generate-shape-grid media-points start-pos grid-gap)]
|
||||
(ctst/generate-shape-grid media-points start-pos grid-gap)
|
||||
|
||||
stoper (rx/filter (ptk/type? ::finalize-file) stream)]
|
||||
|
||||
(rx/concat
|
||||
(rx/of (modal/show {:type :remove-graphics-dialog :file-name file-name})
|
||||
|
@ -1924,8 +1926,9 @@
|
|||
(rx/of (dch/commit-changes (-> (pcb/empty-changes it)
|
||||
(pcb/set-save-undo? false)
|
||||
(pcb/add-page (:id page) page)))))
|
||||
(rx/mapcat (partial remove-graphic it file-data' page)
|
||||
(rx/from (d/enumerate (d/zip media shape-grid))))
|
||||
(->> (rx/mapcat (partial remove-graphic it file-data' page)
|
||||
(rx/from (d/enumerate (d/zip media shape-grid))))
|
||||
(rx/take-until stoper))
|
||||
(rx/of (complete-remove-graphics)))))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
[app.util.globals :as globals]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.object :as obj]
|
||||
[app.util.router :as rt]
|
||||
[debug :refer [debug?]]
|
||||
[goog.events :as events]
|
||||
[okulary.core :as l]
|
||||
|
@ -199,8 +200,12 @@
|
|||
::mf/register-as :remove-graphics-dialog}
|
||||
[{:keys [] :as ctx}]
|
||||
(let [remove-state (mf/deref refs/remove-graphics)
|
||||
close #(modal/hide!)
|
||||
reload-file #(dom/reload-current-window)]
|
||||
project (mf/deref refs/workspace-project)
|
||||
close #(modal/hide!)
|
||||
reload-file #(dom/reload-current-window)
|
||||
nav-out #(st/emit! (rt/navigate :dashboard-files
|
||||
{:team-id (:team-id project)
|
||||
:project-id (:id project)}))]
|
||||
(mf/use-effect
|
||||
(fn []
|
||||
#(st/emit! (dw/clear-remove-graphics))))
|
||||
|
@ -209,9 +214,12 @@
|
|||
[:div.modal-header
|
||||
[:div.modal-header-title
|
||||
[:h2 (tr "workspace.remove-graphics.title" (:file-name ctx))]]
|
||||
(when (and (:completed remove-state) (:error remove-state))
|
||||
(if (and (:completed remove-state) (:error remove-state))
|
||||
[:div.modal-close-button
|
||||
{:on-click close} i/close])]
|
||||
{:on-click close} i/close]
|
||||
[:div.modal-close-button
|
||||
{:on-click nav-out}
|
||||
i/close])]
|
||||
(if-not (and (:completed remove-state) (:error remove-state))
|
||||
[:div.modal-content
|
||||
[:p (tr "workspace.remove-graphics.text1")]
|
||||
|
|
Loading…
Add table
Reference in a new issue