From a9599d8a1faecddb35fd6f68faa89a015ef0f37a Mon Sep 17 00:00:00 2001 From: smanylov Date: Thu, 4 Jun 2026 14:56:03 +0700 Subject: [PATCH] add more appeal information for modal window --- package.json | 2 +- .../components/tanstak-table/TanstakTable.tsx | 20 ++- src/app/styles/pages-styles.scss | 38 +++++ .../file-appeal-modal-window.tsx | 143 ++++++++++++++---- src/i18n/messages/en.json | 10 +- src/i18n/messages/ru.json | 10 +- 6 files changed, 183 insertions(+), 40 deletions(-) diff --git a/package.json b/package.json index 4c239cc..2a6db39 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "no-copy-frontend", - "version": "0.120.0", + "version": "0.121.0", "private": true, "scripts": { "dev": "next dev -p 2999", diff --git a/src/app/components/tanstak-table/TanstakTable.tsx b/src/app/components/tanstak-table/TanstakTable.tsx index d0d24e5..a26d962 100644 --- a/src/app/components/tanstak-table/TanstakTable.tsx +++ b/src/app/components/tanstak-table/TanstakTable.tsx @@ -33,7 +33,7 @@ import Link from 'next/link'; import { SelectedFilesAction } from '@/app/components/tanstak-table/SelectedFilesActions'; import Image from 'next/image'; import { filePermisionChange } from '@/app/actions/trackingActions'; -import {FileAppealModalWindow} from '@/app/ui/modal-windows/file-appeal-modal-window'; +import { FileAppealModalWindow } from '@/app/ui/modal-windows/file-appeal-modal-window'; export type FileItem = { id: string; @@ -68,9 +68,22 @@ type ApiFile = { thumbnailFileUrl: string; permissions: { DOWNLOAD: boolean; - } + }, + appealInfos: AppealInfos[]; }; +export type AppealInfos = { + additionalInfo: string | null; + adminComment: null; + appealId: string | null; + appealReason: string | null; + createdAt: string | null; + fileId: string | null; + fileName: string | null; + resolvedAt: string | null; + status: string; +} + type ApiResponse = { files?: ApiFile[]; total_count: number; @@ -709,11 +722,10 @@ export default function TanstakFilesTable({ fileType, showFileLink }: { fileType }; const handleAppeal = async (file: FileItem) => { - console.log(file); setOpenWindowChildren(() => { return ( - + ) }) setOpenWindow(true); diff --git a/src/app/styles/pages-styles.scss b/src/app/styles/pages-styles.scss index 720c77f..36882b1 100644 --- a/src/app/styles/pages-styles.scss +++ b/src/app/styles/pages-styles.scss @@ -3805,6 +3805,10 @@ min-width: 400px; width: 100%; + &.appeal-info { + margin-bottom: 20px; + } + @media (max-width: 470px) { min-width: auto; } @@ -3936,6 +3940,40 @@ opacity: 0.5; cursor: not-allowed; } + + .appeal-info { + margin-bottom: 20px; + } + + .appeal-status { + display: inline-block; + background-color: #f9fafb; + padding: 4px 12px; + border-radius: 20px; + font-size: 12px; + font-weight: 500; + } + + .appeal-reason-text, + .appeal-additional-text, + .admin-comment-text { + background-color: #f9fafb; + padding: 12px; + border-radius: 6px; + line-height: 1.5; + white-space: pre-wrap; + word-wrap: break-word; + } + + .appeal-warning { + margin-top: 15px; + padding: 12px; + background-color: #fef3c7; + border-left: 4px solid #d97706; + border-radius: 6px; + color: #78350f; + font-size: 14px; + } } } } diff --git a/src/app/ui/modal-windows/file-appeal-modal-window.tsx b/src/app/ui/modal-windows/file-appeal-modal-window.tsx index e0afede..23b502f 100644 --- a/src/app/ui/modal-windows/file-appeal-modal-window.tsx +++ b/src/app/ui/modal-windows/file-appeal-modal-window.tsx @@ -1,15 +1,16 @@ 'use client'; -import { convertBytes } from '@/app/lib/convertBytes'; import { formatDate, formatDateTime } from '@/app/lib/formatDate'; import { useTranslations } from 'next-intl'; import { FileDetails } from '@/app/[locale]/pages/file/[id]/page'; import { FileAnAppeal } from '@/app/actions/fileEntity'; import { useState } from 'react'; import { toast } from 'sonner'; +import { AppealInfos } from '@/app/components/tanstak-table/TanstakTable'; -export function FileAppealModalWindow({ fileId, setWindowClose, setWindowChildren }: { +export function FileAppealModalWindow({ fileId, appeal, setWindowClose, setWindowChildren }: { fileId: string, + appeal?: AppealInfos[], setWindowClose: any, setWindowChildren: any }) { @@ -17,6 +18,8 @@ export function FileAppealModalWindow({ fileId, setWindowClose, setWindowChildre const [appealReason, setAppealReason] = useState(''); const [additionalInfo, setAdditionalInfo] = useState(''); const [isSubmitting, setIsSubmitting] = useState(false); + const existingAppeal = appeal && appeal.length > 0 ? appeal[0] : null; + const hasActiveAppeal = existingAppeal && existingAppeal.status === 'pending'; const handleSubmitAppeal = async () => { if (!appealReason.trim()) { @@ -49,40 +52,114 @@ export function FileAppealModalWindow({ fileId, setWindowClose, setWindowChildre return (
- {/* Форма подачи апелляции */} -
-
-

{t('file-an-appeal')}

-
+ {existingAppeal && ( +
+
+

{t('appeal-information')}

+
-
-
- {t('appeal-reason')} * +
+
{t('appeal-status')}
+
+ + {existingAppeal.status} + +
-
-