Добавлены новые зависимости: "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

View File

@@ -1,5 +1,6 @@
import React from 'react'
import { useParams } from 'react-router-dom'
import { useTranslation } from 'react-i18next'
import { api } from '../__data__/api/api'
import dayjs from 'dayjs'
@@ -16,6 +17,7 @@ import { UserCard } from '../components/user-card'
const UserPage = () => {
const { lessonId, accessId } = useParams()
const { t } = useTranslation()
const acc = api.useGetAccessQuery({ accessCode: accessId })
const ls = api.useLessonByIdQuery(lessonId, {
@@ -41,8 +43,8 @@ const UserPage = () => {
return (
<Container>
{acc.isLoading && <h1>Отправляем запрос</h1>}
{acc.isSuccess && <h1>Успешно</h1>}
{acc.isLoading && <h1>{t('journal.pl.common.sending')}</h1>}
{acc.isSuccess && <h1>{t('journal.pl.common.success')}</h1>}
{acc.error && (
<Box mb="6" mt="2">
@@ -50,7 +52,7 @@ const UserPage = () => {
<AlertIcon />
{(acc as any).error?.data?.body?.errorMessage ===
'Code is expired' ? (
'Не удалось активировать код доступа. Попробуйте отсканировать код ещё раз'
t('journal.pl.access.expiredCode')
) : (
<pre>{JSON.stringify(acc.error, null, 4)}</pre>
)}
@@ -60,10 +62,10 @@ const UserPage = () => {
<Box mb={6}>
<Text fontSize={18} fontWeight={600} as="h1" mt="4" mb="3">
Тема занятия: {ls.data?.body?.name}
{t('journal.pl.lesson.topicTitle')} {ls.data?.body?.name}
</Text>
<span>{dayjs(ls.data?.body?.date).format('DD MMMM YYYYг.')}</span>
<span>{dayjs(ls.data?.body?.date).format(t('journal.pl.lesson.dateFormat'))}</span>
</Box>
<Box