diff --git a/src/app/[locale]/pages/search/page.tsx b/src/app/[locale]/pages/search/page.tsx index 0910d6e..65f624a 100644 --- a/src/app/[locale]/pages/search/page.tsx +++ b/src/app/[locale]/pages/search/page.tsx @@ -1,4 +1,4 @@ -import SectionSearchFile from '@/app/components/section-search-file'; +import SectionSearchFile from '@/app/ui/search/section-search-file'; export default function Page() { return ( <> diff --git a/src/app/styles/pages-styles.scss b/src/app/styles/pages-styles.scss index 11d314e..c10f9c9 100644 --- a/src/app/styles/pages-styles.scss +++ b/src/app/styles/pages-styles.scss @@ -3125,7 +3125,6 @@ } .global-no-result { - display: none; text-align: center; padding: 60px 20px; background: #f8fafc; @@ -3199,6 +3198,20 @@ } } + .empty-results { + text-align: center; + padding: 60px 20px; + color: #64748b; + + &-hint { + margin-top: 16px; + padding: 12px; + background: #f0f9ff; + border-radius: 8px; + font-size: 14px; + } + } + .results-list { display: flex; flex-direction: column; @@ -3307,9 +3320,8 @@ color: #065f46; } - .badge-high-protection { - background: #ddd6fe; - color: #5b21b6; + .badge-not-protected { + background: v.$b-color-2; } } @@ -3387,6 +3399,14 @@ overflow-y: auto; background: v.$white; + &-wrapper { + display: grid; + grid-template-columns: 1fr 300px; + gap: 20px; + height: 100%; + max-height: 80vh; + } + .image-section { display: flex; align-items: center; diff --git a/src/app/ui/search/file-search-panel.tsx b/src/app/ui/search/file-search-panel.tsx index fbd190b..47dbc0c 100644 --- a/src/app/ui/search/file-search-panel.tsx +++ b/src/app/ui/search/file-search-panel.tsx @@ -5,12 +5,16 @@ import { searchUserFiles, searchGlobalFiles } from '@/app/actions/fileEntity'; export function FileSearchPanel({ fileId, ref }: { fileId: string | null, ref: any }) { const [searchedUserFiles, setSearchedUserFiles] = useState([]); + const [searchedUserFilesShowNull, setSearchedUserFilesShowNull] = useState(false); const [searchedGlobalFiles, setSearchedGlobalFiles] = useState([]); + const [searchedGlobalFilesShowNull, setSearchedGlobalFilesShowNull] = useState(false); useImperativeHandle(ref, () => ({ - doSomething: () => { + clearList: () => { setSearchedUserFiles([]); - setSearchedGlobalFiles([]) + setSearchedGlobalFiles([]); + setSearchedUserFilesShowNull(false); + setSearchedGlobalFilesShowNull(false); } })); @@ -22,6 +26,8 @@ export function FileSearchPanel({ fileId, ref }: { fileId: string | null, ref: a if (result.content.length) { setSearchedUserFiles(result.content); + } else { + setSearchedUserFilesShowNull(true); } } catch (error) { @@ -35,6 +41,8 @@ export function FileSearchPanel({ fileId, ref }: { fileId: string | null, ref: a let result = await searchGlobalFiles(fileId); if (result.images.length) { setSearchedGlobalFiles(result.images); + } else { + setSearchedGlobalFilesShowNull(true); } } catch (error) { @@ -62,7 +70,29 @@ export function FileSearchPanel({ fileId, ref }: { fileId: string | null, ref: a {(searchedUserFiles.length !== 0) && ( + )} + {searchedUserFilesShowNull && ( +
+
+
Результаты поиска
+
+ Найдено файлов: {searchedUserFiles.length} +
+
+
+

Похожих файлов не найдено

+

В вашей библиотеке нет файлов, похожих на загруженный

+
+ Совет: Убедитесь, что вы загружали этот файл ранее через страницу "Маркировка" +
+
+ +
)}
-
-
-

Похожие изображения в интернете не найдены

-

Это может означать, что ваше изображение уникально и не используется на других сайтах.

-
+ {searchedGlobalFilesShowNull && ( +
+
+

Похожие изображения в интернете не найдены

+

Это может означать, что ваше изображение уникально и не используется на других сайтах.

+
+ )}
Ошибка глобального поиска: diff --git a/src/app/ui/search/searched-user-files-list.tsx b/src/app/ui/search/searched-user-files-list.tsx index 7a30f53..adf9f24 100644 --- a/src/app/ui/search/searched-user-files-list.tsx +++ b/src/app/ui/search/searched-user-files-list.tsx @@ -3,6 +3,7 @@ import { toast } from 'sonner'; import { useState, ReactNode } from 'react'; import { useTranslations } from 'next-intl'; import ModalWindow from '@/app/components/modalWindow'; +import { IconEye, IconDownload } from '@/app/ui/icons/icons'; export function SearchedUserFilesList({ list }: { list: any }) { const [isFileLoading, setIsFileLoading] = useState(false); @@ -53,7 +54,7 @@ export function SearchedUserFilesList({ list }: { list: any }) {
-
+
{list.map((e: any, index: number) => { + console.log(e); return (
- Preview -
- 📄 -
+ {e.url ? ( + Preview + ) : ( +
+ 📄 +
+ )}
-
{e.originalFileName}
- Загружен: - • + Загружен: {e.uploadDate ? e.uploadDate : '#'} • Размер: {convertBytes(e.fileSize)}
@@ -147,31 +151,29 @@ export function SearchedUserFilesList({ list }: { list: any }) {
- - 🛡️ Защищено + + {e.status} - - 🔒 Высокий уровень защиты - -
diff --git a/src/app/components/section-search-file.tsx b/src/app/ui/search/section-search-file.tsx similarity index 98% rename from src/app/components/section-search-file.tsx rename to src/app/ui/search/section-search-file.tsx index bc149aa..aedfbc1 100644 --- a/src/app/components/section-search-file.tsx +++ b/src/app/ui/search/section-search-file.tsx @@ -6,7 +6,7 @@ import { fileUpload, cancelUpload, chunkUpload, checkChunkStatus } from '@/app/a import { useTranslations } from 'next-intl'; import { useNavigationBlocker } from '@/app/hooks/useNavigationBlocker'; import { useQueryClient } from '@tanstack/react-query'; -import { searchUserFiles, removeUserFile, searchGlobalFiles } from '@/app/actions/fileEntity'; +import { removeUserFile } from '@/app/actions/fileEntity'; import { FileSearchPanel } from '@/app/ui/search/file-search-panel'; interface SelectedFile { file: File; @@ -91,7 +91,7 @@ export default function SectionSearchFile({ fileType, allowedExtensions, maxFile if (childRef.current) { //@ts-ignore - childRef.current.doSomething(); + childRef.current.clearList(); } setUploadProgress(0);