Просмотр исходного кода

Display toaster when response is returned

Shun Miyazawa 1 год назад
Родитель
Сommit
14b51a9b18

+ 3 - 1
apps/app/public/static/locales/en_US/translation.json

@@ -880,6 +880,8 @@
     "untitled": "Untitled"
   },
   "sync-latest-reevision-body": {
-    "confirm": "Delete the draft data being entered into the editor and synchronize the latest text. Are you sure you want to run it?"
+    "confirm": "Delete the draft data being entered into the editor and synchronize the latest text. Are you sure you want to run it?",
+    "success-toaster": "Latest text synchronized",
+    "error-toaster": "Synchronization of the latest text failed"
   }
 }

+ 3 - 1
apps/app/public/static/locales/fr_FR/translation.json

@@ -871,6 +871,8 @@
     "size_l": "Taille: G"
   },
   "sync-latest-reevision-body": {
-    "confirm": "Delete the draft data being entered into the editor and synchronize the latest text. Are you sure you want to run it?"
+    "confirm": "Delete the draft data being entered into the editor and synchronize the latest text. Are you sure you want to run it?",
+    "success-toaster": "Dernier texte synchronisé",
+     "error-toaster": "La synchronisation du dernier texte a échoué"
   }
 }

+ 3 - 1
apps/app/public/static/locales/ja_JP/translation.json

@@ -913,6 +913,8 @@
     "untitled": "無題のページ"
   },
   "sync-latest-reevision-body": {
-    "confirm": "エディターに入力中のドラフトデータを削除して最新の本文を同期します。実行しますか?"
+    "confirm": "エディターに入力中のドラフトデータを削除して最新の本文を同期します。実行しますか?",
+    "success-toaster": "最新の本文を同期しました",
+    "error-toaster": "最新の本文の同期に失敗しました"
   }
 }

+ 3 - 1
apps/app/public/static/locales/zh_CN/translation.json

@@ -883,6 +883,8 @@
     "untitled": "Untitled"
   },
   "sync-latest-reevision-body": {
-    "confirm": "删除输入编辑器的草稿数据,同步最新文本。 您真的想运行它吗?"
+    "confirm": "删除输入编辑器的草稿数据,同步最新文本。 您真的想运行它吗?",
+    "success-toaster": "同步最新文本",
+     "error-toaster": "同步最新文本失败"
   }
 }

+ 4 - 2
apps/app/src/client/components/Navbar/GrowiContextualSubNavigation.tsx

@@ -15,6 +15,7 @@ import Sticky from 'react-stickynode';
 import { DropdownItem } from 'reactstrap';
 
 import { exportAsMarkdown, updateContentWidth, syncLatestRevisionBody } from '~/client/services/page-operation';
+import { toastSuccess, toastError } from '~/client/util/toastr';
 import { GroundGlassBar } from '~/components/Navbar/GroundGlassBar';
 import type { OnDuplicatedFunction, OnRenamedFunction, OnDeletedFunction } from '~/interfaces/ui';
 import { useShouldExpandContent } from '~/services/layout/use-should-expand-content';
@@ -82,9 +83,10 @@ const PageOperationMenuItems = (props: PageOperationMenuItemsProps): JSX.Element
     if (answer) {
       try {
         await syncLatestRevisionBody(pageId);
+        toastSuccess(t('sync-latest-reevision-body.success-toaster'));
       }
-      catch (err) {
-        //
+      catch {
+        toastError(t('sync-latest-reevision-body.error-toaster'));
       }
     }
   }, [pageId, t]);