This commit is contained in:
bakhirev 2024-12-03 17:22:06 +03:00
parent 6a75b3b0be
commit 84bee540ba
27 changed files with 70 additions and 13 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

View file

@ -1,5 +1,5 @@
import dataGripStore from 'ts/store/DataGrip';
import { getRandom, shuffle } from 'ts/helpers/random';
import { shuffle } from 'ts/helpers/random';
import localization from 'ts/helpers/Localization';
import IQuiz from '../interfaces/Quiz';
@ -20,17 +20,23 @@ function getQuestionByList(
return getQuestion(question, formattedAnswers, formattedAnswers.indexOf(rightAnswer));
}
function getRandomDiff(value: number) {
return Math.random() > 0.5 ? value : -value;
}
function getQuestionByNumber(question: string, rightAnswer: number) {
let a, b;
if (rightAnswer < 3) {
a = rightAnswer + 1;
b = rightAnswer + 2;
} else {
a = rightAnswer + (getRandom(rightAnswer) * (Math.random() > 0.5 ? 1 : -1));
b = rightAnswer + (getRandom(rightAnswer) * (Math.random() > 0.5 ? 1 : -1));
if (a === b) return null;
const step = rightAnswer > 10
? Math.ceil(rightAnswer * 0.15)
: 1;
a = rightAnswer + getRandomDiff(step);
b = rightAnswer + getRandomDiff(step * 2);
}
const answers = shuffle([rightAnswer || 1, a || 1, b || 1]);
const answers = shuffle([rightAnswer, a, b]);
return getQuestion(question, answers, answers.indexOf(rightAnswer));
}

View file

