diff --git a/apps/schools/dev.Dockerfile b/apps/schools/dev.Dockerfile index 1f20126f..a526c560 100644 --- a/apps/schools/dev.Dockerfile +++ b/apps/schools/dev.Dockerfile @@ -2,6 +2,7 @@ FROM node:18-alpine AS runner RUN node -v +ENV NODE_OPTIONS="--max-old-space-size=4096" ENV NODE_TLS_REJECT_UNAUTHORIZED=0 ENV NODE_ENV production ENV NEXT_TELEMETRY_DISABLED 1 diff --git a/apps/schools/domains/circle/components/changeCircleForm/index.tsx b/apps/schools/domains/circle/components/changeCircleForm/index.tsx index f67c7333..1df2e8f3 100644 --- a/apps/schools/domains/circle/components/changeCircleForm/index.tsx +++ b/apps/schools/domains/circle/components/changeCircleForm/index.tsx @@ -6,8 +6,6 @@ import { Button } from '@domains/common/components/button' import { useChangeCircleFormValidators } from './hooks' import { useGetAllCirclesQuery } from '@domains/organization/redux/organizationApi' import { useOrganization } from '@domains/organization/providers/organizationProvider' -import { WithTooltip } from '@domains/common/components/tooltip/withTooltip' -import { TOOLTIP_MARGIN } from './styles/styles' import { isValidFormCheck } from '@domains/common/utils/form' import { CIRCLE_NAME, CIRCLE_ADDRESS, ADDRESS_ROOM } from './constants' import classnames from 'classnames' @@ -80,22 +78,20 @@ export const ChangeCircleForm = () => { layout='vertical' > Редактирование кружка - - - * Название - - } - name={CIRCLE_NAME} - className={styles.label} - rules={validators.name} - initialValue={initialValues[CIRCLE_NAME]} - > - - - + + * Название + + } + name={CIRCLE_NAME} + className={styles.label} + rules={validators.name} + initialValue={initialValues[CIRCLE_NAME]} + > + + {!circlesData.isLoading ? ( diff --git a/apps/schools/domains/circle/components/changeCircleForm/styles/styles.module.scss b/apps/schools/domains/circle/components/changeCircleForm/styles/styles.module.scss index 197ea315..42252514 100644 --- a/apps/schools/domains/circle/components/changeCircleForm/styles/styles.module.scss +++ b/apps/schools/domains/circle/components/changeCircleForm/styles/styles.module.scss @@ -20,6 +20,7 @@ font-style: normal; font-weight: 400; line-height: 22px; + width: 95%; :global { .ant-select-selector { diff --git a/apps/schools/domains/circle/components/circleList/index.tsx b/apps/schools/domains/circle/components/circleList/index.tsx index d9a1c062..72321657 100644 --- a/apps/schools/domains/circle/components/circleList/index.tsx +++ b/apps/schools/domains/circle/components/circleList/index.tsx @@ -10,27 +10,18 @@ import { RowType, TableType } from './interfaces' import { searchStudentsColumns } from './constants' import { useGetAllCirclesQuery } from '@domains/organization/redux/organizationApi' import EmptyWrapper from '@domains/common/components/containers/EmptyWrapper' -import { mapReturnedData } from '@domains/common/redux/utils' import { HighlightText } from '@domains/common/components/table/forming' import { getVarsForAddressColumn } from '@domains/common/utils/geo' import { AppRoutes, RoutePath } from '@domains/common/constants/routerEnums' -import { defaultPaginationTablePage, defaultPaginationTablePageSize } from '@domains/common/constants/Table' -import { scrollToTop } from '@domains/common/utils/scrollInDirection' +import { useQueryState } from 'next-usequerystate' export function CircleList() { - const [searchRequestText, setSearchRequestText] = useState('') + const [searchRequestText, setSearchRequestText] = useQueryState('search') const { organizationId } = useOrganization() - const [paginationParams, setPaginationParams] = useState({ - page: defaultPaginationTablePage, - pageSize: defaultPaginationTablePageSize, - }) - const { data: circles, isFetching: isFetching } = useGetAllCirclesQuery({ organization_id: organizationId, - or_search: createSearchTextForRequest(searchRequestText, searchStudentsColumns), - page: paginationParams.page, - page_size: paginationParams.pageSize, + or_search: createSearchTextForRequest(searchRequestText || '', searchStudentsColumns), }) return ( @@ -42,7 +33,7 @@ export function CircleList() { data={circles} isLoading={isFetching} handleRunTask={() => router.push(RoutePath[AppRoutes.CIRCLE_CREATE])} - searchTrigger={searchRequestText} + searchTrigger={searchRequestText || ''} >
Кружки @@ -61,18 +52,6 @@ export function CircleList() { ['Адрес', 'address'], ['Кол-во принятых заявок', 'accepted_count'], ]} - pagination={{ - current: paginationParams.page, - pageSize: paginationParams.pageSize, - total: circles?.count, - onChange: (page, pageSize) => { - setPaginationParams({ - page, - pageSize, - }) - scrollToTop() - }, - }} data={circles} isLoading={isFetching} mainRoute={RoutePath[AppRoutes.CIRCLE_LIST]} @@ -95,8 +74,9 @@ export function CircleList() { }, }} customWidths={[60, 25, 15]} - searchRequestText={searchRequestText} - setSearchRequestText={setSearchRequestText} + searchRequestText={searchRequestText || ''} + setSearchRequestText={(text) => setSearchRequestText(text)} + rowClassName={styles.tableRowPointer} /> ) diff --git a/apps/schools/domains/circle/components/circleList/styles/styles.module.scss b/apps/schools/domains/circle/components/circleList/styles/styles.module.scss index 20a5f9b5..c0d78172 100644 --- a/apps/schools/domains/circle/components/circleList/styles/styles.module.scss +++ b/apps/schools/domains/circle/components/circleList/styles/styles.module.scss @@ -59,4 +59,8 @@ font-style: normal; font-weight: 400; line-height: 22px; -} \ No newline at end of file +} + +.tableRowPointer:hover { + cursor: pointer; +} diff --git a/apps/schools/domains/circle/components/createCircleForm/index.tsx b/apps/schools/domains/circle/components/createCircleForm/index.tsx index 3d5636a6..a06e375d 100644 --- a/apps/schools/domains/circle/components/createCircleForm/index.tsx +++ b/apps/schools/domains/circle/components/createCircleForm/index.tsx @@ -1,4 +1,4 @@ -import { Form, Typography, Input as AntdInput, Row, Spin, Tooltip } from 'antd' +import { Form, Typography, Input as AntdInput, Row, Spin } from 'antd' import React, { useEffect, useState } from 'react' import { Input } from '@domains/common/components/input' import styles from './styles/styles.module.scss' @@ -6,12 +6,10 @@ import { Button } from '@domains/common/components/button' import { useCreateCircleFormValidators } from './hooks' import { useGetAllCirclesQuery } from '@domains/organization/redux/organizationApi' import { useOrganization } from '@domains/organization/providers/organizationProvider' -import { WithTooltip } from '@domains/common/components/tooltip/withTooltip' -import { TOOLTIP_MARGIN } from './styles/styles' import { isValidFormCheck } from '@domains/common/utils/form' import { CIRCLE_NAME, CIRCLE_ADDRESS, ADDRESS_ROOM } from './constants' import classnames from 'classnames' -import { AimOutlined, QuestionCircleFilled } from '@ant-design/icons' +import { AimOutlined } from '@ant-design/icons' import { Select } from '@domains/common/components/select' import { useCreateCircleMutation } from '../../redux/circleApi' import { getVarsForAddressColumn } from '@domains/common/utils/geo' @@ -21,14 +19,6 @@ import { mapSteps } from '@domains/circle/interfaces/mapStepsType' import { FormMapSteps } from '@domains/circle/constants/Enums' import Image from 'next/image' import android from '@public/image/Android 11.png' -import { - DEFAULT_ICON_SIZE, - DEFAULT_MARGIN, - DEFAULT_OVERLAY_INNER_COLOR, - DEFAULT_OVERLAY_INNER_STYLE, - ICON_SIZES, -} from '@domains/common/components/tooltip/styles/styles' -import { BackPage } from '@domains/common/components/backPage' export const CreateCircleForm = () => { const validators = useCreateCircleFormValidators() @@ -93,28 +83,10 @@ export const CreateCircleForm = () => { > -
- - - -
- + />
diff --git a/apps/schools/domains/circle/components/createCircleForm/styles/styles.module.scss b/apps/schools/domains/circle/components/createCircleForm/styles/styles.module.scss index 4ff4c485..c79c9600 100644 --- a/apps/schools/domains/circle/components/createCircleForm/styles/styles.module.scss +++ b/apps/schools/domains/circle/components/createCircleForm/styles/styles.module.scss @@ -30,13 +30,13 @@ width: 3%; } - .inputWithTooltipContainer { + .inputContainer { display: flex; flex-direction: row; justify-content: unset; } - .inputWithTooltip { + .input { width: 70%; margin-right: 5px; display: flex; diff --git a/apps/schools/domains/circle/components/currentCircle/index.tsx b/apps/schools/domains/circle/components/currentCircle/index.tsx index 48cbcb25..dd0398c2 100644 --- a/apps/schools/domains/circle/components/currentCircle/index.tsx +++ b/apps/schools/domains/circle/components/currentCircle/index.tsx @@ -25,10 +25,11 @@ import { getVarsForAddressColumn } from '@domains/common/utils/geo' import { StatusesEnum } from '@domains/common/constants/Enums' import { ErrorType } from '@store/commonApi' import { AppRoutes, DynamicAppRoutes, DynamicRoutePath, RoutePath } from '@domains/common/constants/routerEnums' +import { useQueryState } from 'next-usequerystate' const CurrentCircle = () => { const [isModalVisible, setIsModalVisible] = useState(false) - const [searchRequestText, setSearchRequestText] = useState('') + const [searchRequestText, setSearchRequestText] = useQueryState('search') const [mutation, isDeleteFinished] = useDeleteCircleMutation() const uuid = getUuidFromUrl() const router = useRouter() @@ -40,7 +41,7 @@ const CurrentCircle = () => { const { data: circle, error: circleError } = useGetCircleQuery({ circle_id: uuid[0] }) const { data: students, isLoading } = useGetCircleStudentsQuery({ circle_id: uuid[0], - or_search: createSearchTextForRequest(searchRequestText, searchColumns), + or_search: createSearchTextForRequest(searchRequestText || '', searchColumns), }) const { data: queryData } = useGetCurrentCircleQuery({ circle_id: uuid[0], organization_id: organizationId }) @@ -135,8 +136,8 @@ const CurrentCircle = () => { isLoading={isLoading} needNumbering={true} searchFields={['student_name', 'student_phone', 'parent_names', 'parent_phones']} - searchRequestText={searchRequestText} - setSearchRequestText={setSearchRequestText} + searchRequestText={searchRequestText || ''} + setSearchRequestText={(text) => setSearchRequestText(text)} /> diff --git a/apps/schools/domains/common/components/bubbleFilter/index.tsx b/apps/schools/domains/common/components/bubbleFilter/index.tsx index 840641e1..a25c9beb 100644 --- a/apps/schools/domains/common/components/bubbleFilter/index.tsx +++ b/apps/schools/domains/common/components/bubbleFilter/index.tsx @@ -4,12 +4,13 @@ import styles from './styles/styles.module.scss' import { BubbleFilterProps, BubbleFilterListItem } from '@domains/common/components/bubbleFilter/interface' import { CloseOutlined } from '@ant-design/icons' -export const BubbleFilter: React.FC = React.memo(({ text, items }) => { - const listItems = items.map((item: BubbleFilterListItem) => - item.count && item.count > 0 ? ( +export const BubbleFilter: React.FC = React.memo(({ text, items, statuses }) => { + const listItems = items.map((item: BubbleFilterListItem) => { + const isSelected = statuses?.includes(item.key) ?? false + return item.count && item.count > 0 ? ( {} : item.onClick} + className={isSelected ? styles.bubbleContainerSelected : styles.bubbleContainer} + onClick={isSelected ? () => {} : item.onClick} style={{ backgroundColor: item.isSelected ? item.color : '' }} key={item.key} > @@ -21,8 +22,8 @@ export const BubbleFilter: React.FC = React.memo(({ text, ite
{item.text}
{item.isSelected && }
- ) : null, - ) + ) : null + }) return ( diff --git a/apps/schools/domains/common/components/bubbleFilter/interface.ts b/apps/schools/domains/common/components/bubbleFilter/interface.ts index 8f348b3c..c6f83405 100644 --- a/apps/schools/domains/common/components/bubbleFilter/interface.ts +++ b/apps/schools/domains/common/components/bubbleFilter/interface.ts @@ -11,4 +11,5 @@ export interface BubbleFilterListItem { export interface BubbleFilterProps { items: BubbleFilterListItem[] text?: string + statuses?: string[] | null } diff --git a/apps/schools/domains/common/components/searchInput/index.tsx b/apps/schools/domains/common/components/searchInput/index.tsx index 93986b3c..054a158b 100644 --- a/apps/schools/domains/common/components/searchInput/index.tsx +++ b/apps/schools/domains/common/components/searchInput/index.tsx @@ -1,14 +1,15 @@ -import React, { useState, ChangeEvent } from 'react' +import React, { ChangeEvent } from 'react' import { Input } from '@domains/common/components/input' import { CloseCircleOutlined, SearchOutlined } from '@ant-design/icons' import styles from './styles/styles.module.scss' +import { useQueryState } from 'next-usequerystate' interface SearchInputProps { onSearchChange: (value: string) => void } const SearchInput: React.FC = ({ onSearchChange }) => { - const [inputText, setInputText] = useState('') + const [inputText, setInputText] = useQueryState('search') const handleInputChange = (event: ChangeEvent) => { const value = event.target.value @@ -21,7 +22,7 @@ const SearchInput: React.FC = ({ onSearchChange }) => { onChange={handleInputChange} customType={'inputSearch'} placeholder={'Поиск'} - value={inputText} + value={inputText || ''} children={ <> diff --git a/apps/schools/domains/common/components/table/index.tsx b/apps/schools/domains/common/components/table/index.tsx index 1e7d1ffb..f01e598b 100644 --- a/apps/schools/domains/common/components/table/index.tsx +++ b/apps/schools/domains/common/components/table/index.tsx @@ -9,6 +9,7 @@ import { typeTable } from '@domains/common/constants/Table' import { CustomTableProps } from '@domains/common/components/table/interfaces' import { calculateAverageWidth } from '@domains/common/utils/calculateAverageWidth' import { ColumnType } from 'antd/lib/table/interface' +import { useQueryState } from 'next-usequerystate' export const Table = (props: CustomTableProps) => { const { @@ -64,7 +65,7 @@ export const Table = (props: CustomTableProps([]) const router = useRouter() @@ -134,7 +135,7 @@ export const Table = (props: CustomTableProps diff --git a/apps/schools/domains/common/components/table/interfaces.ts b/apps/schools/domains/common/components/table/interfaces.ts index 268282eb..54ba112b 100644 --- a/apps/schools/domains/common/components/table/interfaces.ts +++ b/apps/schools/domains/common/components/table/interfaces.ts @@ -3,6 +3,7 @@ import { ReturnedData } from '@domains/common/redux/interfaces' import { TableProps } from 'antd' import { ColumnFilterItem } from 'antd/lib/table/interface' import { Key } from 'antd/es/table/interface' +import { Options } from 'next-usequerystate' export interface CustomFieldsProps { [key: string]: React.FC<{ @@ -30,7 +31,10 @@ export interface CustomTableProps extends TableProps customFields?: CustomFieldsProps searchRequestText: string needNumbering?: boolean - setSearchRequestText: React.Dispatch> + setSearchRequestText: ( + value: string | ((old: string | null) => string | null) | null, + options?: Options | undefined, + ) => Promise mainRoute: string sortFields?: string[] customFilterFields?: CustomFilterFieldsProps diff --git a/apps/schools/domains/common/handlers/paginationChange.ts b/apps/schools/domains/common/handlers/paginationChange.ts new file mode 100644 index 00000000..bbd0217c --- /dev/null +++ b/apps/schools/domains/common/handlers/paginationChange.ts @@ -0,0 +1,43 @@ +export const handlePaginationChange = ( + setPaginationParams: (params: { page: number; pageSize: number }) => void, + setQueryPaginationParams: (params: { [key: string]: { page: number; pageSize: number } }) => void, + counts: { [key: string]: number | undefined }, + newPage: number, + newPageSize: number, + defaultPaginationTablePage: number, + defaultPaginationTablePageSize: number, + scrollToTop: () => void, +) => { + setPaginationParams({ + page: newPage, + pageSize: newPageSize, + }) + + const newQueryParams: { [key: string]: { page: number; pageSize: number } } = {} + + let currentPage = newPage + let currentOffset = 0 + + Object.keys(counts).forEach((key, index) => { + const count = counts[key] ?? 0 + const maxPages = Math.ceil(count / newPageSize) + + if (currentPage <= maxPages) { + newQueryParams[key] = { + page: currentPage, + pageSize: newPageSize, + } + } else { + currentPage -= maxPages + newQueryParams[key] = { + page: defaultPaginationTablePage, + pageSize: defaultPaginationTablePageSize, + } + } + + currentOffset += count + }) + + setQueryPaginationParams(newQueryParams) + scrollToTop() +} diff --git a/apps/schools/domains/common/redux/serializers.ts b/apps/schools/domains/common/redux/serializers.ts index 6165fb90..b16df007 100644 --- a/apps/schools/domains/common/redux/serializers.ts +++ b/apps/schools/domains/common/redux/serializers.ts @@ -125,10 +125,10 @@ interface GetStudentProfile { id?: string name: string age?: number - phone?: string + phone: string photo: GetPhoto parent_names?: string - parent_phones?: string + parent_phones: string } export interface GetAnalytics { diff --git a/apps/schools/domains/common/utils/getTotalPages.ts b/apps/schools/domains/common/utils/getTotalPages.ts new file mode 100644 index 00000000..7ebaea31 --- /dev/null +++ b/apps/schools/domains/common/utils/getTotalPages.ts @@ -0,0 +1,5 @@ +export const getTotalPages = (counts: { [key: string]: { count: number | undefined } }, pageSize: number) => { + return Object.keys(counts).reduce((total, key) => { + return total + Math.ceil((counts[key].count ?? 0) / pageSize) * pageSize + }, 0) +} diff --git a/apps/schools/domains/employee/components/createEmployeeForm/index.tsx b/apps/schools/domains/employee/components/createEmployeeForm/index.tsx index 01834f6a..239b47e1 100644 --- a/apps/schools/domains/employee/components/createEmployeeForm/index.tsx +++ b/apps/schools/domains/employee/components/createEmployeeForm/index.tsx @@ -7,9 +7,7 @@ import { useCreateEmployeeFormValidators } from './hooks' import { useInviteEmployeeMutation } from '@domains/organization/redux/organizationApi' import { useOrganization } from '@domains/organization/providers/organizationProvider' import { handleSubmitForm } from '@domains/employee/handlers/employeeCreate' -import router, { useRouter } from 'next/router' -import { WithTooltip } from '@domains/common/components/tooltip/withTooltip' -import { TOOLTIP_MARGIN } from '@domains/employee/components/createEmployeeForm/styles/styles' +import { useRouter } from 'next/router' import { isValidFormCheck } from '@domains/common/utils/form' import { EMPLOYEE_EMAIL, @@ -45,55 +43,42 @@ export const CreateEmployeeForm = () => { }} layout='vertical' > - Добавление Сотрудника - - - * Телефон сотрудника - - } - name={EMPLOYEE_PHONE} - className={styles.label} - rules={validators.phone} - > - - - + Добавление сотрудника + + * Телефон сотрудника + + } + name={EMPLOYEE_PHONE} + className={styles.label} + rules={validators.phone} + > + + - - - * Ф. И. О. сотрудника - - } - name={EMPLOYEE_NAME} - className={styles.label} - rules={validators.name} - > - - - + + * Ф. И. О. сотрудника + + } + name={EMPLOYEE_NAME} + className={styles.label} + rules={validators.name} + > + + - - - - - + + + - - - - - + + + diff --git a/apps/schools/domains/user/components/profile/profileInfo/styles/styles.module.scss b/apps/schools/domains/user/components/profile/profileInfo/styles/styles.module.scss index 4aa3a70c..972ae767 100644 --- a/apps/schools/domains/user/components/profile/profileInfo/styles/styles.module.scss +++ b/apps/schools/domains/user/components/profile/profileInfo/styles/styles.module.scss @@ -17,3 +17,11 @@ } } } + +.editButton { + margin-top: 30px; +} + +.organizationContainer { + margin-top: 60px; +} diff --git a/apps/schools/domains/user/handlers/auth/register.ts b/apps/schools/domains/user/handlers/auth/register.ts index 648de720..f237cff9 100644 --- a/apps/schools/domains/user/handlers/auth/register.ts +++ b/apps/schools/domains/user/handlers/auth/register.ts @@ -80,14 +80,14 @@ export async function registrationHandler( password: string, userRegistrationMutation: any, onError: () => void, - formComponent: FormInstance + formComponent: FormInstance, ) { let token = localStorage.getItem('token') const cookies = new Cookies() cookies.remove('jwtToken') - const { email } = formComponent.getFieldsValue(['email']); - const { name } = formComponent.getFieldsValue(['name']); + const { email } = formComponent.getFieldsValue(['email']) + const { name } = formComponent.getFieldsValue(['name']) let response = await withLoadingMessage(LoadingMsg, userRegistrationMutation, { token: token, @@ -109,6 +109,7 @@ export async function registrationHandler( }, ]) } + return response } export async function resendOtpHandler(recaptchaToken: string, resendOtpMutation: any, onError: () => void) { diff --git a/apps/schools/domains/user/providers/authProvider.tsx b/apps/schools/domains/user/providers/authProvider.tsx index ff942eed..996a3623 100644 --- a/apps/schools/domains/user/providers/authProvider.tsx +++ b/apps/schools/domains/user/providers/authProvider.tsx @@ -3,7 +3,6 @@ import { useRouter } from 'next/router' import { useGetUserQuery } from '../redux/authenticationApi' import Cookies from 'universal-cookie' import { GetUserProfiles } from '@domains/user/redux/interfaces' -import { EventKey, useEventBus } from '@domains/common/providers/eventBusProvider' import { AppRoutes, RoutePath } from '@domains/common/constants/routerEnums' export const UserProfileContext = createContext<{ @@ -24,18 +23,13 @@ export const useUserProfile = () => useContext(UserProfileContext) export const AuthProvider: React.FC = ({ children }) => { const router = useRouter() - const { on } = useEventBus() const [token, setToken] = useState('') const [user, setUser] = useState({}) - const { data, error, refetch } = useGetUserQuery({}) + const { data, error } = useGetUserQuery({}) const cookies = new Cookies() useEffect(() => { - const unsubscribeOnRefetchProfileQuery = on(EventKey.RefetchProfileQuery, () => { - refetch() - }) - if (router.pathname === RoutePath[AppRoutes.MOBILE_RECAPTCHA]) return const jwtToken = typeof window !== 'undefined' ? cookies.get('jwtToken') : null @@ -45,10 +39,6 @@ export const AuthProvider: React.FC = ({ children }) => { } else { router.push(RoutePath[AppRoutes.AUTH_SIGN_IN]) } - - return () => { - unsubscribeOnRefetchProfileQuery() - } }, []) useEffect(() => { diff --git a/apps/schools/domains/user/redux/authenticationApi.ts b/apps/schools/domains/user/redux/authenticationApi.ts index 8ecc265d..02038d89 100644 --- a/apps/schools/domains/user/redux/authenticationApi.ts +++ b/apps/schools/domains/user/redux/authenticationApi.ts @@ -9,6 +9,7 @@ const authenticationApi = commonApi.injectEndpoints({ method: 'POST', body: data, }), + invalidatesTags: ['User'], }), logout: build.mutation<{}, {}>({ query: (data) => ({ @@ -16,6 +17,7 @@ const authenticationApi = commonApi.injectEndpoints({ method: 'POST', body: data, }), + invalidatesTags: ['User'], }), getUser: build.query<{ user: GetUserProfiles }, {}>({ query: (data) => ({ @@ -23,6 +25,7 @@ const authenticationApi = commonApi.injectEndpoints({ method: 'GET', data: data, }), + providesTags: ['User'], }), updateUser: build.mutation<{ user: GetUser }, UpdateUserData>({ query: (data) => ({ @@ -30,6 +33,7 @@ const authenticationApi = commonApi.injectEndpoints({ method: 'PATCH', body: data, }), + invalidatesTags: ['User'], }), updatePassword: build.mutation<{}, UpdatePasswordData>({ query: (data) => ({ diff --git a/apps/schools/domains/user/redux/userApi.ts b/apps/schools/domains/user/redux/userApi.ts index 1bf4f97a..2cd03145 100644 --- a/apps/schools/domains/user/redux/userApi.ts +++ b/apps/schools/domains/user/redux/userApi.ts @@ -19,6 +19,7 @@ const userApi = commonApi.injectEndpoints({ method: 'POST', body: data, }), + invalidatesTags: ['User'], }), resetPassword: build.mutation<{}, PasswordReset>({ query: (data) => ({ @@ -53,9 +54,9 @@ const userApi = commonApi.injectEndpoints({ method: 'PATCH', body: { otp: data.otp }, }), - }) + }), }), }) -export const { useTokenMutation, useVerifyMutation, useUsersMutation, useResetPasswordMutation, useResendMutation} = +export const { useTokenMutation, useVerifyMutation, useUsersMutation, useResetPasswordMutation, useResendMutation } = userApi diff --git a/apps/schools/pages/_app.tsx b/apps/schools/pages/_app.tsx index e474bc22..71ee6594 100644 --- a/apps/schools/pages/_app.tsx +++ b/apps/schools/pages/_app.tsx @@ -10,7 +10,8 @@ import Head from 'next/head' import { OrganizationProvider } from '@domains/organization/providers/organizationProvider' import { BaseLayout } from '@domains/common/components/containers/BaseLayoutComponents/BaseLayout' import { LayoutContextProvider } from '@domains/user/providers/baseLayoutProvider' -import { message } from 'antd' +import { ConfigProvider, message } from 'antd' +import ru_RU from 'antd/lib/locale/ru_RU' import { EventBusProvider } from '@domains/common/providers/eventBusProvider' import { AppRoutes, RoutePath } from '@domains/common/constants/routerEnums' @@ -49,17 +50,19 @@ function MyApp({ Component, pageProps }: CustomAppProps): JSX.Element { - - - - Открытые школы - - - - - - - + + + + + Открытые школы + + + + + + + + diff --git a/apps/schools/pages/auth/register.tsx b/apps/schools/pages/auth/register.tsx index 887bc244..88de9f5e 100644 --- a/apps/schools/pages/auth/register.tsx +++ b/apps/schools/pages/auth/register.tsx @@ -5,18 +5,15 @@ import React, { useState } from 'react' import { Dictionary } from '@reduxjs/toolkit' import { ContainerPage } from '../_app' import AuthLayout, { IAuthLayoutProps } from '../../domains/user/components/auth/containers/AuthLayout' -import { FormContainer } from '../../domains/user/components/auth/formContainer' -import { InputPhoneForm } from '../../domains/user/components/auth/sharedForms/InputPhoneForm' -import { TabsAuthAction } from '../../domains/user/components/auth/headerActions' -import { ValidatePhoneForm } from '../../domains/user/components/auth/sharedForms/ValidatePhoneForm' -import { RegisterForm } from '../../domains/user/components/auth/registerForm' -import { CENTRALIZED } from '../../domains/common/components/styles/constantStyles' +import { FormContainer } from '@domains/user/components/auth/formContainer' +import { InputPhoneForm } from '@domains/user/components/auth/sharedForms/InputPhoneForm' +import { TabsAuthAction } from '@domains/user/components/auth/headerActions' +import { ValidatePhoneForm } from '@domains/user/components/auth/sharedForms/ValidatePhoneForm' +import { RegisterForm } from '@domains/user/components/auth/registerForm' +import { CENTRALIZED } from '@domains/common/components/styles/constantStyles' import { Row } from 'antd' -import { - RegistrationDisclaimer, - RegistrationPhoneButtonLabel, -} from '../../domains/user/components/auth/constants/labels' -import { FirebaseReCaptcha } from '../../domains/user/providers/firebaseReCaptchaProvider' +import { RegistrationDisclaimer, RegistrationPhoneButtonLabel } from '@domains/user/components/auth/constants/labels' +import { FirebaseReCaptcha } from '@domains/user/providers/firebaseReCaptchaProvider' import { AppRoutes, RoutePath } from '@domains/common/constants/routerEnums' const RegisterPage: ContainerPage = (props) => { @@ -56,7 +53,7 @@ const RegisterPage: ContainerPage = (props) => { <> (window.location.href = '/')} + onFinish={() => Router.push(RoutePath[AppRoutes.USER_LIST])} onError={() => { setStep('inputPhone') Router.push(RoutePath[AppRoutes.AUTH_REGISTER]) diff --git a/apps/schools/prod.Dockerfile b/apps/schools/prod.Dockerfile index 1f20126f..a526c560 100644 --- a/apps/schools/prod.Dockerfile +++ b/apps/schools/prod.Dockerfile @@ -2,6 +2,7 @@ FROM node:18-alpine AS runner RUN node -v +ENV NODE_OPTIONS="--max-old-space-size=4096" ENV NODE_TLS_REJECT_UNAUTHORIZED=0 ENV NODE_ENV production ENV NEXT_TELEMETRY_DISABLED 1 diff --git a/apps/schools/store/commonApi.ts b/apps/schools/store/commonApi.ts index 257c4acb..908a4fff 100644 --- a/apps/schools/store/commonApi.ts +++ b/apps/schools/store/commonApi.ts @@ -43,6 +43,15 @@ export const commonApi = createApi({ return headers }, }) as BaseQueryFn, - tagTypes: ['Circle', 'Student', 'StudentJoinCircleQuery', 'Organization', 'Employee', 'Ticket', 'TicketComments'], + tagTypes: [ + 'Circle', + 'Student', + 'StudentJoinCircleQuery', + 'Organization', + 'Employee', + 'Ticket', + 'TicketComments', + 'User', + ], endpoints: (_) => ({}), }) diff --git a/apps/schools/store/middlewares.ts b/apps/schools/store/middlewares.ts index 26ab2c8c..a698e4c0 100644 --- a/apps/schools/store/middlewares.ts +++ b/apps/schools/store/middlewares.ts @@ -23,6 +23,7 @@ const errorCodes: ErrorCodes = { 403: 'Недостаточно прав для выполнения операции. Обратитесь к администратору для получения необходимых разрешений', 404: 'Объект не найден. Пожалуйста, убедитесь, что указанный ресурс существует и повторите запрос', 429: 'Слишком много попыток. Пожалуйста, подождите некоторое время и повторите запрос позже', + 500: 'Сервер обнаружил внутреннюю ошибку и не смог выполнить запрос. Пожалуйста, повторите попытку позже', } interface Action {