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

delete bookmarks unnecessary toastr

ryoji-s 3 лет назад
Родитель
Сommit
6a575a7f1d

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

@@ -452,7 +452,6 @@
     "remove_share_link": "Succeeded to remove {{count}} share links",
     "switch_disable_link_sharing_success": "Succeeded to update share link setting",
     "failed_to_reset_password":"Failed to reset password",
-    "delete_succeeded": "Succeeded to delete {{target}}",
     "save_succeeded": "Saved successfully"
   },
   "template": {

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

@@ -486,7 +486,6 @@
     "remove_share_link": "共有リンクを{{count}}件削除しました",
     "switch_disable_link_sharing_success": "共有リンクの設定を変更しました",
     "failed_to_reset_password":"パスワードのリセットに失敗しました",
-    "delete_succeeded": "{{target}} の削除に成功しました",
     "save_succeeded": "保存に成功しました"
   },
   "template": {

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

@@ -439,7 +439,6 @@
     "remove_external_user_success": "Succeeded to remove {{accountId}} ",
     "switch_disable_link_sharing_success": "成功更新分享链接设置",
     "failed_to_reset_password":"Failed to reset password",
-    "delete_succeeded": "Succeeded to delete {{target}}",
     "save_succeeded": "已成功保存",
     "issue_share_link": "Succeeded to issue new share link"
   },

+ 3 - 10
apps/app/src/components/Bookmarks/BookmarkFolderItem.tsx

@@ -73,12 +73,11 @@ export const BookmarkFolderItem: FC<BookmarkFolderItemProps> = (props: BookmarkF
       await updateBookmarkFolder(folderId, folderName, parent);
       mutateBookmarkData();
       setIsRenameAction(false);
-      toastSuccess(t('toaster.update_successed', { target: t('bookmark_folder.bookmark_folder'), ns: 'commons' }));
     }
     catch (err) {
       toastError(err);
     }
