@@ -1,36 +0,0 @@ -.wrap { - display: flex; - overflow: hidden; - width: 100%; - flex-wrap: wrap; - gap: 20px; - @media (max-width: 766px) { - height: 70vh; - width: 100%; - overflow-y: scroll; - text-align: center; - justify-content: center; - } - div { - margin-right: 10px; - @media (max-width: 766px) { - width: 100%; - } - - .image { - margin:10px auto; - width: 250px; - height: 250px; - border-radius: 15px !important; - } - - @media (max-width: 1700px) { - - } - - @media (max-width: 766px) { - text-align: center; - width: 80%; - } - } -} @@ -1,274 +0,0 @@ -import React, { memo, useEffect, useState } from 'react' -import { Simulate } from 'react-dom/test-utils' -import { Divider, Menu, MenuItem, Typography } from '@mui/material' -import Box from '@mui/material/Box' -import axios from 'axios' -import Image from 'next/image' -import Link from 'next/link' -import { useRouter } from 'next/router' - -import { ContextMenu } from '@/src/features/context-menu/context_menu' -import FullScreenModal from '@/src/features/image-modal/full-screen-modal' -import { useAppSelector } from '@/src/main/store/store' -import { TooltipCustom, useShowData } from '@/src/shared' -import { useAutoScroll } from '@/src/shared/lib/hooks' -import { Message } from '@/src/shared/lib/types/model' - -import styles from './dalle-messages-list.module.scss' -import copy = Simulate.copy -import useContextMenu from '@/src/shared/api/models/useContextMenu' - -interface IDalleMessagesList { - device: 'mobile' | 'desktop' - images: Message[] | null -} - -export const MessagesList: React.FC = memo(({ device, images }) => { - const refScroll = useAutoScroll(images) - const { error, showError } = useShowData() - const [modal, setModal] = useState(false) - const [chosenImage, setChosenImage] = useState('') - const theme = useAppSelector((state) => state.theme.theme) - const [currentMessage, setCurrentMessage] = React.useState() - const { clicked, setClicked, points, setPoints } = useContextMenu() - const router = useRouter() - - const downloadFile = (url: string | null, content: string | undefined) => { - if (url) { - showError('Скачиваем...', false) - fetch(url) - .then((response) => response.blob()) - .then((blob) => { - const url = window.URL.createObjectURL(blob) - const link = document.createElement('a') - link.href = url - const image_name = content?.replaceAll(' ', '_').substring(0, 40) - link.setAttribute('download', `${image_name}`) - document.body.appendChild(link) - link.click() - }) - .catch((error) => { - showError('Что-то пошло не так', true) - }) - } else { - showError('Изображение не найдено', true) - } - } - - const handleClose = () => { - setClicked(false) - } - - return ( - <> - - - - - МОИ ГЕНЕРАЦИИ - - - - {images?.length !== 0 && - Array.isArray(images) && - images.map((message) => { - //@ts-ignore - const isZip = message.file && message.file.includes('.zip') - return ( - { - e.preventDefault() - setClicked(true) - setCurrentMessage(message) - setPoints({ x: e.pageX, y: e.pageY }) - }} - > - {isZip ? ( - - - Эта генерация является архивом - - Скачать - - - - ) : ( - -
{ - setChosenImage(message.file as unknown as string) - setModal(true) - }} - > - {'К -
- 30 ? message.content : ''} - > - - {message?.content !== '""' - ? message?.content.replaceAll('"', '').slice(0, 30) - : 'описание отсутствует'} - {message?.content.length > 30 && '...'} - - -
- )} -
- ) - })} - {/*{clicked && (*/} - {/* */} - {/* {*/} - {/* downloadFile(currentMessage?.file ? currentMessage?.file.toString() : '', currentMessage?.content)*/} - {/* handleClose()*/} - {/* }}*/} - {/* sx={{*/} - {/* fontSize: '16px',*/} - {/* display: 'flex',*/} - {/* gap: '12px',*/} - {/* alignItems: 'center',*/} - {/* color: '#8280FF',*/} - {/* marginBottom: '3px',*/} - {/* '&:hover': {*/} - {/* background: theme === 'dark' ? '#313138' : '#eaeaea',*/} - {/* },*/} - {/* }}*/} - {/* >*/} - {/* */} - {/* */} - {/* */} - {/* Скачать*/} - {/* */} - {/* {*/} - {/* window.open(`${currentMessage?.file ? currentMessage?.file.toString() : ''}`, '_blank')*/} - {/* handleClose()*/} - {/* }}*/} - {/* sx={{*/} - {/* fontSize: '16px',*/} - {/* display: 'flex',*/} - {/* gap: '12px',*/} - {/* alignItems: 'center',*/} - {/* color: '#8280FF',*/} - {/* marginBottom: currentMessage?.content && currentMessage?.content.length > 3 ? '3px' : '',*/} - {/* '&:hover': {*/} - {/* background: theme === 'dark' ? '#313138' : '#eaeaea',*/} - {/* },*/} - {/* }}*/} - {/* >*/} - {/* */} - {/* */} - {/* */} - {/* Открыть в новой вкладке*/} - {/* */} - {/* {currentMessage?.content && currentMessage?.content.length > 3 ? (*/} - {/* {*/} - {/* navigator.clipboard.writeText(currentMessage.content)*/} - {/* handleClose()*/} - {/* }}*/} - {/* sx={{*/} - {/* fontSize: '16px',*/} - {/* display: 'flex',*/} - {/* gap: '12px',*/} - {/* alignItems: 'center',*/} - {/* color: '#8280FF',*/} - {/* '&:hover': {*/} - {/* background: theme === 'dark' ? '#313138' : '#eaeaea',*/} - {/* },*/} - {/* }}*/} - {/* >*/} - {/* */} - {/* */} - {/* */} - {/* Копировать описание*/} - {/* */} - {/* ) : (*/} - {/* <>*/} - {/* )}*/} - {/* */} - {/*)}*/} -
-
- - ) -}) - -MessagesList.displayName = 'DalleMessagesList' @@ -8,7 +8,6 @@ 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 { MessagesList } from './ui/dalle-messages-list/ui/dalle-messages-list' export * from './ui/drawer' export { Error } from './ui/error' export * from './ui/graphics-main-page' @@ -6,7 +6,8 @@ import Link from 'next/link' import FullScreenModal from '@/src/features/image-modal/full-screen-modal' import { useAppSelector } from '@/src/main/store/store' -import { TooltipCustom, useShowData } from '@/src/shared' +import { Success, TooltipCustom, useShowData } from '@/src/shared' +import { useAutoScroll } from '@/src/shared/lib/hooks' import { Message } from '@/src/shared/lib/types/model' import styles from './image-messages-list.module.scss' @@ -18,7 +19,7 @@ interface MessagesList { } export const ImageMessagesList: React.FC = memo(({ device, images }) => { - const { error, showError } = useShowData() + const { error, showError, isError } = useShowData() const [modal, setModal] = useState(false) const [chosenImage, setChosenImage] = useState('') const theme = useAppSelector((state) => state.theme.theme) @@ -27,14 +28,14 @@ export const ImageMessagesList: React.FC = memo(({ device, images const downloadFile = (url: string | null, content: string | undefined) => { if (url) { - showError('Скачиваем...', false) fetch(url) .then((response) => response.blob()) .then((blob) => { const url = window.URL.createObjectURL(blob) const link = document.createElement('a') link.href = url - const image_name = content?.replaceAll(' ', '_').substring(0, 40) + // const image_name = '123' + const image_name = content?.replaceAll(' ', '_').substring(0, 25) link.setAttribute('download', `${image_name}`) document.body.appendChild(link) link.click() @@ -140,7 +141,7 @@ export const ImageMessagesList: React.FC = memo(({ device, images return ( <> - + = memo(({ device, images ) })} - {/*{clicked && (*/} - {/* */} - {/* {*/} - {/* downloadFile(currentMessage?.file ? currentMessage?.file.toString() : '', currentMessage?.content)*/} - {/* handleClose()*/} - {/* }}*/} - {/* sx={{*/} - {/* fontSize: '16px',*/} - {/* display: 'flex',*/} - {/* gap: '12px',*/} - {/* alignItems: 'center',*/} - {/* color: '#8280FF',*/} - {/* marginBottom: '3px',*/} - {/* '&:hover': {*/} - {/* background: theme === 'dark' ? '#313138' : '#eaeaea',*/} - {/* },*/} - {/* }}*/} - {/* >*/} - {/* */} - {/* */} - {/* */} - {/* Скачать*/} - {/* */} - {/* {*/} - {/* window.open(`${currentMessage?.file ? currentMessage?.file.toString() : ''}`, '_blank')*/} - {/* handleClose()*/} - {/* }}*/} - {/* sx={{*/} - {/* fontSize: '16px',*/} - {/* display: 'flex',*/} - {/* gap: '12px',*/} - {/* alignItems: 'center',*/} - {/* color: '#8280FF',*/} - {/* marginBottom: currentMessage?.content && currentMessage?.content.length > 3 ? '3px' : '',*/} - {/* '&:hover': {*/} - {/* background: theme === 'dark' ? '#313138' : '#eaeaea',*/} - {/* },*/} - {/* }}*/} - {/* >*/} - {/* */} - {/* */} - {/* */} - {/* Открыть в новой вкладке*/} - {/* */} - {/* {currentMessage?.content && currentMessage?.content.length > 3 ? (*/} - {/* {*/} - {/* navigator.clipboard.writeText(currentMessage.content)*/} - {/* handleClose()*/} - {/* }}*/} - {/* sx={{*/} - {/* fontSize: '16px',*/} - {/* display: 'flex',*/} - {/* gap: '12px',*/} - {/* alignItems: 'center',*/} - {/* color: '#8280FF',*/} - {/* '&:hover': {*/} - {/* background: theme === 'dark' ? '#313138' : '#eaeaea',*/} - {/* },*/} - {/* }}*/} - {/* >*/} - {/* */} - {/* */} - {/* */} - {/* Копировать описание*/} - {/* */} - {/* ) : (*/} - {/* <>*/} - {/* )}*/} - {/* */} - {/*)}*/}