diff --git a/package.json b/package.json index ffcbaa5..428aacd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "no-copy-frontend", - "version": "0.94.0", + "version": "0.95.0", "private": true, "scripts": { "dev": "next dev -p 2999", diff --git a/src/app/[locale]/pages/violations/page.tsx b/src/app/[locale]/pages/violations/page.tsx index 813e4fc..f817ee3 100644 --- a/src/app/[locale]/pages/violations/page.tsx +++ b/src/app/[locale]/pages/violations/page.tsx @@ -18,11 +18,12 @@ export default function Page() { +
- + ) } \ No newline at end of file diff --git a/src/app/hooks/react-query/useFileViolations.ts b/src/app/hooks/react-query/useFileViolations.ts index 0f0aa9e..7c8e07f 100644 --- a/src/app/hooks/react-query/useFileViolations.ts +++ b/src/app/hooks/react-query/useFileViolations.ts @@ -10,16 +10,18 @@ export interface ViolationFileDetail { status: string; created_date: string; file_id: string; + country: string; + country_code: string; } interface ViolationFile { - violations: ViolationFileDetail[], - total_elements: number, - total_pages: number, - current_page: number, - page_size: number, - has_next: boolean, - has_previous: boolean + violations: ViolationFileDetail[]; + total_elements: number; + total_pages: number; + current_page: number; + page_size: number; + has_next: boolean; + has_previous: boolean; } export const useFileViolations = (id: string, page: number, status?: string) => { diff --git a/src/app/styles/violation-details.scss b/src/app/styles/violation-details.scss index cdaf1e3..aac4854 100644 --- a/src/app/styles/violation-details.scss +++ b/src/app/styles/violation-details.scss @@ -500,7 +500,7 @@ &-right-side { display: flex; flex-direction: column; - justify-content: space-between; + justify-content: start; overflow: hidden; } @@ -864,7 +864,7 @@ .note-form-flex { display: flex; - gap: 10px; + gap: var(--violation-info-indents); width: 100%; /* justify-content: space-between; */ } @@ -922,7 +922,7 @@ box-sizing: border-box; padding: 0px; border-radius: 8px; - margin-bottom: 10px; + margin-bottom: var(--violation-info-indents); overflow: hidden; width: 100%; diff --git a/src/app/ui/file-page/violation-table/file-page-violation-info.tsx b/src/app/ui/file-page/violation-table/file-page-violation-info.tsx index 59003a8..7e0ca88 100644 --- a/src/app/ui/file-page/violation-table/file-page-violation-info.tsx +++ b/src/app/ui/file-page/violation-table/file-page-violation-info.tsx @@ -16,6 +16,7 @@ import Image from 'next/image'; import FilePageViolationInfoTabs from '@/app/ui/file-page/violation-table/file-page-violation-info-tabs'; import { createPortal } from 'react-dom'; import { IconContentCopy, IconFollowToLink, IconFullScreen } from '@/app/ui/icons/icons'; +import { useViewport } from '@/app/hooks/useViewport'; export default function FilePageViolationInfo({ selectedViolation }: { selectedViolation: ViolationFileDetail | null }) { const t = useTranslations('Global'); @@ -26,6 +27,7 @@ export default function FilePageViolationInfo({ selectedViolation }: { selectedV const [isModalOpen, setIsModalOpen] = useState(false); const [isHovered, setIsHovered] = useState(false); const [copied, setCopied] = useState(false); + const viewport = useViewport(); const openInNewTab = () => { if (selectedViolation?.url) { @@ -125,6 +127,30 @@ export default function FilePageViolationInfo({ selectedViolation }: { selectedV .catch(); }; + const getMaxLengthByWidth = (): number => { + if (viewport.device === 'MOBILE') return 22; + if (viewport.device === 'TABLET') return 50; + if (viewport.device === 'DESKTOP') return 100; + return 100; + }; + + const cutFileName = (fileName: string) => { + const MAX_FILE_NAME_LENGTH = getMaxLengthByWidth(); + const nameWithoutExtension = fileName.substring(0, MAX_FILE_NAME_LENGTH); + + if (fileName.length <= MAX_FILE_NAME_LENGTH) { + return fileName; + } + + const maxNameLength = MAX_FILE_NAME_LENGTH; + + if (maxNameLength <= 0) { + return '...'; + } + + return nameWithoutExtension.substring(0, maxNameLength) + '...'; + } + return (
- {selectedViolation?.page_title} + {selectedViolation?.page_title ? cutFileName(selectedViolation?.page_title) : '#'}
- - {t('full-link')}: - + {selectedViolation?.country && ( +
+ + {t('country')}: + +
+ {selectedViolation?.country} +
+ )}
setIsHovered(true)} - onMouseLeave={() => setIsHovered(false)} + className="violation-info-source" > - - {selectedViolation?.page_url ? cleanUrlForDisplay(selectedViolation?.page_url) : selectedViolation?.page_url} + + {t('full-link')}: - - setIsHovered(true)} + onMouseLeave={() => setIsHovered(false)} > - - + + {selectedViolation?.page_url ? cutFileName(cleanUrlForDisplay(selectedViolation?.page_url)) : selectedViolation?.page_url} + - - - + + + + + + + +
-
diff --git a/src/app/ui/violations/violations-my-claims.tsx b/src/app/ui/violations/violations-my-claims.tsx index 0e70c9b..d450f7b 100644 --- a/src/app/ui/violations/violations-my-claims.tsx +++ b/src/app/ui/violations/violations-my-claims.tsx @@ -106,13 +106,13 @@ export default function ViolationsMyClaims() {
-
+{/*
{t('text-of-the-case')}:
{item.description} -
+
*/}
{t('date-of-creation')}: {item.createdAt ? `${formatDate(item.createdAt)} ${formatDateTime(item.createdAt)}` : '---'}
diff --git a/src/app/ui/violations/violations-my-complaint.tsx b/src/app/ui/violations/violations-my-complaint.tsx index cbd5029..8ed5e20 100644 --- a/src/app/ui/violations/violations-my-complaint.tsx +++ b/src/app/ui/violations/violations-my-complaint.tsx @@ -102,13 +102,13 @@ export default function ViolationsMyComplaint() {
-
+{/*
{t('text-of-the-complaint')}:
{item.complaint_text} -
+
*/}
diff --git a/src/i18n/messages/en.json b/src/i18n/messages/en.json index 6f20f19..001b9bd 100644 --- a/src/i18n/messages/en.json +++ b/src/i18n/messages/en.json @@ -438,7 +438,8 @@ "day": "day", "week": "week", "month": "month", - "every": "every" + "every": "every", + "country": "Country" }, "Login-register-form": { "and": "and", @@ -578,5 +579,8 @@ "unknow": "Unknown", "user-verification": "User verification", "Status": "Status" + }, + "Countryes": { + } } \ No newline at end of file diff --git a/src/i18n/messages/ru.json b/src/i18n/messages/ru.json index f08b493..0558f78 100644 --- a/src/i18n/messages/ru.json +++ b/src/i18n/messages/ru.json @@ -438,7 +438,8 @@ "day": "день", "week_accusative": "неделю", "month": "месяц", - "every": "каждый" + "every": "каждый", + "country": "Страна" }, "Login-register-form": { "and": "и", @@ -578,5 +579,8 @@ "unknow": "Неизвестно", "user-verification": "Верификация юзера", "Status": "Статус" + }, + "Countryes": { + } } \ No newline at end of file