@@ -2,8 +2,6 @@ import React from 'react' import { FormControlLabel, Typography } from '@mui/material' import Switch from '@mui/material/Switch' -import { setParams } from '#/app/store/model-parametres-store' -import { useAppDispatch } from '#/app/store/store' import TooltipModelTypes from '#/widgets/filters-gpt/ui/tooltip-model-types' interface IProps { @@ -1,8 +1,9 @@ import React from 'react' import { Typography } from '@mui/material' import Box from '@mui/material/Box' -import TooltipModelTypes from '#/widgets/filters-gpt/ui/tooltip-model-types' + import { CommonTextArea } from '#/shared/ui/common-textarea' +import TooltipModelTypes from '#/widgets/filters-gpt/ui/tooltip-model-types' interface IProps { title: string @@ -2,8 +2,6 @@ import * as React from 'react' import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown' import { MenuItem, Select, SelectChangeEvent, Stack, Typography } from '@mui/material' -import { setParams } from '#/app/store/model-parametres-store' -import { useAppDispatch, useAppSelector } from '#/app/store/store' import { baseColor } from '#/shared/lib/constants/colors' import TooltipModelTypes from '#/widgets/filters-gpt/ui/tooltip-model-types' @@ -1,7 +1,5 @@ import * as React from 'react' -import { setParams } from '#/app/store/model-parametres-store' -import { useAppDispatch } from '#/app/store/store' import { Slider as Sl } from '#/shared' import TooltipModelTypes from '#/widgets/filters-gpt/ui/tooltip-model-types' @@ -1,8 +1,9 @@ import React, { useRef, useState } from 'react' -import Image from 'next/image' import { Box, Tooltip, Typography } from '@mui/material' +import Image from 'next/image' import { getFileTypeIcon, isImageFile } from '#/shared/lib/helpers' + import styles from './load_image.module.scss' const isVideoFile = (file: File) => { @@ -1,7 +1,6 @@ import React from 'react' import { Avatar, Box, Popover, Stack, Typography } from '@mui/material' import Button from '@mui/material/Button' -import axios from 'axios' import Image from 'next/image' import Link from 'next/link' import { useRouter } from 'next/router' @@ -10,12 +9,12 @@ import { signOut } from 'next-auth/react' import styles from '#/app/layout/styles/styles.module.css' import { useAppSelector } from '#/app/store/store' import { TooltipCustom } from '#/shared' -import { useFeatureFlag } from '#/shared/lib/hooks' -import { SvgIcon } from '#/shared/ui/svg' +import { getDaysLeft } from '#/shared/lib/helpers/date-helper' import { declineToken } from '#/shared/lib/helpers/get-token' +import { useFeatureFlag } from '#/shared/lib/hooks' import { IProps } from '#/shared/lib/types/entities' -import { getDaysLeft } from '#/shared/lib/helpers/date-helper' import { SubscriptionDaysBadge } from '#/shared/ui/subscription-days-badge/subscription-days-badge' +import { SvgIcon } from '#/shared/ui/svg' interface InfoBarProps extends IProps {} @@ -5,12 +5,9 @@ import { paramsStore } from '#/app/store/model-parametres-store' import { balanceSlice } from '#/entities/balance' import { userSlice } from '#/entities/user-account' import { chatsReducer } from '#/features/chats/chats-slice' +import modalsReducer from '#/features/modals/model/modals-slice' import { pendingSlice } from '#/features/pending' import { stepperSlice } from '#/features/register-business' -import { copySlice } from '#/features/use-copy/copy-slice' - -import modalsReducer from '#/features/modals/model/modals-slice' - import { notificationSlice } from './notification-slice' import toastReducer from './toast-slice' @@ -23,7 +20,6 @@ export const store = configureStore({ toast: toastReducer, modals: modalsReducer, params: paramsStore.reducer, - copy: copySlice.reducer, loading: pendingSlice.reducer, chats: chatsReducer, }, @@ -1,14 +0,0 @@ -import { Template } from '#/domains/copywrite/proxy/types/template' - -export const emptyTemplate: Template = { - id: 1000, - title: 'Пустой шаблон', - content: '', - keywords: [], - tov: '', - language: '', - resources_urls: [], - picture: '123', - target_audience: '', - description: '', -} @@ -1,6 +0,0 @@ -import { ContentState, EditorState } from 'draft-js' - -export const toEditorState = (text: string) => { - const newContentState = ContentState.createFromText(text) - return EditorState.createWithContent(newContentState) -} @@ -1,12 +0,0 @@ -export interface Template { - id: number - title: string - description: string - picture: string - content: string - target_audience: string - resources_urls: string[] - keywords: string[] - tov: string - language: string -} @@ -1,34 +0,0 @@ -import axios from 'axios' - -import { Template } from '#/domains/copywrite/proxy/types/template' -import { getApiUrl } from '#/shared/lib/constants' -import { Message } from '#/shared/lib/types/model' - -export class CopywriteProxy { - token?: string - - constructor(token: string | undefined) { - this.token = token - } - - static async getGeneration(token?: string): Promise { - const { data } = await axios.get(getApiUrl() + '/copywrite/', { - headers: { Authorization: `Bearer ${token}` }, - }) - return data - } - - static async getTemplates(token?: string): Promise { - const { data } = await axios.get(getApiUrl() + '/copywrite/templates/', { - headers: { Authorization: `Bearer ${token}` }, - }) - return data - } - - static async createTemplates(token?: string): Promise { - const { data } = await axios.post(getApiUrl() + '/copywrite/templates/', { - headers: { Authorization: `Bearer ${token}` }, - }) - return data - } -} @@ -1,44 +0,0 @@ -import React from 'react' -import { Typography } from '@mui/material' - -import { Input, Slider } from '#/shared' - -import { FiltersProps } from './types' - -export function Filters({ - strength, - setStrength, - upscale, - setUpscale, - negative_prompt, - num_inference_steps, - guidance_scale, - setGuidanceScale, - setNegative_prompt, - setSteps, -}: FiltersProps) { - return ( - <> - - - - - Запрос для исключения из генерации - - - ) -} @@ -1,17 +0,0 @@ -import { ChangeEvent } from 'react' - -export interface Setting { - strength: number - upscale: number - negative_prompt: string - num_inference_steps: number - guidance_scale: number -} - -export interface FiltersProps extends Setting { - setStrength: (e: Event, cur: number | number[]) => void - setUpscale: (e: Event, cur: number | number[]) => void - setGuidanceScale: (e: Event, cur: number | number[]) => void - setNegative_prompt: (e: ChangeEvent) => void - setSteps: (e: Event, cur: number | number[]) => void -} @@ -1,57 +0,0 @@ -import React from 'react' -import { Stack, Typography } from '@mui/material' - -import { Input, Slider } from '#/shared' -import { SelectUI } from '#/shared/ui/select' - -import { Filters } from './types' - -const sizes = [128, 256, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960, 1024] - -export function EpicPhotoFilters({ - guidance_scale, - height, - negative_prompt, - num_inference_steps, - num_outputs, - setGuidance_scale, - setHeight, - setNegative_prompt, - setNum_inference_steps, - setNum_outputs, - setWidth, - width, -}: Filters) { - return ( - <> - - - - - - Запрос для исключения из генерации - - - ) -} @@ -1,2 +0,0 @@ -export * from './epic-photo-filters' -export * from './types' @@ -1,20 +0,0 @@ -import { ChangeEvent, ChangeEventHandler } from 'react' -import { SelectChangeEvent } from '@mui/material' - -export interface Setting { - num_outputs: number - negative_prompt: string - width: number - height: number - num_inference_steps: number - guidance_scale: number -} - -export interface Filters extends Setting { - setWidth: (e: SelectChangeEvent) => void - setHeight: (e: SelectChangeEvent) => void - setNum_outputs: (e: Event, cur: number | number[]) => void - setNum_inference_steps: (e: Event, cur: number | number[]) => void - setGuidance_scale: (e: Event, cur: number | number[]) => void - setNegative_prompt: (e: ChangeEvent) => void -} @@ -1,2 +0,0 @@ -export * from './kandinsky-filters' -export * from './types' @@ -1,83 +0,0 @@ -import React from 'react' -import { Box, Typography } from '@mui/material' - -import { Input, Slider, SwitchCustom } from '#/shared' -import { SelectUI } from '#/shared/ui/select' - -import { Filters } from './types' - -export function KandinskyFilters({ - height, - isTranslate, - negativePrompt, - num_outputs, - setHeight, - setNegative_prompt, - setNumber, - setSteps, - setWidth, - steps, - width, - setIsTranslate, -}: Filters) { - return ( - <> - Настройки - - - - - - - - - - - - - - - - Переводить запрос - - - - - - - Запрос для исключения из генерации - - - - - ) -} @@ -1,20 +0,0 @@ -import { ChangeEvent } from 'react' -import { SelectChangeEvent } from '@mui/material' - -export interface Setting { - steps: number - num_outputs: number - width: number - height: number - isTranslate: boolean - negativePrompt: string -} - -export interface Filters extends Setting { - setWidth: (e: SelectChangeEvent) => void - setHeight: (e: SelectChangeEvent) => void - setSteps: (e: Event, cur: number | number[]) => void - setNumber: (e: Event, cur: number | number[]) => void - setNegative_prompt: (e: ChangeEvent) => void - setIsTranslate: () => void -} @@ -1,47 +0,0 @@ -import React from 'react' -import { Typography } from '@mui/material' - -import { Input, Slider } from '#/shared' -import { SelectUI } from '#/shared/ui/select' - -import { FiltersProps } from './types' - -const sizes = [384, 512, 576, 640, 704, 768] - -export function Filters({ - height, - negative_prompt, - num_inference_steps, - num_outputs, - setHeight, - setNegative_prompt, - setNumOutputs, - setSteps, - setWidth, - width, -}: FiltersProps) { - return ( - <> - - - - - Запрос для исключения из генерации - - - ) -} @@ -1,2 +0,0 @@ -export * from './filters' -export * from './types' @@ -1,18 +0,0 @@ -import { ChangeEvent } from 'react' -import { SelectChangeEvent } from '@mui/material' - -export interface Setting { - width: number - height: number - num_outputs: number - negative_prompt: string - num_inference_steps: number -} - -export interface FiltersProps extends Setting { - setWidth: (e: SelectChangeEvent) => void - setHeight: (e: SelectChangeEvent) => void - setNumOutputs: (e: Event, cur: number | number[]) => void - setSteps: (e: Event, cur: number | number[]) => void - setNegative_prompt: (e: ChangeEvent) => void -} @@ -1,8 +1,6 @@ import React, { useState } from 'react' import { Box, TextField, Typography } from '@mui/material' -import axios from 'axios' import dayjs, { Dayjs } from 'dayjs' -import { useRouter } from 'next/navigation' import { useSession } from 'next-auth/react' import { ButtonGray, ButtonUI, Error, InputStyleDark, Loader, Modal } from '#/shared' @@ -1,17 +0,0 @@ -import { accountApi } from '#/shared/api/account-endpoints' - -export const authTelegram = async (email: any, password: any) => { - const user = await accountApi.loginByEmail(email, password) - - if (user !== null) { - ;(window as any).Telegram.WebApp.sendData(user.token.access) - } -} - -export const authTelegramYandex = async (email: any, password: any) => { - const user = await accountApi.loginByEmail(email, password) - - if (user !== null) { - ;(window as any).Telegram.WebApp.sendData(user.token.access) - } -} @@ -1 +0,0 @@ -export { authTelegram } from './model/auth' @@ -1,4 +1,4 @@ -import axios, { AxiosResponse } from 'axios' +import axios from 'axios' import { getApiUrl } from '#/shared/lib/constants' @@ -1,4 +1,4 @@ -import axios, { AxiosResponse } from 'axios' +import axios from 'axios' import { getApiUrl } from '#/shared/lib/constants' @@ -1,4 +1,4 @@ -import axios, { AxiosResponse } from 'axios' +import axios from 'axios' import { getApiUrl } from '#/shared/lib/constants' @@ -1,4 +1,4 @@ -import axios, { AxiosResponse } from 'axios' +import axios from 'axios' import { getApiUrl } from '#/shared/lib/constants' @@ -2,7 +2,6 @@ import React, { useState } from 'react' import { Box, Typography } from '@mui/material' import axios from 'axios' import { Dayjs } from 'dayjs' -import { useRouter } from 'next/navigation' import { useSession } from 'next-auth/react' import { ButtonGray, ButtonUI, Error, Loader, Modal } from '#/shared' @@ -1,4 +1,3 @@ -import { useSession } from 'next-auth/react' import { changePassword } from '../api/change-password' import { useState } from 'react' import { getModalById, PLATE_CHANGE_PASSWORD } from '#/features/modals' @@ -1,32 +0,0 @@ -import React, { ReactNode } from 'react' -import { Menu, MenuItem } from '@mui/material' - -interface IProps { - children: ReactNode - clicked: boolean - handleClose: () => void - pointY: number - pointX: number -} - -export const ContextMenu = ({ children, pointX, pointY, clicked, handleClose }: IProps) => { - return ( - - {children} - - ) -} @@ -1,6 +1,6 @@ import React from 'react' import { KeyboardArrowLeft, KeyboardArrowRight } from '@mui/icons-material' -import { Box, Button, MobileStepper, Table, TableBody, TableCell, TableHead, TableRow, Typography } from '@mui/material' +import { Box, Button, MobileStepper, Table, TableBody, TableCell, TableRow, Typography } from '@mui/material' import CircularProgress from '@mui/material/CircularProgress' import { TranslateFields } from '#/features/get-admin-stats/lib/constants' @@ -7,11 +7,9 @@ export const useLibrarySwiper = (onSlideFalse: ((...args: any) => any) | undefin const keydown = (e: KeyboardEvent) => { if (e.key === 'ArrowRight') { - // e.preventDefault() slideNext() } if (e.key === 'ArrowLeft') { - // e.preventDefault() slidePrev() } } @@ -1,7 +1,7 @@ import { Message } from '#/entities/message' import { Loader } from '#/shared' import Image from 'next/image' -import React, { useEffect } from 'react' +import React from 'react' import styles from './modal-image.module.scss' @@ -1,74 +0,0 @@ -import React, { Dispatch, SetStateAction, useMemo } from 'react' -import Image from 'next/image' - -import styles from './modal-styles.module.scss' - -interface IProps { - modal: boolean - setModal: Dispatch> - image: string | null -} -export default function FullScreenModal({ modal, setModal, image }: IProps) { - const isSvg = useMemo(() => { - if (!image) return false - return image.includes('.svg') - }, []) - - return ( -
-
-
setModal(false)}> - - - -
-
- {!isSvg && image ? ( - К сожалению, изображение не загрузилось - ) : ( - К сожалению, изображение не загрузилось - )} -
-
- ) -} @@ -1,30 +0,0 @@ -.close_block{ - position: absolute; - z-index: 105; - cursor: pointer; - right: 25px; - top: 25px; -} - -.image_block{ - position: absolute; - padding: 0 20px; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 105; - margin: auto; - width: fit-content; - height: fit-content; -} - -.image_style{ - position: relative; - width: 100%; - height: 100%; - max-width: 960px; - max-height: 700px; - border-radius: 15px; - object-fit: contain; -} \ No newline at end of file @@ -1,5 +1,4 @@ export const PLATE_CHANGE_PASSWORD = 'plate-change-password' -export const RESEND_INVATION_PASSWORD = 'resend-invation-password' export const ERROR_REPORT = 'error-report' export const LOW_BALANCE_OFFER = 'low-balance-offer' export const SUBSCRIPTION_CHANGE_NOTIFICATION = 'subscription-change-notification' @@ -1,7 +1,10 @@ -import '@testing-library/jest-dom' -import { act, fireEvent, screen, waitFor } from '@testing-library/react' +import { fireEvent, screen, waitFor } from '@testing-library/react' + import { jestRender } from '#/../jest/utils/render' import { windowMock } from '#/../jest/utils/window-mock' + +import '@testing-library/jest-dom' + import { ModelInput } from './model-input' jest.mock('next/router') @@ -1,14 +1,15 @@ import React, { FC, useCallback, useEffect, useRef } from 'react' import { TextFieldProps } from '@mui/material/TextField/TextField' -import classes from './model-input.module.scss' -import { PredictPrice } from './predict-price' - import { LoadImage } from '#/app/components/input_components/load_image' import { SendBtn } from '#/app/components/input_components/send_button' import { IModelInputs } from '#/shared/api/models/models' import { useShowDataStore } from '#/shared/lib/hooks/use-show-data' +import { PredictPrice } from './predict-price' + +import classes from './model-input.module.scss' + function buildTypeVersionsMap(inputs: IModelInputs[]): Record { const byType = new Map() for (const item of inputs) { @@ -1,4 +1,4 @@ -import React, { useEffect, useMemo, useRef, useState } from 'react' +import React, { useMemo } from 'react' import { Controller, FormProvider, useForm } from 'react-hook-form' import { SubmitErrorHandler } from 'react-hook-form/dist/types/form' import { Box, TextField, Typography } from '@mui/material' @@ -1,4 +1,4 @@ -import React, { useEffect, useMemo, useState } from 'react' +import React, { useMemo, useState } from 'react' import { Controller, FormProvider, SubmitErrorHandler, useForm } from 'react-hook-form' import { Box, TextField, Typography } from '@mui/material' @@ -1,4 +1,4 @@ -import { Dispatch, SetStateAction, useState, useEffect } from 'react' +import { Dispatch, SetStateAction, useState } from 'react' import { useSession } from 'next-auth/react' import { ResponseGetPersons } from '#/features/invite-person-in-business' @@ -1,23 +0,0 @@ -import { useSession } from 'next-auth/react' -import { resendInvation } from '../api/resend-invation' -import { getModalById, RESEND_INVATION_PASSWORD } from '#/features/modals' -import { useShowDataStore } from '#/shared/lib/hooks/use-show-data' - -export const useResendInvation = () => { - const modal = getModalById(RESEND_INVATION_PASSWORD) - const { showMessage } = useShowDataStore() - const { data } = useSession() - - const resend = async () => { - const response = await resendInvation(modal.getStoreProperty('email')!, data?.access) - - if (response.status == 200) { - showMessage('Приглашение переотправлено!', 'success') - modal.setState(false) - } else { - showMessage(response.data) - } - } - - return [resend] -} @@ -1,4 +0,0 @@ -interface ResponseResendInvation { - data: any, - status: number -} \ No newline at end of file @@ -1 +0,0 @@ -export * from './resend-invation' \ No newline at end of file @@ -1,27 +0,0 @@ -.container { - padding-bottom: 0; - background-color: #373737; -} - -.modal { - min-width: 450px; - width: 100%; - padding-top: 35px; - - &__buttons { - display: flex; - margin-top: 45px; - gap: 10px; - } - &__header { - margin-bottom: 15px; - font-size: 30px; - font-weight: 600; - letter-spacing: -0.02em; - } - &__message { - font-size: 15px; - color: var(--text-color-main); - width: 70%; - } -} @@ -1,32 +0,0 @@ -import { getModalById, RESEND_INVATION_PASSWORD, PlateTemplate } from '#/features/modals' -import styles from './resend-invation.module.scss' -import React from 'react' -import { CommonButton } from '#/shared/ui/button' -import { CommonInput } from '#/shared/ui/common-input' -import { useResendInvation } from '../lib/use-resend-invation' -import { useShowDataStore } from '#/shared/lib/hooks/use-show-data' - -interface ResendInvationPlateProps {} - -export const ResendInvationPlate = ({}: ResendInvationPlateProps) => { - const modal = getModalById(RESEND_INVATION_PASSWORD) - - const [resend] = useResendInvation() - - return ( - -
-

Переотправить приглашение

-

При переотправке приглашения у сотрудника будет заменен отправленный пароль.

-
- resend()}> - Переотправить - - modal.setState(false)}> - Отмена - -
-
-
- ) -} @@ -1 +0,0 @@ -export * from './ui' \ No newline at end of file @@ -1 +0,0 @@ -export const suggestedMessagesList = ['Что такое орбитальная механика?', 'Как приготовить омлет?', 'Кто такие Фиксики?'] @@ -1,35 +0,0 @@ -import React from 'react' -import { Box, Typography } from '@mui/material' - - -interface ISuggestedMessage { - title: string - sendMessage?: (title: string) => void -} - -const SuggestedMessage: React.FC = ({ title, sendMessage }) => { - return ( - sendMessage!(title)} - sx={{ - boxShadow: '0px 0px 20px rgba(0, 0, 0, 0.05)', - padding: '10px 14px', - backgroundColor: '#3D3D3D', - borderRadius: '8px', - color: '#7F7DF3', - marginTop: 1.5, - cursor: 'pointer', - width: 'fit-content', - '&:hover': { - ' -webkit-transform': 'scale(1.03)', - '-ms-transform': 'scale(1.03)', - ' transform': 'scale(1.03)', - }, - }} - > - {title} - - ) -} - -export default SuggestedMessage @@ -1,33 +0,0 @@ -import React from 'react' -import { Box, Stack, Typography } from '@mui/material' - -import { suggestedMessagesList } from '#/features/send-suggested-message/lib/constants' -import SuggestedMessage from '#/features/send-suggested-message/ui/suggested-message' - -interface IProps { - device: 'mobile' | 'desktop' - sendMessage?: (title: string) => void -} - -export const SuggestedMessages: React.FC = ({ device, sendMessage }) => { - const desktop = device === 'desktop' - - return ( - - Не знаете с чего начать? - Попробуйте, например, вот так: - - {suggestedMessagesList.map((messages) => { - return - })} - - - ) -} @@ -1 +0,0 @@ -export { SuggestedMessages } from '#/features/send-suggested-message/ui/suggested-messages' @@ -1,8 +1,8 @@ -import React, { useEffect } from 'react' +import React 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 { signOut } from 'next-auth/react' interface SlowLoadingProps { } @@ -1,65 +0,0 @@ -//@ts-ignore -import { Options, Step } from 'intro.js' - -export const steps: Step[] = [ - { - element: '.tutorial-chat-gpt', - intro: 'Это рабочее окно. В нем вы сможете отправлять ваши сообщения и просматривать историю чата.', - position: 'left', - title: 'Рабочее окно', - }, - { - element: '.tutorial-input', - intro: 'Вводите сюда свой запрос, в ответ на него ChatGPT предоставит вам нужную информацию.', - position: 'top', - title: 'Сообщения', - }, - { - element: '.tutorial-calc', - intro: 'Этот виджет показывает сколько токенов спишется за ваш текущий запрос.', - position: 'top', - title: 'Сообщения', - }, - { - element: '.tutorial-show-setting', - intro: - 'В виджете фильтров вы можете выбрать тип модели (при наведении на каждую модель отображаются подсказки).' + - ' Обратите внимание на параметры, которые вы можете выставлять самостоятельно (при наведении на них также отображается подсказка).', - position: 'right', - title: 'Фильтры', - }, - { - element: '.t', - intro: 'Для того, чтобы ChatGPT запоминал историю чата и на основании этого давал более точные ответы вы можете добавить сообщения в контекст. Для этого просто нажмите на сообщение. Обратите внимание: в контекст вы должны добавлять только ваши сообщения, а не ответы от ChatGPT. Контекст повышает стоимость запроса !', - position: 'left', - title: 'Что такое контекст?', - }, - { - element: '.tutorial-input', - intro: 'После клика на ВАШЕ соощение оно добавляется в это поле. Чтобы удалить сообщение из контекста также нажмите на него в этом поле. Сейчас в контексте одно сообщение, но вы можете добавлять их сколько угодно. Добавив сообщение в контекст, пишите свой запрос и отправляйте сообщение. Теперь ChatGPT даст лучший ответ на основании ваших предыдущих сообщений.', - position: 'left', - title: 'Контекст', - }, - { - element: '.tutorial-balance.ts', - intro: 'Не забывайте следить за своим балансом. Обратите внимание: измененение модели в фильтрах влияет на стоимость запроса, использование контекста также добавит стоимость запроса.', - position: 'left', - title: 'Баланс', - }, -] - -export const options: Options = { - hidePrev: true, - showBullets: false, - nextLabel: 'Дальше', - prevLabel: 'Предыдущий', - doneLabel: 'Готово', - disableInteraction: true, -} - -export const responseGPT = - 'Для нахождения минимального элемента в массиве предлагаю написать собственную функцию с использованием функции высшего порядка reduce и стандартного метода Math.min():\n' + - '\n' + - 'const numbers = [-94, 87, 12, 0, -67, 32];\n' + - 'const min = (values) => values.reduce((x, y) => Math.min(x, y));\n' + - 'console.log(min(numbers)); // => -94\n' @@ -1,84 +0,0 @@ -import React from 'react' -import { Box, Tooltip, Typography } from '@mui/material' - -import { baseColor } from '#/shared/lib/constants/colors' - -interface ITooltipMy { - begin: () => void - children: React.ReactNode -} - -interface ITooltiptext { - begin: () => void -} -const TooltipText: React.FC = ({ begin }) => { - return ( - - - Как работать с ChatGPT - - - Научитесь работать с ChatGPT за 7 простых шагов! - - - Начать обучение - - - ) -} -const TooltipMy: React.FC = ({ children, begin }) => { - return ( - } - componentsProps={{ - tooltip: { - sx: { - '&.MuiTooltip-tooltip': { - '&.MuiTooltip-tooltipPlacementBottom': { - marginTop: '2px', - }, - '&.MuiTooltip-tooltipPlacementTop': { - marginBottom: '2px', - }, - '&.MuiTooltip-tooltipPlacementLeft': { - marginRight: '24px', - }, - }, - bgcolor: '#2B2828', - borderRadius: '10px', - '& .MuiTooltip-arrow': { - color: '#2B2828', - }, - padding: '15px 20px', - boxShadow: '0px 0px 4px rgba(0, 0, 0, 0.04), 0px 4px 32px rgba(0, 0, 0, 0.16)', - }, - }, - }} - > - {children} - - ) -} - -export default TooltipMy @@ -1,37 +0,0 @@ -import React from 'react' -import { Steps } from 'intro.js-react' -import Image from 'next/image' - -import { TutorialContext } from '../../tutorial-context/tutorial-context' -import { options, steps } from '../lib/constants' - -import TooltipMy from './tooltip' - -export const Tutorial = () => { - const [enabled, setEnabled] = React.useState(false) - - const context = React.useContext(TutorialContext) - const onExit = () => { - setEnabled(false) - } - - return ( - <> - setEnabled(true)}> - {''} - - - { - // @ts-ignore - context?.setStep(e) - }} - options={options} - enabled={enabled} - steps={steps} - onExit={onExit} - initialStep={0} - /> - - ) -} @@ -1 +0,0 @@ -export { Tutorial } from './ui/tutorial' @@ -1,50 +0,0 @@ -import { createAsyncThunk, createSlice } from '@reduxjs/toolkit' - -import { CopywriteProxy } from '#/domains/copywrite/proxy/copywrite-proxy' -import { Template } from '#/domains/copywrite/proxy/types/template' -import { Message } from '#/shared/lib/types/model' - -export interface Theme { - templates: Template[] | null - generation: Message[] | null -} - -const initialState: Theme = { - templates: null, - generation: null, -} - -export const loadTemplates = createAsyncThunk( - 'copywrite/loadTemplates', - async (token?: string): Promise => { - return await CopywriteProxy.getTemplates(token) - } -) - -export const loadGeneration = createAsyncThunk( - 'copywrite/loadGeneration', - async (token?: string): Promise => { - return await CopywriteProxy.getGeneration(token) - } -) - -export const copySlice = createSlice({ - name: 'copySlice', - initialState, - reducers: { - loadTemplates: (state, action) => {}, - }, - extraReducers: (builder) => { - builder - .addCase(loadTemplates.fulfilled, (state, action) => { - state.templates = action.payload - }) - .addCase(loadGeneration.fulfilled, (state, action) => { - state.generation = action.payload - }) - }, -}) - -export const {} = copySlice.actions - -export default copySlice.reducer @@ -1,72 +0,0 @@ -import { Dispatch, SetStateAction, useEffect, useMemo, useState } from 'react' -import { useRouter } from 'next/router' -import { useSession } from 'next-auth/react' - -import { useAppDispatch, useAppSelector } from '#/app/store/store' -import { emptyTemplate } from '#/domains/copywrite/lib/constants' -import { Template } from '#/domains/copywrite/proxy/types/template' -import { loadGeneration, loadTemplates } from '#/features/use-copy/copy-slice' -import { Message } from '#/shared/lib/types/model' - -interface UseCopy { - currentTemplate: Template | null - generations: Message[] | null - pickGeneration: Message | null - setPickGeneration: Dispatch> - createEmpty: () => void -} - -export const useCopy = (): UseCopy => { - const [pickGeneration, setPickGeneration] = useState(null) - - const { data } = useSession() - - const { query, push, pathname } = useRouter() - - const templates = useAppSelector((state) => state.copy.templates) - - const generations = useAppSelector((state) => state.copy.generation) - - const dispatch = useAppDispatch() - - const getId = () => { - const id = query['id'] - - if (id) { - return Number(id) - } - } - - const createEmpty = () => { - setPickGeneration({ - content: '', - uid: '123', - created_at: '123', - file: null, - info: null, - from_model: false, - elapsed_time: '12', - is_favourite: false, - is_sent: false, - }) - } - - useEffect(() => { - if (data?.access) { - dispatch(loadTemplates(data.access)) - dispatch(loadGeneration(data.access)) - } - }, [data?.access]) - - const currentTemplate = useMemo(() => { - const id = getId() - const foundTemplate = templates?.find((el) => el.id === id) - if (foundTemplate) { - return foundTemplate - } - - return emptyTemplate - }, [templates]) - - return { currentTemplate, generations, pickGeneration, setPickGeneration, createEmpty } -} @@ -37,51 +37,10 @@ const getStatistic = async (type: string, interval: string, token?: string) => { } export const useStats = () => { - - // let dataLine = { - // datasets: [ - // { - // fill: true, // Включить заливку под графиком - // backgroundColor: (context: any) => { - // const chart = context.chart - // const { ctx, chartArea } = chart - - // if (!chartArea) { - // // Линейный градиент не применяется, если область графика не доступна - // return null - // } - - // const gradient = ctx.createLinearGradient(chartArea.left, chartArea.bottom, chartArea.left, chartArea.top) - - // gradient.addColorStop(0.68, 'rgba(130, 128, 255, 0.20)') - // gradient.addColorStop(1, 'rgba(130, 128, 255, 0.10)') - - // return gradient - // }, - // borderWidth: 1, // Ширина линии графика - // borderColor: '#8280FF', - // pointRadius: 7, // Размер точек - // pointBackgroundColor: 'white' // Цвет точек - // pointBorderWidth: 1, // Ширина обводки точек - // pointBorderColor: '#8280FF', // Цвет обводки точек - // hoverRadius: 7, // Размер точек при наведении - // hoverBackgroundColor: '#8280FF', // Цвет точек при наведении - // hoverBorderColor: 'white', // Цвет обводки точек при наведении - // }, - // ], - // } - const { data: session } = useSession() const [timeForStats, setTimeForStats] = useState('current_month') - // useEffect(() => { - - // setStatsByDays(prev => { - // return {prev.datasets[0]} - // }) - // },[theme]) - const [statsByModel, setStatsByModels] = useState(dataLine) const [statsByType, setStatsByType] = useState(dataLine) @@ -1,4 +1,3 @@ -import type { Env } from '#/shared/lib/env-types' import { getServerEnv } from '#/shared/lib/server-env' const env = getServerEnv() @@ -1,22 +0,0 @@ -import { useEffect, useState } from 'react' -const useContextMenu = () => { - const [clicked, setClicked] = useState(false) - const [points, setPoints] = useState({ - x: 0, - y: 0, - }) - useEffect(() => { - const handleClick = () => setClicked(false) - document.addEventListener('click', handleClick) - return () => { - document.removeEventListener('click', handleClick) - } - }, []) - return { - clicked, - setClicked, - points, - setPoints, - } -} -export default useContextMenu @@ -1,31 +0,0 @@ -import { Dispatch, SetStateAction, useEffect, useState } from 'react' - -export const useAutoLoad = (desktop: boolean): [boolean, Dispatch>] => { - const [fetching, setFetching] = useState(true) - - useEffect(() => { - const isMobile = desktop ? document : document.getElementById('messages-list') - - const scrollHandler = (e: any) => { - if ( - e.target.documentElement.scrollHeight - (e.target.documentElement.scrollTop + window.innerHeight) < - 100 - ) { - setFetching(true) - } - } - const scrollHandlerMobile = (e: any) => { - if (!desktop && e.target.scrollHeight - (e.target.scrollTop + window.innerHeight) < 100) { - setFetching(true) - } - } - - isMobile?.addEventListener('scroll', desktop ? scrollHandler : scrollHandlerMobile) - - return function () { - isMobile?.removeEventListener('scroll', desktop ? scrollHandler : scrollHandlerMobile) - } - }, [desktop]) - - return [fetching, setFetching] -} @@ -1,16 +0,0 @@ -.badge { - display: inline-block; - padding: 3px 10px; - &_primary{ - color: var(--air-color); - font-weight: 500; - background-color: rgba($color: #8280ff, $alpha: 0.1); - border-radius: 5px; - } - - &_outline{ - color: rgba($color: #A4AAB5, $alpha: 0.6); - border: 1px solid rgba($color: #A4AAB5, $alpha: 0.6); - border-radius: 10px; - } -} \ No newline at end of file @@ -1,18 +0,0 @@ -import React from 'react' -import styles from './common-badge.module.scss' -import { c } from '#/shared/lib/helpers' - -export type CommonBagdeVariant = 'primary' | 'outline' - -interface CommonBagdeProps extends React.HTMLAttributes { - variant?: CommonBagdeVariant - className?: string -} - -export const CommonBagde = ({ variant = 'primary', children, className, ...props }: CommonBagdeProps) => { - return ( -
- {children} -
- ) -} @@ -1 +0,0 @@ -export * from './common-badge' \ No newline at end of file @@ -1 +0,0 @@ -export * from './ui' \ No newline at end of file @@ -1,184 +0,0 @@ -import * as React from 'react' -import Box from '@mui/material/Box' -import CardContent from '@mui/material/CardContent' -import CardMedia from '@mui/material/CardMedia' -import Stack from '@mui/material/Stack' -import Typography from '@mui/material/Typography' -import Image from 'next/image' -import Link from 'next/link' - -import { translateTypeModel } from '#/shared' - -export const Card: React.FC = ({ - uid, - title, - image_link, - link, - languages, - description, - model_config, - device, - addToFavorites, - is_favourite, - deleteFromFavorites, -}) => { - const desktop = device === 'desktop' - - return ( - - - - - - - - {translateTypeModel(model_config.model_type)} - - - {languages.map((lang: any) => { - if (lang === 'Другие') { - return - } - return ( - - {lang} - - ) - })} - - - - {title} - - - {description} - - - - { - e.preventDefault() - deleteFromFavorites(uid) - } - : (e) => { - e.preventDefault() - addToFavorites(uid) - } - } - > - {is_favourite ? ( - {'1'} - ) : ( - {'1'} - )} - - - - - - - ) -} @@ -1,98 +0,0 @@ -import * as React from 'react' -import Box from '@mui/material/Box' -import CardContent from '@mui/material/CardContent' -import CardMedia from '@mui/material/CardMedia' -import Stack from '@mui/material/Stack' -import Typography from '@mui/material/Typography' - -import { translateTypeModel } from '#/shared' -import { Device } from '#/shared/lib/types/entities' - -export const UnActiveCard: React.FC = ({ title, image_link, languages, description, model_config, device }) => { - const desktop = device === 'desktop' - - return ( - - - - - - - {translateTypeModel(model_config.model_type)} - - - - - {title} - - - {description} - - - - - - - ) -} @@ -1,2 +0,0 @@ -export { Card } from './ui/card' -export { UnActiveCard } from './ui/un-active-card' @@ -1,7 +1,7 @@ import { c } from '#/shared/lib/helpers' import { FieldError } from 'react-hook-form' import styles from './common-input.module.scss' -import React, { ForwardedRef, forwardRef, useEffect } from 'react' +import React, { forwardRef } from 'react' export type InputVariant = 'outline' | 'primary' @@ -1,70 +0,0 @@ -.expandableButton { - display: flex; - align-items: center; - justify-content: center; - background-color: white; - border-radius: 100px; - width: 40px; - height: 40px; - box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.1); - transition: width 0.3s ease-in-out; - cursor: pointer; - position: relative; - - &:hover { - width: 140px; - padding: 12px; - - .expandableButton__icon { - opacity: 0; - display: none; - } - - .expandableButton__text { - opacity: 1; - position: absolute; - left: 50%; - top: 50%; - transform: translate(-50%, -50%); - animation: fadein 0.6s ease-in-out; - display: block; - } - } - - &__icon { - color: var(--air-color); - display: flex; - align-items: center; - justify-content: center; - position: absolute; - left: 50%; - top: 50%; - transform: translate(-50%, -50%); - font-weight: 600; - font-size: 14px; - transition: opacity 0.3s ease-in-out; - } - - &__text { - position: absolute; - color: var(--air-color); - font-weight: 500; - font-size: 14px; - opacity: 0; - display: none; - min-width: max-content !important; - white-space: nowrap; - } -} - -@keyframes fadein { - 0% { - opacity: 0; - } - 50% { - opacity: 0; - } - 100% { - opacity: 1; - } -} @@ -1,46 +0,0 @@ -import React from 'react' -import Link from 'next/link' - -import styles from './expandable-button.module.scss' - -interface ExpandableButtonProps { - shortText: string - expandedText: string - href?: string - onClick?: () => void - className?: string -} - -export function ExpandableButton({ - shortText, - expandedText, - href, - onClick, - className -}: ExpandableButtonProps) { - const buttonContent = ( - <> -
- {shortText} -
- {expandedText} - - ) - - if (href) { - return ( - - {buttonContent} - - ) - } - - return ( -
- {buttonContent} -
- ) -} @@ -1 +0,0 @@ -export { ExpandableButton } from './expandable-button' @@ -1,4 +1,3 @@ -import Link from 'next/link' import { CommonButton } from '../../button' import styles from './info-page-template.module.scss' import Image from 'next/image' @@ -1,188 +0,0 @@ -import React, { FC, useMemo, useRef } from 'react' -import { Box, InputAdornment, TextField, Typography } from '@mui/material' -import CircularProgress from '@mui/material/CircularProgress' -import IconButton from '@mui/material/IconButton' -import Stack from '@mui/material/Stack' -import { TextFieldProps } from '@mui/material/TextField/TextField' -import Image from 'next/image' - -import { Calculation } from '#/features/calculation-tokens-gpt' -import { styleInputWithoutBorderFocus } from '#/shared/ui/input' - -interface Input { - loading: boolean - requestImage: () => void - wonderMe?: () => void - desktop: boolean - image?: File | null - count?: number - quality?: string - unpinImage?: () => void - imageLoad?: React.ChangeEventHandler - openFilters: (event: React.MouseEvent) => void -} -export const InputImagesModels: FC = ({ - openFilters, - loading, - requestImage, - value, - image, - onChange, - wonderMe, - desktop, - count, - quality, - imageLoad, - unpinImage, -}) => { - - const isCalculatePrice = useMemo(() => quality && count && desktop, []) - - const ref = useRef(null) - - const LoadImage = () => { - if (!imageLoad || loading) { - return null - } - - if (image) { - return ( - - - {`Изображение ${image.name.slice(0, 9)} загружено! Нажмите чтобы открепить.`} - - - ) - } - - return ( - <> - - (ref.current! as any).click()} - height={23} - width={23} - alt='Загрузка изображения' - className='pointer' - /> - - ) - } - - const WonderMe = () => { - if (!wonderMe || !desktop) { - return null - } - - return Error - } - - const SendBtn = () => { - if (loading) { - return ( - - ) - } - - const src = `/svg/chatgpt/send_message_dark.svg` - - return ( - {'Отправить - ) - } - - return ( - { - if (e.key === 'Enter') { - requestImage() - } - }} - InputLabelProps={{ - style: { - color: '#868686', - lineHeight: '21px', - fontSize: '15px', - fontWeight: '400px', - borderRadius: '13px', - }, - }} - value={value} - onChange={onChange} - InputProps={{ - endAdornment: ( - - - {!desktop && ( - - Error - - )} - - - - - - ), - }} - /> - ) -} @@ -2,7 +2,7 @@ import React from 'react' import { Typography } from '@mui/material' import Box from '@mui/material/Box' -import { PrettoSliderDark } from '#/widgets/filters-gpt/ui/filters' +import { PrettoSliderDark } from '#/widgets/filters-gpt/ui/pretto-slider' export const Slider = ({ value, @@ -1,6 +1,6 @@ import React from 'react' import { styled } from '@mui/material' -import Switch, { SwitchProps } from '@mui/material/Switch' +import Switch from '@mui/material/Switch' import { baseColor } from '#/shared/lib/constants/colors' import { pingFangFont } from '#/shared/lib/constants/font/font' @@ -1,82 +0,0 @@ -import React from 'react' -import { UseFormRegister } from 'react-hook-form/dist/types/form' -import { Box, Checkbox, FormHelperText, Typography } from '@mui/material' -import Link from 'next/link' - -interface ICheckBoxAgreeWithRulesProps { - isAgree?: boolean - changeAgree?: () => void - isAgreeError?: boolean - register?: UseFormRegister - name?: string - isEmailWhite: boolean -} - -export const CheckBoxAgreeWithRules: React.FC = ({ - isAgree, - changeAgree, - isAgreeError, - name, - register, - isEmailWhite, -}) => { - return ( - <> - - - - {' '} - Я соглашаюсь с условиями{' '} - - Политики обработки персональных данных - {' '} - и{' '} - - Публичной офертой - - - - {isAgreeError && ( - - Для продолжения примите соглашение - - )} - - ) -} @@ -1,235 +0,0 @@ -import * as React from 'react' -import { Box, Slider, Stack, Typography } from '@mui/material' -import Checkbox, { checkboxClasses } from '@mui/material/Checkbox' -import FormControlLabel from '@mui/material/FormControlLabel' -import FormGroup from '@mui/material/FormGroup' -import Menu from '@mui/material/Menu' -import MenuItem from '@mui/material/MenuItem' - - -interface IDalleFilterMenu { - anchorEl: null | HTMLElement - open: boolean - closeMenu: Function - format: string - changeFormat: Function - numberImages: number | number[] | undefined - sliderChange: Function -} - -export const DalleFilterMenu: React.FC = ({ - anchorEl, - closeMenu, - format, - changeFormat, - numberImages, - sliderChange, - open, -}) => { - return ( - closeMenu()} - MenuListProps={{ 'aria-labelledby': 'dalle-filter-button' }} - PaperProps={{ - sx: { - backgroundColor: '#151518', - }, - }} - > - - - - Формат - - - - - changeFormat('256x256')} - inputProps={{ - 'aria-label': 'controlled', - }} - sx={{ - [`&, &.${checkboxClasses.checked}`]: { - color: '#7F7DF3', - }, - [`&, &.${!checkboxClasses.checked}`]: { - color: '#7F7DF3', - }, - marginLeft: 2.5, - marginRight: 1, - width: '1em', - height: '1em', - }} - /> - } - label={ - - 256x256 - - } - /> - - - - - changeFormat('512x512')} - inputProps={{ - 'aria-label': 'controlled', - }} - sx={{ - [`&, &.${checkboxClasses.checked}`]: { - color: '#7F7DF3', - }, - [`&, &.${!checkboxClasses.checked}`]: { - color: '#7F7DF3', - }, - marginLeft: 2.5, - marginRight: 1, - width: '1em', - height: '1em', - }} - /> - } - label={ - - 512x512 - - } - /> - - - - - changeFormat('1024x1024')} - inputProps={{ - 'aria-label': 'controlled', - }} - sx={{ - [`&, &.${checkboxClasses.checked}`]: { - color: '#7F7DF3', - }, - [`&, &.${!checkboxClasses.checked}`]: { - color: '#7F7DF3', - }, - marginLeft: 2.5, - marginRight: 1, - width: '1em', - height: '1em', - }} - /> - } - label={ - - 1024x1024 - - } - /> - - - - - - Изображений - - - {numberImages} - - - - - - За одну генерацию - - - - sliderChange(e, current)} - max={10} - min={1} - step={1} - marks - sx={{ - width: '15vh', - color: '#7F7DF3', - marginLeft: 1, - marginRight: 1, - }} - /> - - - - ) -} @@ -1,24 +0,0 @@ -import Stack from '@mui/material/Stack' -import useMediaQuery from '@mui/material/useMediaQuery' - -import { DrawerCustom } from './drawer' - -export function FiltersWrapper(props: { open: boolean; onClose: (value: boolean) => void; filetrs: React.ReactNode }) { - const isDesktop = useMediaQuery('(min-width: 1025px)') - - if (isDesktop) { - return ( - - {props.filetrs} - - ) - } - - return ( - props.onClose(false)}> - - {props.filetrs} - - - ) -} @@ -1,51 +0,0 @@ -import React from 'react' -import { Card, CardMedia } from '@mui/material' -import Stack from '@mui/material/Stack' -import Typography from '@mui/material/Typography' -import { getRandomImage } from '../lib/helpers' - - -export const RandomImage = () => { - const refImage = React.useRef(getRandomImage()) - - return ( - - - - - Midjourney - - - by honeynek - - - - - ) -} @@ -1,33 +0,0 @@ -import { Box, Typography } from '@mui/material' -import Image from 'next/image' -import Link from 'next/link' - -export const TelegramBlock = () => { - return ( - - - Telegram - - Бесплатные токены - - - Получите 5 токенов за подписку на наш телеграм канал! - - - - Подписаться - - - - - ) -} @@ -1,25 +1,20 @@ export { emailOptions, onlyNumbersOption } from './lib/constants/hook-form-options' export { translateTypeModel } from './lib/helpers/model-helpers' -export { useAutoLoad } from './lib/hooks/use-auto-load' export { AccountMenu } from './ui/account-menu' export { Balance } from './ui/balance' export { ButtonUI } from './ui/button/button' export { ButtonGray } from './ui/button/button-gray' -export { CheckBoxAgreeWithRules } from './ui/check-box-agree-with-rules' -export { DalleFilterMenu } from './ui/dalle-filter-menu' export * from './client-only' export * from './ui/drawer' export { Error } from './ui/error' export * from './lib/helpers' export * from './ui/graphics-main-page' export { Input, InputStyleDark, InputStyleLight } from './ui/input' -export { InputImagesModels } from './ui/input-images-models/input-images-models' export { Loader } from './ui/loader/loader' export type { ModalProps } from './ui/modal/modal' export { useConcat } from './lib/helpers' export { Modal } from './ui/modal/modal' export { NotificationMenu } from './ui/notification-menu' -export { RandomImage } from './ui/random-image' export { ReferralBlock } from './ui/referral-block' export { Search } from './ui/search/search' export { SelectUI as Select } from './ui/select' @@ -12,12 +12,12 @@ import { useAppSelector } from '#/app/store/store' import { IModel } from '#/entities/model-entity' import BotParamsMap from '#/features/bot-params/bot-params-map' import { selectCurrentChat } from '#/features/chats/chats-slice' +import { usePredictPrice } from '#/features/predict-price/model/use-predict-price' import Title from '#/features/title/title' import { TutorialContext } from '#/features/tutorial-context/tutorial-context' import { NextPageWithLayout } from '#/pages/_app' import { DrawerCustom, useModel } from '#/shared' import model_api from '#/shared/api/models/api' -import { usePredictPrice } from '#/features/predict-price/model/use-predict-price' import { getDeviceType, getOs } from '#/shared/lib/helpers' import { useShowDataStore } from '#/shared/lib/hooks/use-show-data' import { SvgIcon } from '#/shared/ui/svg' @@ -49,6 +49,7 @@ const Page: NextPageWithLayout = () => { const desktop = deviceType === 'desktop' const { data } = useSession() const router = useRouter() + const { push } = router const currentChat = useAppSelector(selectCurrentChat) @@ -59,8 +60,6 @@ const Page: NextPageWithLayout = () => { const deleteMessageMemo = useCallback(deleteMessage, [currentChat, messages]) - const { push } = useRouter() - React.useEffect(() => { if (data?.access) { model_api.getBotParams(router.asPath.split('/')[2], data.access).then((res) => { @@ -155,10 +154,7 @@ const Page: NextPageWithLayout = () => { }) return true } - // theme removed: always dark - // Подготавливаем данные для API вкладки - // Фильтруем параметры - оставляем только актуальные для текущей версии const filteredParams = useMemo(() => { if (!botParams?.parameters) { return {} @@ -268,7 +268,6 @@ const ImageModelPage: NextPageWithLayout = () => { sx={{ padding: '30px', height: `calc(100dvh - 116px - 61px - 15px ${botParams?.blocked ? '- 17px' : '- 93px'})`, - // height: `calc(100dvh - 116px - 61px - 15px - 23.5px)`, overflowY: 'scroll', overflowX: 'hidden', position: 'relative', @@ -5,7 +5,7 @@ import Button from '@mui/material/Button' import axios from 'axios' import Image from 'next/image' import Router from 'next/router' -import { Error, Input } from '#/shared' +import { Input } from '#/shared' import { getApiUrl } from '#/shared/lib/constants' import { getDeviceType, getRandomImage } from '#/shared/lib/helpers' import { NextPageWithLayout } from '#/pages/_app' @@ -278,7 +278,6 @@ const VideoModelPage: NextPageWithLayout = () => { sx={{ padding: '30px', height: `calc(100dvh - 116px - 61px - 15px ${botParams?.blocked ? '- 17px' : '- 106px'})`, - // height: `calc(100dvh - 116px - 61px - 15px - 23.5px)`, overflowY: 'scroll', overflowX: 'hidden', position: 'relative', @@ -21,7 +21,7 @@ import { getPersons } from '#/widgets/business-persons/api/get-persons' import ArrowUpOrDown from '#/widgets/top-bar-model/ui/arrow-up-or-down' import { translateEmailStatus, formatDateStatus, formatEmail } from '../../lib/lib' -import { getModalById, PLATE_CHANGE_PASSWORD, RESEND_INVATION_PASSWORD } from '#/features/modals' +import { getModalById, PLATE_CHANGE_PASSWORD } from '#/features/modals' import { ResponseGetBusinessGroups } from '#/features/invite-person-in-business/model/types' import { useShowDataStore } from '#/shared/lib/hooks/use-show-data' import { resendInvation } from '#/features/resend-invation-corp/api/resend-invation' @@ -43,7 +43,6 @@ export const PersonsList = ({ const { data: session } = useSession() const passChangeModal = getModalById(PLATE_CHANGE_PASSWORD) - const passResendModal = getModalById(RESEND_INVATION_PASSWORD) useEffect(() => { setPersons(personsList) @@ -9,7 +9,6 @@ import TableCell from '@mui/material/TableCell' import TableContainer from '@mui/material/TableContainer' import TableHead from '@mui/material/TableHead' import TableRow from '@mui/material/TableRow' -import axios, { AxiosResponse } from 'axios' import Image from 'next/image' import { useSession } from 'next-auth/react' @@ -35,10 +34,10 @@ import { Select, } from '#/shared' import { Search } from '#/shared' -// import styles from '#/widgets/business-models/ui/models-list/models-list.module.scss' import { getBusinessGroups } from '#/widgets/business-persons/api/get-businessGroups' import ArrowUpOrDown from '#/widgets/top-bar-model/ui/arrow-up-or-down' -import { getModalById, PLATE_CHANGE_PASSWORD, RESEND_INVATION_PASSWORD } from '#/features/modals' +import { getModalById, PLATE_CHANGE_PASSWORD } from '#/features/modals' +import { resendInvation } from '#/features/resend-invation-corp/api/resend-invation' import { formatDateStatus, formatEmail, translateEmailStatus } from '../../lib/lib' import { XMark } from '#/features/remove-person' @@ -59,7 +58,6 @@ export const SecurityList = ({ const [currentPerson, setCurrentPerson] = useState(null) const passChangeModal = getModalById(PLATE_CHANGE_PASSWORD) - const passResendModal = getModalById(RESEND_INVATION_PASSWORD) useEffect(() => { setPersons(securityList) @@ -82,7 +80,25 @@ export const SecurityList = ({ const [showPersons, setShowPersons] = useState(true) const { showMessage } = useShowDataStore() - const { data } = useSession() + const { data: session } = useSession() + + const handleResendInvation = async (email: string) => { + const response = await resendInvation(email, session?.access) + + if (response.status == 200) { + showMessage('Приглашение переотправлено!', 'success') + setPersons((prev) => + prev?.map((el) => { + if (el.email === email) { + return { ...el, acceptance_status: 'pending' as const } + } + return el + }) ?? null + ) + } else { + showMessage(response.data) + } + } const updateLimit = (limit: string, email?: string) => { setPersons((prev) => @@ -179,11 +195,7 @@ export const SecurityList = ({ {statusPerson === 'Приглашен' ? ( - {showConfigure && ( - <> - - changeTopP(e, current)} - max={1} - min={0} - step={0.1} - aria-label='pretto slider' - /> - - - changePresence(e, current)} - max={2} - min={-2} - step={0.1} - aria-label='pretto slider' - /> - - - )} - - Сбросить настройки - - - - ) : ( - - )} - - ) - } -) - -Filters.displayName = 'Filters' @@ -0,0 +1,51 @@ +import { Slider } from '@mui/material' +import { styled } from '@mui/material/styles' + +export const PrettoSlider = styled(Slider)({ + width: '90%', + color: '#EFF0F2', + height: 5, + '& .MuiSlider-track': { + border: 'none', + backgroundColor: '#EFF0F', + }, + '.MuiSlider-rail': { + border: 'none', + backgroundColor: '#EFF0F', + }, + '& .MuiSlider-thumb': { + height: 17, + width: 17, + backgroundColor: '#fff', + border: '2px solid #7F7DF3', + '&:focus, &:hover, &.Mui-active, &.Mui-focusVisible': { + boxShadow: 'inherit', + }, + '&:before': { + display: 'none', + }, + }, +}) + +export const PrettoSliderDark = styled(Slider)({ + width: '90%', + height: 5, + '& .MuiSlider-track': { + border: 'none', + backgroundColor: '#40404E', + }, + '.MuiSlider-rail': { + border: 'none', + backgroundColor: '#40404E', + }, + '& .MuiSlider-thumb': { + height: 17, + width: 17, + backgroundColor: '#373737', + border: '2px solid #7F7DF3', + '&:focus, &:hover, &.Mui-active, &.Mui-focusVisible': {}, + '&:before': { + display: 'none', + }, + }, +}) @@ -1 +1,4 @@ -export { Filters } from './ui/filters' +export { typeModels } from './lib/constants' +export type { TypeModelGPT } from './lib/constants' +export { PrettoSlider, PrettoSliderDark } from './ui/pretto-slider' +export { default as TooltipModelTypes } from './ui/tooltip-model-types' @@ -1,6 +0,0 @@ -export enum GeneratingModel { - 'stable-diffusion-v1-6', - 'stable-diffusion-xl-1024-v1-0', - 'sd3', - 'sd3-turbo', -} @@ -1,52 +0,0 @@ -import { IProps } from '#/shared/lib/types/entities' -import { Styles } from '#/widgets/filters-sd/ui/filters' - -export type TImageFormat = '512x512' | '640x384' | '384x640' | '768x512' | '512x768' | '1024x1024' -export type TClipGuidancePresets = - | 'FAST_BLUE' - | 'FAST_GREEN' - | 'Без фильтров' - | 'SIMPLE' - | 'SLOW' - | 'SLOWER' - | 'SLOWEST' -export type TSamplerTypes = - | 'DDIM' - | 'DDPM' - | 'K_DPMPP_2M' - | 'K_DPMPP_2S_ANCESTRAL' - | 'K_DPM_2' - | 'K_DPM_2_ANCESTRAL' - | 'K_EULER' - | 'K_EULER_ANCESTRAL' - | 'K_HEUN' - | 'K_LMS' - -export type TGeneratingModel = 'stable-diffusion-v1-6' | 'stable-diffusion-xl-1024-v1-0' | 'sd3' | 'sd3-turbo' - -export interface ISDFilters extends IProps { - formatImage: TImageFormat - stepsImage: number | string | Array - numberImages: number | number[] | undefined - sampleType: TSamplerTypes - samplerTypes: TSamplerTypes[] - cfgScale: number | string | Array - clipGuidancePreset: TClipGuidancePresets - clipGuidancePresets: TClipGuidancePresets[] - formatImages: TImageFormat[] - generatingModel: TGeneratingModel - isTranslate: boolean - style: Styles - - changeFormatImage: (e: TImageFormat) => void - changeClipGuidancePreset: (e: TClipGuidancePresets) => void - changeSampleType: (e: TSamplerTypes) => void - changeStepsImage: (e: Event, current: number | number[]) => void - changeNumberImage: (e: Event, current: number | number[]) => void - changeCfgScale: (e: Event, current: number | number[]) => void - changeGeneratingModel: (e: TGeneratingModel) => void - changeIsTranslate: () => void - changeStyle: (e: Styles) => void - - resetSettings: () => void -} @@ -1,207 +0,0 @@ -import React, { useState } from 'react' -import SettingsSuggestIcon from '@mui/icons-material/SettingsSuggest' -import { Box, Button, Drawer, Stack, Typography } from '@mui/material' - -import { Select, SwitchCustom } from '#/shared' -import { Slider } from '#/shared' -import { SelectUI } from '#/shared/ui/select' -import { PrettoSlider, PrettoSliderDark } from '#/widgets/filters-gpt/ui/filters' -import { GeneratingModel } from '#/widgets/filters-sd/lib/constants' -import { - ISDFilters, - TClipGuidancePresets, - TGeneratingModel, - TImageFormat, - TSamplerTypes, -} from '#/widgets/filters-sd/lib/types' -import { Styles, styles } from '#/widgets/filters-sd/ui/filters' - -interface ISDFiltersMobile extends ISDFilters { - isOpenDrawer: boolean - onCloseDrawer: () => void -} - -export const FiltersMobile: React.FC = ({ - stepsImage, - numberImages, - formatImage, - cfgScale, - clipGuidancePreset, - sampleType, - formatImages, - changeFormatImage, - changeClipGuidancePreset, - clipGuidancePresets, - samplerTypes, - changeSampleType, - changeStepsImage, - changeNumberImage, - changeCfgScale, - resetSettings, - onCloseDrawer, - isOpenDrawer, - isTranslate, - changeIsTranslate, - style, - changeStyle, - generatingModel, - changeGeneratingModel, -}) => { - const [showConfigure, setShowConfigure] = useState(false) - - return ( - - - - - changeClipGuidancePreset(e.target.value as TClipGuidancePresets) - } - list={clipGuidancePresets} - /> - - - -