diff --git a/packages/client/public/locales/en/Files.json b/packages/client/public/locales/en/Files.json index 14d73a805c..bdfb2bde1e 100644 --- a/packages/client/public/locales/en/Files.json +++ b/packages/client/public/locales/en/Files.json @@ -65,6 +65,7 @@ "EmptyScreenFolder": "No docs here yet", "EnableLink": "Enable link", "EnableNotifications": "Enable notifications", + "ErrorChangeIndex": "Error when changing index. The problem may be caused on the server side. Reload the page or check your Internet connection settings.", "ExcludeSubfolders": "Exclude subfolders", "FavoritesEmptyContainerDescription": "To mark files as favorites or remove them from this list, use the context menu.", "FileContents": "File contents", diff --git a/packages/client/public/locales/ru/Files.json b/packages/client/public/locales/ru/Files.json index 50f3ffa9d5..fe02752c1e 100644 --- a/packages/client/public/locales/ru/Files.json +++ b/packages/client/public/locales/ru/Files.json @@ -65,6 +65,7 @@ "EmptyScreenFolder": "Здесь пока нет документов", "EnableLink": "Активировать ссылку", "EnableNotifications": "Включить уведомления", + "ErrorChangeIndex": "Ошибка при изменении индекса. Проблема может быть вызвана на стороне сервера. Перезагрузите страницу или проверьте настройки подключения к Интернету.", "ExcludeSubfolders": "Исключить вложенные папки", "FavoritesEmptyContainerDescription": "Чтобы добавить файлы в избранное или удалить их из этого списка, используйте контекстное меню.", "FileContents": "Содержимое файла", diff --git a/packages/client/src/components/dialogs/ReorderIndexDialog/index.tsx b/packages/client/src/components/dialogs/ReorderIndexDialog/index.tsx index 9ad423d64a..ec3be5628c 100644 --- a/packages/client/src/components/dialogs/ReorderIndexDialog/index.tsx +++ b/packages/client/src/components/dialogs/ReorderIndexDialog/index.tsx @@ -25,8 +25,10 @@ // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode import React from "react"; + import { inject, observer } from "mobx-react"; import { useTranslation } from "react-i18next"; +import { TTranslation } from "@docspace/shared/types"; import { ModalDialog, @@ -42,7 +44,7 @@ import FilesActionsStore from "SRC_DIR/store/FilesActionsStore"; import { TSelectedFolder } from "@docspace/client/src/store/SelectedFolderStore"; export interface ReorderIndexDialogProps { - reorder: (id: number | string | null) => void; + reorder: (id: number | string | null, t: TTranslation) => void; setIsVisible: (visible: boolean) => void; visible: boolean; selectedFolder: TSelectedFolder; @@ -61,7 +63,7 @@ const ReorderIndexDialog = ({ }; const onReorder = () => { - reorder(selectedFolder?.id); + reorder(selectedFolder?.id, t); setIsVisible(false); }; diff --git a/packages/client/src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js b/packages/client/src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js index fd25aeec47..0ec1cba63e 100644 --- a/packages/client/src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js +++ b/packages/client/src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js @@ -361,6 +361,7 @@ StyledSimpleFilesRow.defaultProps = { theme: Base }; const SimpleFilesRow = (props) => { const { + t, item, sectionWidth, dragging, @@ -407,7 +408,7 @@ const SimpleFilesRow = (props) => { const isSmallContainer = sectionWidth <= 500; const onChangeIndex = (action) => { - return changeIndex(action, item); + return changeIndex(action, item, t); }; const element = ( diff --git a/packages/client/src/pages/Home/Section/Body/TableView/TableRow.js b/packages/client/src/pages/Home/Section/Body/TableView/TableRow.js index f43e75a514..6395b577ac 100644 --- a/packages/client/src/pages/Home/Section/Body/TableView/TableRow.js +++ b/packages/client/src/pages/Home/Section/Body/TableView/TableRow.js @@ -111,7 +111,7 @@ const FilesTableRow = (props) => { }; const onChangeIndex = (action) => { - return onEditIndex(action, item); + return onEditIndex(action, item, t); }; const onDragOverEvent = (dragActive, e) => { diff --git a/packages/client/src/pages/Home/Section/Body/index.js b/packages/client/src/pages/Home/Section/Body/index.js index 0a87bfa02e..9a6c083fac 100644 --- a/packages/client/src/pages/Home/Section/Body/index.js +++ b/packages/client/src/pages/Home/Section/Body/index.js @@ -332,7 +332,7 @@ const SectionBodyContent = (props) => { if (!replaceable) return; - changeIndex(VDRIndexingAction.MoveIndex, replaceable); + changeIndex(VDRIndexingAction.MoveIndex, replaceable, t); return; }; diff --git a/packages/client/src/store/FilesActionsStore.js b/packages/client/src/store/FilesActionsStore.js index c568bc99db..599e84e722 100644 --- a/packages/client/src/store/FilesActionsStore.js +++ b/packages/client/src/store/FilesActionsStore.js @@ -2719,7 +2719,7 @@ class FilesActionStore { await deleteFilesFromRecent(fileIds); await refreshFiles(); }; - changeIndex = async (action, item) => { + changeIndex = async (action, item, t) => { const { filesList } = this.filesStore; const index = filesList.findIndex( @@ -2762,19 +2762,27 @@ class FilesActionStore { if (!replaceable) return; - await changeIndex(current?.id, replaceable.order, current?.isFolder); + try { + await changeIndex(current?.id, replaceable.order, current?.isFolder); - const items = [current, replaceable]; - setUpdateItems(items); + const items = [current, replaceable]; + setUpdateItems(items); - const operationId = uniqueid("operation_"); - this.updateCurrentFolder(null, [id], true, operationId); + const operationId = uniqueid("operation_"); + this.updateCurrentFolder(null, [id], true, operationId); + } catch (e) { + toastr.error(t("Files:ErrorChangeIndex")); + } }; - reorder = async (id) => { - const operationId = uniqueid("operation_"); - await reorder(id); - this.updateCurrentFolder(null, [id], true, operationId); + reorder = async (id, t) => { + try { + const operationId = uniqueid("operation_"); + await reorder(id); + this.updateCurrentFolder(null, [id], true, operationId); + } catch (e) { + toastr.error(t("Files:ErrorChangeIndex")); + } }; }