This commit is contained in:
bakhirev 2024-12-03 01:40:15 +03:00
parent 734ed93a32
commit 10e39d967e
5 changed files with 23 additions and 7 deletions

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,7 @@
import { makeObservable, observable, action } from 'mobx';
import { t } from 'ts/helpers/Localization';
export interface IConfirmStore {
title: string;
yes: string;
@ -36,9 +38,9 @@ class ConfirmStore implements IConfirmStore {
}
open(options?: any) {
this.title = options?.title || options || 'Вы уверены что хотите удалить?';
this.yes = options?.yes || 'Да, уверен';
this.no = options?.no || 'Отмена';
this.title = options?.title || options || t('common.confirm.title');
this.yes = options?.yes || t('common.confirm.yes');
this.no = options?.no || t('common.confirm.no');
this.isOpen = true;
return new Promise((response: any, reject: any) => {
this.successCallback = response;

View file

@ -4,6 +4,7 @@ import { useTranslation } from 'react-i18next';
import localization from 'ts/helpers/Localization';
import dataGripStore from 'ts/store/DataGrip';
import viewNameStore, { ViewNameEnum } from 'ts/store/ViewName';
import confirm from 'ts/components/ModalWindow/store/Confirm';
import Button from './Button';
@ -47,8 +48,9 @@ function getMenu(navigate: Function): any[] {
confirm.open({
title: 'Вы уверены что хотите выйти?',
}).then(() => {
dataGripStore.asyncSetCommits([]);
dataGripStore.exit();
navigate('/');
viewNameStore.toggle(ViewNameEnum.WELCOME);
});
},
},

View file

@ -41,6 +41,7 @@ class DataGripStore {
processingDataAnalysis: action,
depersonalized: action,
updateStatistic: action,
exit: action,
});
}
@ -147,6 +148,13 @@ class DataGripStore {
this.fileGrip = fileGrip;
this.hash = Math.random();
}
exit() {
dataGrip.clear();
fileGrip.clear();
this.commits = [];
this.#updateRender();
}
}
const dataGripStore = new DataGripStore();

View file

@ -26,4 +26,8 @@ export default `
§ common.notifications.save: Изменения сохранены
§ common.notifications.setting: Настройки сохранены
§ common.fileLoader.notification: Ошибка загрузки файла $1
§ common.confirm.title: Вы уверены что хотите удалить?
§ common.confirm.yes: Да, уверен
§ common.confirm.no: Отмена
§ common.confirm.abc: abc
`;