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}
+
+
-
-
-
-
-
{t('additional-info')}
-
+ )}
+
+ {!hasActiveAppeal && (
+
+
+
{t('file-an-appeal')}
+
+
+
+
+ {t('appeal-reason')} *
+
+
+
+
+
+
+
{t('additional-info')}
+
+
+
+
-
+ )}
);
diff --git a/src/i18n/messages/en.json b/src/i18n/messages/en.json
index c421875..0125296 100644
--- a/src/i18n/messages/en.json
+++ b/src/i18n/messages/en.json
@@ -493,7 +493,15 @@
"enter-additional-info": "Any additional information that may help...",
"submit-appeal": "Submit appeal",
"submitting": "Submitting...",
- "active-appeal-already-exists-for-this-file": "Active appeal already exists for this file"
+ "active-appeal-already-exists-for-this-file": "Active appeal already exists for this file",
+ "appeal-information": "Appeal Information",
+ "appeal-status": "Status",
+ "appeal-created-at": "Created at",
+ "appeal-resolution": "Appeal Resolution",
+ "not-provided": "Not provided",
+ "admin-comment": "Admin Comment",
+ "resolved-at": "Resolved at",
+ "active-appeal-pending-message": "You have an active appeal pending review. Please wait for the admin to respond."
},
"Login-register-form": {
"and": "and",
diff --git a/src/i18n/messages/ru.json b/src/i18n/messages/ru.json
index 85fa625..add804a 100644
--- a/src/i18n/messages/ru.json
+++ b/src/i18n/messages/ru.json
@@ -493,7 +493,15 @@
"enter-additional-info": "Любая дополнительная информация, которая может помочь...",
"submit-appeal": "Отправить апелляцию",
"submitting": "Отправка...",
- "active-appeal-already-exists-for-this-file": "По данному делу уже подана активная апелляция"
+ "active-appeal-already-exists-for-this-file": "По данному делу уже подана активная апелляция",
+ "appeal-information": "Информация об апелляции",
+ "appeal-status": "Статус",
+ "appeal-created-at": "Дата создания",
+ "appeal-resolution": "Результат апелляции",
+ "not-provided": "Не указано",
+ "admin-comment": "Комментарий администратора",
+ "resolved-at": "Дата решения",
+ "active-appeal-pending-message": "У вас есть активная апелляция на рассмотрении. Пожалуйста, дождитесь ответа администратора."
},
"Login-register-form": {
"and": "и",