Binary files /dev/null and b/public/images/not-found.png differ Binary files /dev/null and b/public/images/update-service.png differ @@ -1,14 +1,9 @@ import React from 'react' -import { RegisterOptions } from 'react-hook-form/dist/types/validator' -import { TextField, Typography } from '@mui/material' +import { Typography } from '@mui/material' import Box from '@mui/material/Box' -import { TextFieldProps } from '@mui/material/TextField/TextField' - -import { setParams } from '#/app/store/model-parametres-store' -import { useAppDispatch } from '#/app/store/store' -import { InputStyleDark, InputStyleLight } from '#/shared' import { useThemeAndDevice } from '#/shared/lib/hooks' import TooltipModelTypes from '#/widgets/filters-gpt/ui/tooltip-model-types' +import { CommonTextArea } from '#/shared/ui/common-textarea' interface IProps { title: string @@ -50,15 +45,17 @@ export const InputFilter = ({ filters, item_key, values, title, description, set > {title} - - { + e.target.style.height = 'auto' + e.target.style.height = Math.min(e.target.scrollHeight, 177) + 'px' + setNewParam({ [item_key]: e.target.value }) setValue(e.target.value) }} - fullWidth - sx={theme === 'light' ? { ...InputStyleLight } : { ...InputStyleDark }} /> @@ -1,36 +1,37 @@ import { useAppSelector } from '#/app/store/store' -import { API_URL } from '#/shared/lib/constants' -import axios from 'axios' -import { useSession } from 'next-auth/react' + import React, { ChangeEvent } from 'react' import { sendReport } from '../api' import { makePrivateRequest } from '#/shared/api' import { useShowDataStore } from '#/shared/lib/hooks/use-show-data' +import { useRouter } from 'next/router' + +const MAX_FILE_SIZE = 4.5 * 1024 * 1024 // 4.5 MB export const useErrorReport = () => { + const email = useAppSelector((state) => state.user.email) + const [file, setFile] = React.useState() const { showMessage } = useShowDataStore() const [errorMessage, setErrorMessage] = React.useState('') - const [error, setError] = React.useState(false) const [isSend, setIsSend] = React.useState(false) + const router = useRouter() - const [file, setFile] = React.useState() - - const { data: session } = useSession() - - const email = useAppSelector((state) => state.user.email) + const handleGoBackPage = () => { + router.back() + } const handleFileChange = (e: ChangeEvent) => { if (e.target.files) { - if (4500000 > e.target.files[0].size) setFile(e.target.files[0]) + if (MAX_FILE_SIZE > e.target.files[0].size) setFile(e.target.files[0]) } } const sendError = makePrivateRequest(async () => { if (errorMessage.trim() === '') { - showMessage("Поле не должно быть пустым.") + showMessage('Поле не должно быть пустым.') setError(true) setTimeout(() => setError(false), 3000) return @@ -60,5 +61,6 @@ export const useErrorReport = () => { setFile, sendError, error, + handleGoBackPage, } } @@ -42,7 +42,7 @@ export const ErrorReportPlate = () => { id='file-input' /> @@ -0,0 +1 @@ +export * from './use-loading-logs' \ No newline at end of file @@ -0,0 +1,18 @@ +import { captureMessage } from '@sentry/nextjs' +import { useSession } from 'next-auth/react' + +export function useLoadingLogs() { + const { data } = useSession() + + function onMounted() { + if (!data) return captureMessage(`long time loading - session not defined`) + + const { user } = data + + captureMessage(`long time loading - ${user ? user.email : 'unknown email'} - ${new Date().toDateString()} - ${JSON.stringify(data)}`) + } + + return { + onMounted + } +} @@ -0,0 +1 @@ +export * from './slow-loading' \ No newline at end of file @@ -0,0 +1,33 @@ +.loading { + display: flex; + align-items: center; + justify-content: center; + height: 100dvh; + + &__loader { + margin-bottom: 20px; + } + + &__box { + display: flex; + flex-direction: column; + align-items: center; + max-width: 300px; + + p { + font-weight: 600; + font-size: 26px; + color: var(--air-color); + letter-spacing: 0.06rem; + margin-bottom: 5px; + } + + span { + font-weight: 500; + text-align: center; + font-size: 14px; + color: var(--new-ui-gray-color); + margin-bottom: 20px; + } + } +} @@ -0,0 +1,28 @@ +import React, { useEffect } from 'react' +import styles from './slow-loading.module.scss' +import { Loader } from '#/shared' +import { CommonButton } from '#/shared/ui/button' +import { signOut, useSession } from 'next-auth/react' +import { captureMessage } from '@sentry/nextjs' +import { useLoadingLogs } from '../model' + +interface SlowLoadingProps {} + +export const SlowLoading = ({}: SlowLoadingProps) => { + const { onMounted } = useLoadingLogs() + + useEffect(() => { + onMounted() + }, []) + + return ( +
+ +

Долгая загрузка

+ Предлагаем перезайти + signOut()} variant='primary'> + Выйти + +
+ ) +} @@ -0,0 +1 @@ +export * from './ui' \ No newline at end of file @@ -0,0 +1,9 @@ +import type { NextApiRequest, NextApiResponse } from 'next' + +type ResponseData = { + message: string +} + +export default function handler(req: NextApiRequest, res: NextApiResponse) { + res.status(200).json({ message: 'App is running' }) +} @@ -0,0 +1,11 @@ +import React from 'react' + +interface HealthzProps {} + +export default function Healthz({}: HealthzProps) { + return ( + <> +

Приложение запущено

+ + ) +} @@ -1,3 +1,6 @@ import { NotFoundPage } from '#/views/not-found' +import { getDefaultLayout } from '#/widgets/layouts' + +NotFoundPage.getLayout = getDefaultLayout({ titlePage: 'Страница не найдена' }) export default NotFoundPage @@ -0,0 +1,6 @@ +import ServiceUpdatePage from '#/views/service-update/ui/service-update' +import { getDefaultLayout } from '#/widgets/layouts' + +ServiceUpdatePage.getLayout = getDefaultLayout({ titlePage: 'Обновляемся' }) + +export default ServiceUpdatePage @@ -44,8 +44,7 @@ border: none; outline: none; font-size: 16px; - width: 100%; - font-family: '__Raleway_9d395e' !important; + width: 100%; &:focus { border: none; @@ -56,6 +55,11 @@ font-size: 19px; color: var(--new-ui-text-color) !important; } + &_outline { + font-size: 19px; + color: var(--new-ui-text-color) !important; + max-height: 177px; + } &_error { color: #ff2372 !important; @@ -83,6 +87,21 @@ border-color: var(--border-color); } + &::placeholder { + color: var(--border-color2); + } + } + &_outline { + color: var(--new-ui-text-color) !important; + padding: 16.5px 14px; + border: var(--new-ui-border); + border-width: 2px; + border-radius: 15px; + + &:hover { + border-color: var(--air-color); + } + &::placeholder { color: var(--border-color2) !important; } @@ -95,8 +114,8 @@ color: #ff2372 !important; } - &:focus { - border: 2px solid #ff2372; + &:hover { + border-color: #ff2372 !important; } } } @@ -2,8 +2,9 @@ import { c } from '#/shared/lib/helpers' import { FieldError } from 'react-hook-form' import styles from './common-textarea.module.scss' import React, { ForwardedRef, forwardRef, useEffect } from 'react' +import { Raleway } from 'next/font/google' -export type TextAreaVariant = 'default' +export type TextAreaVariant = 'default' | 'outline' export interface CommonTextAreaProps extends React.TextareaHTMLAttributes { children?: React.ReactNode @@ -12,9 +13,11 @@ export interface CommonTextAreaProps extends React.TextareaHTMLAttributes( ({ showError = true, buttomSlot, label, error, className, disabled, trim = false, variant = 'default', ...props }, ref) => { const onChange = (event: React.ChangeEvent) => { @@ -36,6 +39,7 @@ export const CommonTextArea = forwardRef