0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-09 16:48:16 -05:00

Show notifications on operations success

This commit is contained in:
Andrés Moya 2021-03-03 16:28:48 +01:00
parent 2e92757df6
commit 2adc45fc19
3 changed files with 57 additions and 7 deletions

View file

@ -729,6 +729,48 @@
},
"used-in" : [ "src/app/main/ui/dashboard/grid.cljs" ]
},
"dashboard.success-delete-project" : {
"translations" : {
"en" : "Your project has been deleted successfully",
"es" : "Tu proyecto ha sido borrado con éxito"
},
"used-in" : [ "src/app/main/ui/dashboard/project_menu.cljs" ]
},
"dashboard.success-delete-file" : {
"translations" : {
"en" : "Your file has been deleted successfully",
"es" : "Tu archivo ha sido borrado con éxito"
},
"used-in" : [ "src/app/main/ui/dashboard/file_menu.cljs" ]
},
"dashboard.success-duplicate-project" : {
"translations" : {
"en" : "Your project has been duplicated successfully",
"es" : "Tu proyecto ha sido duplicado con éxito"
},
"used-in" : [ "src/app/main/ui/dashboard/project_menu.cljs" ]
},
"dashboard.success-duplicate-file" : {
"translations" : {
"en" : "Your file has been duplicated successfully",
"es" : "Tu archivo ha sido duplicado con éxito"
},
"used-in" : [ "src/app/main/ui/dashboard/file_menu.cljs" ]
},
"dashboard.success-move-project" : {
"translations" : {
"en" : "Your project has been moved successfully",
"es" : "Tu proyecto ha sido movido con éxito"
},
"used-in" : [ "src/app/main/ui/dashboard/project_menu.cljs" ]
},
"dashboard.success-move-file" : {
"translations" : {
"en" : "Your file has been moved successfully",
"es" : "Tu archivo ha sido movido con éxito"
},
"used-in" : [ "src/app/main/ui/dashboard/file_menu.cljs" ]
},
"dashboard.switch-team" : {
"translations" : {
"ca" : "Cambiar d'equip",
@ -1006,7 +1048,7 @@
"translations" : {
"ca" : "Sembla que el contingut de la imatge no coincideix amb l'extensió del arxiu",
"en" : "Seems that the contents of the image does not match the file extension.",
"es" : "Parece que el contenido de la imagen no coincide con la etensión del archivo.",
"es" : "Parece que el contenido de la imagen no coincide con la extensión del archivo.",
"fr" : "Il semble que le contenu de limage ne correspond pas à lextension de fichier.",
"ru" : "",
"zh_cn" : "图片内容好像与文档扩展名不匹配。"

View file

@ -10,6 +10,7 @@
(ns app.main.ui.dashboard.file-menu
(:require
[app.main.data.dashboard :as dd]
[app.main.data.messages :as dm]
[app.main.data.modal :as modal]
[app.main.repo :as rp]
[app.main.store :as st]
@ -48,12 +49,14 @@
on-duplicate
(mf/use-callback
(mf/deps file)
(st/emitf (dd/duplicate-file file)))
(st/emitf (dm/success (tr "dashboard.success-duplicate-file"))
(dd/duplicate-file file)))
delete-fn
(mf/use-callback
(mf/deps file)
(st/emitf (dd/delete-file file)))
(st/emitf (dm/success (tr "dashboard.success-delete-file"))
(dd/delete-file file)))
on-delete
(mf/use-callback
@ -75,7 +78,8 @@
:project-id project-id}
mdata {:on-success
(st/emitf (rt/nav :dashboard-files
(st/emitf (dm/success (tr "dashboard.success-move-file"))
(rt/nav :dashboard-files
{:team-id team-id
:project-id project-id}))}]

View file

@ -10,6 +10,7 @@
(ns app.main.ui.dashboard.project-menu
(:require
[app.main.data.dashboard :as dd]
[app.main.data.messages :as dm]
[app.main.data.modal :as modal]
[app.main.repo :as rp]
[app.main.store :as st]
@ -37,7 +38,8 @@
(mf/deps project)
#(let [on-success
(fn [new-project]
(st/emit! (rt/nav :dashboard-files
(st/emit! (dm/success (tr "dashboard.success-duplicate-project"))
(rt/nav :dashboard-files
{:team-id (:team-id new-project)
:project-id (:id new-project)})))]
(st/emit! (dd/duplicate-project
@ -59,13 +61,15 @@
(st/emitf (rt/nav :dashboard-projects
{:team-id team-id}))}]
(st/emitf (dd/move-project (with-meta data mdata))))))
(st/emitf (dm/success (tr "dashboard.success-move-project"))
(dd/move-project (with-meta data mdata))))))
delete-fn
(mf/use-callback
(mf/deps project)
(fn [event]
(st/emit! (dd/delete-project project)
(st/emit! (dm/success (tr "dashboard.success-delete-project"))
(dd/delete-project project)
(rt/nav :dashboard-projects {:team-id (:team-id project)}))))
on-delete