From b5ec4ccbcd18557ffd9b1e334bde8f4adf291ddd Mon Sep 17 00:00:00 2001 From: smanylov Date: Mon, 23 Mar 2026 14:07:44 +0700 Subject: [PATCH] continue: change local check button design --- src/app/styles/pages-styles.scss | 35 +++++++++++++++++++ src/app/ui/header/local-file-check.tsx | 47 ++++++++++++++++---------- src/i18n/messages/en.json | 5 ++- src/i18n/messages/ru.json | 5 ++- 4 files changed, 73 insertions(+), 19 deletions(-) diff --git a/src/app/styles/pages-styles.scss b/src/app/styles/pages-styles.scss index 3657237..85912fd 100644 --- a/src/app/styles/pages-styles.scss +++ b/src/app/styles/pages-styles.scss @@ -3911,6 +3911,7 @@ display: flex; align-self: center; gap: 5px; + &.image { svg { color: v.$color-image; @@ -4881,4 +4882,38 @@ .local-file-check-result { cursor: pointer; } + + + .btn-check-file { + color: v.$p-color; + cursor: pointer; + background: v.$white; + border: 2px solid v.$p-color; + border-radius: 20px; + align-items: center; + gap: 6px; + min-width: 110px; + padding: 8px 12px; + font-size: 12px; + font-weight: 600; + transition: all .3s; + display: flex; + box-shadow: 0 10px 40px v.$shadow-1; + opacity: 0.8; + + &:hover { + box-shadow: 0 5px 5px v.$shadow-1; + opacity: 1; + } + } + + .local-file-check-link { + color: v.$p-color; + font-weight: 600; + margin-left: 5px; + + &:hover { + text-decoration: underline; + } + } } \ No newline at end of file diff --git a/src/app/ui/header/local-file-check.tsx b/src/app/ui/header/local-file-check.tsx index 91d371e..74fa1d3 100644 --- a/src/app/ui/header/local-file-check.tsx +++ b/src/app/ui/header/local-file-check.tsx @@ -8,6 +8,7 @@ import { fileUpload, chunkUpload, checkChunkStatus } from '@/app/actions/fileUpl import { getFileType } from '@/app/lib/getFileType'; import { searchUserFiles } from '@/app/actions/searchActions'; import { toast } from 'sonner'; +import Link from 'next/link'; interface SelectedFile { file: File; @@ -35,6 +36,7 @@ export default function LocalFileCheck() { const [fileId, setFileId] = useState(null); const [searchResult, setSearchResult] = useState(null); const isCancelledRef = useRef(false); + const [fileLink, setFileLink] = useState(null); const childRef = useRef(null); @@ -212,6 +214,7 @@ export default function LocalFileCheck() { const handlerSearchUserFile = useCallback(async (fileId: string, fileName: string): Promise => { + setFileLink(null); try { let result = await searchUserFiles(fileId); @@ -221,25 +224,22 @@ export default function LocalFileCheck() { } if (result?.content?.length) { - result.content.some((e: any) => { + result.content.some((e: { + status: string, + fileId: string + }) => { if (e.status === 'PROTECTED') { - toast.success(t('file-file-name-already-exists', { - fileName: fileName - })); - setSearchResult(t('file-file-name-already-exists', { - fileName: fileName - })); + console.log(e); + toast.success(t('file-is-protected')); + setSearchResult(t('file-is-protected')); + setFileLink(e.fileId); return true; } return false; }); } else { - toast.warning(t('file-file-name-does-not-exist', { - fileName: fileName - })); - setSearchResult(t('file-file-name-does-not-exist', { - fileName: fileName - })); + toast.warning(t('no-similar-files-title')); + setSearchResult(t('no-similar-files-title')); } } catch (error) { @@ -250,7 +250,9 @@ export default function LocalFileCheck() { } } - }, [fileId]) + }, [fileId]); + + /* fileLink, setFileLink */ return (
) diff --git a/src/i18n/messages/en.json b/src/i18n/messages/en.json index b6530e8..305bb81 100644 --- a/src/i18n/messages/en.json +++ b/src/i18n/messages/en.json @@ -355,7 +355,10 @@ "request-payment": "Request payment", "amount-to-be-withdrawn": "Amount to be withdrawn", "payment-method": "Payment method", - "payment-history": "Payment history" + "payment-history": "Payment history", + "file-verification": "File verification", + "file-is-protected": "The file is protected.", + "read-more": "Read more" }, "Login-register-form": { "and": "and", diff --git a/src/i18n/messages/ru.json b/src/i18n/messages/ru.json index 0d5b393..ca36b48 100644 --- a/src/i18n/messages/ru.json +++ b/src/i18n/messages/ru.json @@ -355,7 +355,10 @@ "request-payment": "Запросить выплату", "amount-to-be-withdrawn": "Сумма к выводу", "payment-method": "Способ выплаты", - "payment-history": "История выплат" + "payment-history": "История выплат", + "file-verification": "Проверка файла", + "file-is-protected": "Файл защищен.", + "read-more": "Подробнее" }, "Login-register-form": { "and": "и",