-  }, [folderId, mutateBookmarkData, parent, t]);
+  }, [folderId, mutateBookmarkData, parent]);
 
   // Create new folder / subfolder handler
   const onPressEnterHandlerForCreate = useCallback(async(folderName: string) => {
@@ -87,14 +86,11 @@ export const BookmarkFolderItem: FC<BookmarkFolderItemProps> = (props: BookmarkF
       setIsOpen(true);
       setIsCreateAction(false);
       mutateBookmarkData();
-      toastSuccess(t('toaster.create_succeeded', { target: t('bookmark_folder.bookmark_folder'), ns: 'commons' }));
-
     }
     catch (err) {
       toastError(err);
     }
-
-  }, [mutateBookmarkData, t, targetFolder]);
+  }, [mutateBookmarkData, targetFolder]);
 
 
   const onClickPlusButton = useCallback(async(e) => {
@@ -136,7 +132,6 @@ export const BookmarkFolderItem: FC<BookmarkFolderItemProps> = (props: BookmarkF
         if (item.bookmarkFolder != null) {
           await updateBookmarkFolder(item.bookmarkFolder._id, item.bookmarkFolder.name, bookmarkFolder._id);
           mutateBookmarkData();
-          toastSuccess(t('toaster.update_successed', { target: t('bookmark_folder.bookmark_folder'), ns: 'commons' }));
         }
       }
       catch (err) {
@@ -149,7 +144,6 @@ export const BookmarkFolderItem: FC<BookmarkFolderItemProps> = (props: BookmarkF
           await addBookmarkToFolder(item._id, bookmarkFolder._id);
           mutateBookmarkData();
           await mutateUserBookmarks();
-          toastSuccess(t('toaster.add_succeeded', { target: t('bookmark_folder.bookmark'), ns: 'commons' }));
         }
       }
       catch (err) {
@@ -216,14 +210,13 @@ export const BookmarkFolderItem: FC<BookmarkFolderItemProps> = (props: BookmarkF
       }
       mutateBookmarkInfo();
       mutateBookmarkData();
-      toastSuccess(t('toaster.delete_succeeded', { target: t('bookmark_folder.bookmark_folder'), ns: 'commons' }));
     };
 
     if (bookmarkFolder == null) {
       return;
     }
     openDeleteBookmarkFolderModal(bookmarkFolder, { onDeleted: bookmarkFolderDeleteHandler });
-  }, [bookmarkFolder, mutateBookmarkData, mutateBookmarkInfo, openDeleteBookmarkFolderModal, t]);
+  }, [bookmarkFolder, mutateBookmarkData, mutateBookmarkInfo, openDeleteBookmarkFolderModal]);
 
 
   return (

+ 5 - 11
apps/app/src/components/Bookmarks/BookmarkFolderMenu.tsx

@@ -8,7 +8,7 @@ import {
 } from 'reactstrap';
 
 import { addBookmarkToFolder, addNewFolder, toggleBookmark } from '~/client/util/bookmark-utils';
-import { toastError, toastSuccess } from '~/client/util/toastr';
+import { toastError } from '~/client/util/toastr';
 import { BookmarkFolderItems } from '~/interfaces/bookmark-info';
 import { useSWRBookmarkInfo, useSWRxCurrentUserBookmarks } from '~/stores/bookmark';
 import { useSWRxBookamrkFolderAndChild } from '~/stores/bookmark-folder';
@@ -61,8 +61,7 @@ export const BookmarkFolderMenu = (props: Props): JSX.Element => {
     mutateBookmarkInfo();
     mutateBookmarkFolderData();
     setSelectedItem(null);
-    toastSuccess(t('toaster.delete_succeeded', { target: t('bookmark_folder.bookmark'), ns: 'commons' }));
-  }, [mutateBookmarkFolderData, mutateBookmarkInfo, mutateUserBookmarks, t, toggleBookmarkHandler]);
+  }, [mutateBookmarkFolderData, mutateBookmarkInfo, mutateUserBookmarks, toggleBookmarkHandler]);
 
   const toggleHandler = useCallback(async() => {
     setIsOpen(!isOpen);
@@ -82,13 +81,12 @@ export const BookmarkFolderMenu = (props: Props): JSX.Element => {
         mutateUserBookmarks();
         mutateBookmarkInfo();
         setSelectedItem(null);
-        toastSuccess(t('toaster.add_succeeded', { target: t('bookmark_folder.bookmark'), ns: 'commons' }));
       }
       catch (err) {
         toastError(err);
       }
     }
-  }, [isOpen, mutateBookmarkFolderData, bookmarkFolders, isBookmarked, currentPage?._id, toggleBookmarkHandler, mutateUserBookmarks, mutateBookmarkInfo, t]);
+  }, [isOpen, mutateBookmarkFolderData, bookmarkFolders, isBookmarked, currentPage?._id, toggleBookmarkHandler, mutateUserBookmarks, mutateBookmarkInfo]);
 
 
   const isBookmarkFolderExists = useCallback((): boolean => {
@@ -100,13 +98,11 @@ export const BookmarkFolderMenu = (props: Props): JSX.Element => {
       await addNewFolder(folderName, null);
       await mutateBookmarkFolderData();
       setIsCreateAction(false);
-      toastSuccess(t('toaster.create_succeeded', { target: t('bookmark_folder.bookmark_folder'), ns: 'commons' }));
     }
     catch (err) {
       toastError(err);
     }
-
-  }, [mutateBookmarkFolderData, t]);
+  }, [mutateBookmarkFolderData]);
 
   const onMenuItemClickHandler = useCallback(async(itemId: string) => {
     try {
@@ -116,8 +112,6 @@ export const BookmarkFolderMenu = (props: Props): JSX.Element => {
       if (currentPage != null) {
         await addBookmarkToFolder(currentPage._id, itemId);
       }
-      const toaster = isBookmarked ? 'toaster.update_successed' : 'toaster.add_succeeded';
-      toastSuccess(t(toaster, { target: t('bookmark_folder.bookmark'), ns: 'commons' }));
       mutateBookmarkInfo();
       mutateUserBookmarks();
     }
@@ -127,7 +121,7 @@ export const BookmarkFolderMenu = (props: Props): JSX.Element => {
 
     mutateBookmarkFolderData();
     setSelectedItem(itemId);
-  }, [mutateBookmarkFolderData, isBookmarked, currentPage, t, mutateBookmarkInfo, mutateUserBookmarks, toggleBookmarkHandler]);
+  }, [mutateBookmarkFolderData, isBookmarked, currentPage, mutateBookmarkInfo, mutateUserBookmarks, toggleBookmarkHandler]);
 
 
   const renderBookmarkMenuItem = (child?: BookmarkFolderItems[]) => {

+ 4 - 9
apps/app/src/components/Bookmarks/BookmarkFolderMenuItem.tsx

@@ -11,7 +11,7 @@ import {
 import {
   addBookmarkToFolder, addNewFolder, hasChildren, toggleBookmark,
 } from '~/client/util/bookmark-utils';
-import { toastError, toastSuccess } from '~/client/util/toastr';
+import { toastError } from '~/client/util/toastr';
 import { BookmarkFolderItems } from '~/interfaces/bookmark-info';
 import { onDeletedBookmarkFolderFunction } from '~/interfaces/ui';
 import { useSWRBookmarkInfo, useSWRxCurrentUserBookmarks } from '~/stores/bookmark';
@@ -52,13 +52,11 @@ export const BookmarkFolderMenuItem = (props: Props): JSX.Element => {
       await addNewFolder(folderName, item._id);
       await mutateBookamrkData();
       setIsCreateAction(false);
-      toastSuccess(t('toaster.create_succeeded', { target: t('bookmark_folder.bookmark_folder'), ns: 'commons' }));
     }
     catch (err) {
       toastError(err);
     }
-
-  }, [item._id, mutateBookamrkData, t]);
+  }, [item._id, mutateBookamrkData]);
 
   useEffect(() => {
     if (isOpen) {
@@ -95,14 +93,13 @@ export const BookmarkFolderMenuItem = (props: Props): JSX.Element => {
       }
       mutateBookmarkInfo();
       mutateBookamrkData();
-      toastSuccess(t('toaster.delete_succeeded', { target: t('bookmark_folder.bookmark_folder'), ns: 'commons' }));
     };
 
     if (item == null) {
       return;
     }
     openDeleteBookmarkFolderModal(item, { onDeleted: bookmarkFolderDeleteHandler });
-  }, [item, mutateBookamrkData, mutateBookmarkInfo, openDeleteBookmarkFolderModal, t]);
+  }, [item, mutateBookamrkData, mutateBookmarkInfo, openDeleteBookmarkFolderModal]);
 
   const onClickChildMenuItemHandler = useCallback(async(e, item) => {
     e.stopPropagation();
@@ -114,8 +111,6 @@ export const BookmarkFolderMenuItem = (props: Props): JSX.Element => {
       if (currentPage != null) {
         await addBookmarkToFolder(currentPage._id, item._id);
       }
-      const toaster = isBookmarked ? 'toaster.update_successed' : 'toaster.add_succeeded';
-      toastSuccess(t(toaster, { target: t('bookmark_folder.bookmark'), ns: 'commons' }));
       mutateUserBookmarks();
       mutateBookamrkData();
       setSelectedItem(item._id);
@@ -124,7 +119,7 @@ export const BookmarkFolderMenuItem = (props: Props): JSX.Element => {
     catch (err) {
       toastError(err);
     }
-  }, [onSelectedChild, isBookmarked, currentPage, t, mutateUserBookmarks, mutateBookamrkData, mutateBookmarkInfo]);
+  }, [onSelectedChild, isBookmarked, currentPage, mutateUserBookmarks, mutateBookamrkData, mutateBookmarkInfo]);
 
   const renderBookmarkSubMenuItem = useCallback(() => {
     if (!isOpen) {

+ 0 - 2
apps/app/src/components/Bookmarks/BookmarkFolderTree.tsx

@@ -71,7 +71,6 @@ export const BookmarkFolderTree = (props: BookmarkFolderTreeProps): JSX.Element
       try {
         await updateBookmarkFolder(item.bookmarkFolder._id, item.bookmarkFolder.name, null);
         await mutateBookamrkData();
-        toastSuccess(t('toaster.update_successed', { target: t('bookmark_folder.bookmark_folder'), ns: 'commons' }));
       }
       catch (err) {
         toastError(err);
@@ -81,7 +80,6 @@ export const BookmarkFolderTree = (props: BookmarkFolderTreeProps): JSX.Element
       try {
         await addBookmarkToFolder(item._id, null);
         await mutateUserBookmarks();
-        toastSuccess(t('toaster.add_succeeded', { target: t('bookmark_folder.bookmark'), ns: 'commons' }));
       }
       catch (err) {
         toastError(err);

+ 2 - 3
apps/app/src/components/Bookmarks/BookmarkItem.tsx

@@ -9,7 +9,7 @@ import { UncontrolledTooltip, DropdownToggle } from 'reactstrap';
 import { unbookmark } from '~/client/services/page-operation';
 import { renamePage } from '~/client/util/bookmark-utils';
 import { ValidationTarget } from '~/client/util/input-validator';
-import { toastError, toastSuccess } from '~/client/util/toastr';
+import { toastError } from '~/client/util/toastr';
 import { BookmarkFolderItems, DragItemDataType, DRAG_ITEM_TYPE } from '~/interfaces/bookmark-info';
 import { IPageHasId, IPageInfoAll, IPageToDeleteWithMeta } from '~/interfaces/page';
 import { useSWRxBookamrkFolderAndChild } from '~/stores/bookmark-folder';
@@ -76,13 +76,12 @@ export const BookmarkItem = (props: Props): JSX.Element => {
       setRenameInputShown(false);
       await renamePage(bookmarkedPage._id, bookmarkedPage.revision, newPagePath);
       onRenamed();
-      toastSuccess(t('renamed_pages', { path: bookmarkedPage.path }));
     }
     catch (err) {
       setRenameInputShown(true);
       toastError(err);
     }
-  }, [bookmarkedPage, onRenamed, t]);
+  }, [bookmarkedPage, onRenamed]);
 
   const deleteMenuItemClickHandler = useCallback(async(_pageId: string, pageInfo: IPageInfoAll | undefined): Promise<void> => {
     if (bookmarkedPage._id == null || bookmarkedPage.path == null) {

+ 1 - 3
apps/app/src/components/Sidebar/Bookmarks/BookmarkContents.tsx

@@ -27,13 +27,11 @@ export const BookmarkContents = (): JSX.Element => {
       await apiv3Post('/bookmark-folder', { name: folderName, parent: null });
       await mutateChildBookmarkData();
       setIsCreateAction(false);
-      toastSuccess(t('toaster.create_succeeded', { target: t('bookmark_folder.bookmark_folder'), ns: 'commons' }));
     }
     catch (err) {
       toastError(err);
     }
-
-  }, [mutateChildBookmarkData, t]);
+  }, [mutateChildBookmarkData]);
 
   const renderAddNewBookmarkFolder = useCallback(() => (
     <>

+ 1 - 1
apps/app/src/components/UsersHomePageFooter.module.scss

@@ -1,4 +1,4 @@
-@use '~/styles/molecules/page_list';
+@use '@growi/ui/src/styles/molecules/page_list';
 @use '~/styles/variables' as var;
 $grw-sidebar-content-header-height: 58px;
 $grw-sidebar-content-footer-height: 50px;

+ 1 - 2
apps/app/src/components/UsersHomePageFooter.tsx

@@ -4,6 +4,7 @@ import { useTranslation } from 'next-i18next';
 
 
 import { apiv3Post } from '~/client/util/apiv3-client';
+import { addNewFolder } from '~/client/util/bookmark-utils';
 import { toastError, toastSuccess } from '~/client/util/toastr';
 import { RecentlyCreatedIcon } from '~/components/Icons/RecentlyCreatedIcon';
 import { RecentCreated } from '~/components/RecentCreated/RecentCreated';
@@ -15,7 +16,6 @@ import { BookmarkFolderTree } from './Bookmarks/BookmarkFolderTree';
 import { CompressIcon } from './Icons/CompressIcon';
 import { ExpandIcon } from './Icons/ExpandIcon';
 import { FolderPlusIcon } from './Icons/FolderPlusIcon';
-import { addNewFolder } from '~/client/util/bookmark-utils';
 
 
 export type UsersHomePageFooterProps = {
@@ -34,7 +34,6 @@ export const UsersHomePageFooter = (props: UsersHomePageFooterProps): JSX.Elemen
       await addNewFolder(folderName, null);
       await mutateChildBookmarkData();
       setIsCreateAction(false);
-      toastSuccess(t('toaster.create_succeeded', { target: t('bookmark_folder.bookmark_folder'), ns: 'commons' }));
     }
     catch (err) {
       toastError(err);