Добавлены новые зависимости: "react-select" и "@floating-ui/core". Реализована локализация с использованием i18next, добавлены переводы для английского и русского языков. Обновлены компоненты для поддержки локализации, включая AppHeader, Attendance, Dashboard и другие. Улучшена логика отображения данных и взаимодействия с пользователем.

This commit is contained in:
2025-03-23 11:41:29 +03:00
parent d5b5838e51
commit d3a7f70d12
27 changed files with 995 additions and 191 deletions
+11 -9
View File
@@ -13,6 +13,7 @@ import {
useToast,
} from '@chakra-ui/react'
import { EditIcon } from '@chakra-ui/icons'
import { useTranslation } from 'react-i18next'
import { qrCode } from '../../../assets'
@@ -46,10 +47,11 @@ export const Item: React.FC<ItemProps> = ({
const toast = useToast()
const [updateLesson, updateLessonRqst] = api.useUpdateLessonMutation()
const createdLessonRef = useRef(null)
const { t } = useTranslation()
const onSubmit = (lessonData) => {
toastRef.current = toast({
title: 'Отправляем',
title: t('journal.pl.common.sending'),
status: 'loading',
duration: 9000,
})
@@ -58,7 +60,7 @@ export const Item: React.FC<ItemProps> = ({
updateLesson(lessonData)
} else {
toast.update(toastRef.current, {
title: 'Отсутствует интернет',
title: t('journal.pl.lesson.noInternet'),
status: 'error',
duration: 3000
})
@@ -68,8 +70,8 @@ export const Item: React.FC<ItemProps> = ({
useEffect(() => {
if (updateLessonRqst.isSuccess) {
const toastProps = {
title: 'Лекция Обновлена',
description: `Лекция ${createdLessonRef.current?.name} успешно обновлена`,
title: t('journal.pl.lesson.updated'),
description: t('journal.pl.lesson.updateMessage', { name: createdLessonRef.current?.name }),
status: 'success' as const,
duration: 9000,
isClosable: true,
@@ -92,8 +94,8 @@ export const Item: React.FC<ItemProps> = ({
setEdit(false)
}}
lesson={{ _id: id, id, name, date }}
title={'Редактирование лекции'}
nameButton={'Сохранить'}
title={t('journal.pl.lesson.editTitle')}
nameButton={t('journal.pl.save')}
/>
</Td>
</Tr>
@@ -129,13 +131,13 @@ export const Item: React.FC<ItemProps> = ({
setEdit(true)
}}
>
Edit
{t('journal.pl.edit')}
</MenuItem>
<MenuItem onClick={setlessonToDelete}>Delete</MenuItem>
<MenuItem onClick={setlessonToDelete}>{t('journal.pl.delete')}</MenuItem>
</MenuList>
</Menu>
)}
{edit && <Button onClick={setlessonToDelete}>Сохранить</Button>}
{edit && <Button onClick={setlessonToDelete}>{t('journal.pl.save')}</Button>}
</Td>
)}
<Td isNumeric>{students.length}</Td>