@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
import { useNavigate, useParams } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import localization from 'ts/helpers/Localization';
import { t as _t } 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';
@ -34,7 +34,7 @@ function getMenu(navigate: Function): any[] {
icon: './assets/menu/share.svg',
onClick() {
navigator.share({
title: localization.get('common.title'),
title: _t('common.title'),
text: '',
url: window.location.href,
});
@ -46,7 +46,7 @@ function getMenu(navigate: Function): any[] {
icon: './assets/menu/logout.svg',
onClick() {
confirm.open({
title: 'Вы уверены что хотите выйти?',
title: _t('sidebar.buttons.logoutQuestion'),
}).then(() => {
dataGripStore.exit();
navigate('/');

View file

@ -1,4 +1,4 @@
import React, { ReactNode } from 'react';
import React, { ReactNode, useState, useEffect } from 'react';
import { observer } from 'mobx-react-lite';
import { useParams } from 'react-router-dom';
@ -81,7 +81,17 @@ const DesktopView = observer(({ children }: IPageWrapper): React.ReactElement =>
});
function PageWrapper({ children }: IPageWrapper) {
return isMobile
const [localIsMobile, setLocalIsMobile] = useState<boolean>(isMobile);
useEffect(() => {
function handleResize() {
setLocalIsMobile(window.innerWidth < 700 || isMobile);
}
window.addEventListener('resize', handleResize);
return () => window.removeEventListener('resize', handleResize);
}, []);
return localIsMobile
? (<MobileView>{children}</MobileView>)
: (<DesktopView>{children}</DesktopView>);
}

View file

@ -26,4 +26,8 @@ Wenn dies ein Fehler ist und die Statistiken für diesen Mitarbeiter berücksich
§ common.notifications.save: Änderungen gespeichert
§ common.notifications.setting: Einstellungen gespeichert
§ common.fileLoader.notification: Cant open file $1
§ common.confirm.title: Are you sure you want to remove it?
§ common.confirm.yes: Yes, I am sure.
§ common.confirm.no: Cancel
§ common.confirm.abc: abc
`;

View file

@ -5,6 +5,7 @@ export default `
§ sidebar.buttons.print: Drucken
§ sidebar.buttons.share: Share
§ sidebar.buttons.logout: Logout
§ sidebar.buttons.logoutQuestion: Are you sure you want to clear data-set?
§ sidebar.filters.all: Die ganze Zeit
§ sidebar.filters.year: Jahr
§ sidebar.filters.halfYear: ein halbes Jahr

View file

@ -29,4 +29,8 @@ If this is an error and this employee needs to be calculated as usual, go to the
§ common.notifications.save: The changes have been saved
§ common.notifications.setting: The settings have been saved
§ common.fileLoader.notification: Cant open file $1
§ common.confirm.title: Are you sure you want to remove it?
§ common.confirm.yes: Yes, I am sure.
§ common.confirm.no: Cancel
§ common.confirm.abc: abc
`;

View file

@ -5,6 +5,7 @@ export default `
§ sidebar.buttons.print: Print
§ sidebar.buttons.share: Share
§ sidebar.buttons.logout: Logout
§ sidebar.buttons.logoutQuestion: Are you sure you want to clear data-set?
§ sidebar.filters.all: all time
§ sidebar.filters.year: year
§ sidebar.filters.halfYear: half year

View file

@ -28,4 +28,8 @@ El trabajo de los colaboradores con este estatus en este proyecto puede desestim
§ common.notifications.save: Cambios guardados
§ common.notifications.setting: Ajustes guardados
§ common.fileLoader.notification: Cant open file $1
§ common.confirm.title: Are you sure you want to remove it?
§ common.confirm.yes: Yes, I am sure.
§ common.confirm.no: Cancel
§ common.confirm.abc: abc
`;

View file

@ -5,6 +5,7 @@ export default `
§ sidebar.buttons.print: Impresión
§ sidebar.buttons.share: Share
§ sidebar.buttons.logout: Logout
§ sidebar.buttons.logoutQuestion: Are you sure you want to clear data-set?
§ sidebar.filters.all: a todas horas
§ sidebar.filters.year: año
§ sidebar.filters.halfYear: medio año

View file

@ -26,4 +26,8 @@ Si cest une erreur et que la statistique pour ce collaborateur doit être pri
§ common.notifications.save: Modifications enregistrées
§ common.notifications.setting: Paramètres enregistrés
§ common.fileLoader.notification: Cant open file $1
§ common.confirm.title: Are you sure you want to remove it?
§ common.confirm.yes: Yes, I am sure.
§ common.confirm.no: Cancel
§ common.confirm.abc: abc
`;

View file

@ -5,6 +5,7 @@ export default `
§ sidebar.buttons.print: Impression
§ sidebar.buttons.share: Share
§ sidebar.buttons.logout: Logout
§ sidebar.buttons.logoutQuestion: Are you sure you want to clear data-set?
§ sidebar.filters.all: à toute heure
§ sidebar.filters.year: année
§ sidebar.filters.halfYear: demi-année

View file

@ -26,4 +26,8 @@ export default `
§ common.notifications.save: 変更は保存されます
§ common.notifications.setting: 設定が保存されます
§ common.fileLoader.notification: Cant open file $1
§ common.confirm.title: Are you sure you want to remove it?
§ common.confirm.yes: Yes, I am sure.
§ common.confirm.no: Cancel
§ common.confirm.abc: abc
`;

View file

@ -5,6 +5,7 @@ export default `
§ sidebar.buttons.print: 印刷
§ sidebar.buttons.share: Share
§ sidebar.buttons.logout: Logout
§ sidebar.buttons.logoutQuestion: Are you sure you want to clear data-set?
§ sidebar.filters.all: すべての時間
§ sidebar.filters.year:
§ sidebar.filters.halfYear: 半年

View file

@ -26,4 +26,8 @@ export default `
§ common.notifications.save: 변경
§ common.notifications.setting: 설정이
§ common.fileLoader.notification: 파일 $1
§ common.confirm.title: Are you sure you want to remove it?
§ common.confirm.yes: Yes, I am sure.
§ common.confirm.no: Cancel
§ common.confirm.abc: abc
`;

View file

@ -5,6 +5,7 @@ export default `
§ sidebar.buttons.print: 인쇄
§ sidebar.buttons.share: 그것을
§ sidebar.buttons.logout: 나가
§ sidebar.buttons.logoutQuestion: Are you sure you want to clear data-set?
§ sidebar.filters.all: 항상
§ sidebar.filters.year:
§ sidebar.filters.halfYear: 반년

View file

@ -26,4 +26,8 @@ Se este for um erro e a estatística para esse funcionário precisar ser levada
§ common.notifications.save: Alterações salvas
§ common.notifications.setting: Configuração guardada
§ common.fileLoader.notification: Cant open file $1
§ common.confirm.title: Are you sure you want to remove it?
§ common.confirm.yes: Yes, I am sure.
§ common.confirm.no: Cancel
§ common.confirm.abc: abc
`;

View file

@ -5,6 +5,7 @@ export default `
§ sidebar.buttons.print: Impressão
§ sidebar.buttons.share: Share
§ sidebar.buttons.logout: Logout
§ sidebar.buttons.logoutQuestion: Are you sure you want to clear data-set?
§ sidebar.filters.all: o tempo todo
§ sidebar.filters.year: ano
§ sidebar.filters.halfYear: meio ano

View file

@ -5,6 +5,7 @@ export default `
§ sidebar.buttons.print: Печать
§ sidebar.buttons.share: Расшарить
§ sidebar.buttons.logout: Выйти
§ sidebar.buttons.logoutQuestion: Вы уверены что хотите выйти?
§ sidebar.filters.all: всё время
§ sidebar.filters.year: год
§ sidebar.filters.halfYear: пол года

View file

@ -26,4 +26,8 @@ export default `
§ common.notifications.save: 将保存更改
§ common.notifications.setting: 设置被保存
§ common.fileLoader.notification: Cant open file $1
§ common.confirm.title: Are you sure you want to remove it?
§ common.confirm.yes: Yes, I am sure.
§ common.confirm.no: Cancel
§ common.confirm.abc: abc
`;

View file

@ -5,6 +5,7 @@ export default `
§ sidebar.buttons.print: 印刷业
§ sidebar.buttons.share: Share
§ sidebar.buttons.logout: Logout
§ sidebar.buttons.logoutQuestion: Are you sure you want to clear data-set?
§ sidebar.filters.all: 一直
§ sidebar.filters.year: 年份
§ sidebar.filters.halfYear: 半年