add more appeal information for modal window
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "no-copy-frontend",
|
"name": "no-copy-frontend",
|
||||||
"version": "0.120.0",
|
"version": "0.121.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev -p 2999",
|
"dev": "next dev -p 2999",
|
||||||
|
|||||||
@@ -68,9 +68,22 @@ type ApiFile = {
|
|||||||
thumbnailFileUrl: string;
|
thumbnailFileUrl: string;
|
||||||
permissions: {
|
permissions: {
|
||||||
DOWNLOAD: boolean;
|
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 = {
|
type ApiResponse = {
|
||||||
files?: ApiFile[];
|
files?: ApiFile[];
|
||||||
total_count: number;
|
total_count: number;
|
||||||
@@ -709,11 +722,10 @@ export default function TanstakFilesTable({ fileType, showFileLink }: { fileType
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleAppeal = async (file: FileItem) => {
|
const handleAppeal = async (file: FileItem) => {
|
||||||
console.log(file);
|
|
||||||
|
|
||||||
setOpenWindowChildren(() => {
|
setOpenWindowChildren(() => {
|
||||||
return (
|
return (
|
||||||
<FileAppealModalWindow fileId={file.id} setWindowClose={setOpenWindow} setWindowChildren={setOpenWindowChildren} />
|
<FileAppealModalWindow fileId={file.id} appeal={file._original?.appealInfos} setWindowClose={setOpenWindow} setWindowChildren={setOpenWindowChildren} />
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
setOpenWindow(true);
|
setOpenWindow(true);
|
||||||
|
|||||||
@@ -3805,6 +3805,10 @@
|
|||||||
min-width: 400px;
|
min-width: 400px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
&.appeal-info {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 470px) {
|
@media (max-width: 470px) {
|
||||||
min-width: auto;
|
min-width: auto;
|
||||||
}
|
}
|
||||||
@@ -3936,6 +3940,40 @@
|
|||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
cursor: not-allowed;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { convertBytes } from '@/app/lib/convertBytes';
|
|
||||||
import { formatDate, formatDateTime } from '@/app/lib/formatDate';
|
import { formatDate, formatDateTime } from '@/app/lib/formatDate';
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from 'next-intl';
|
||||||
import { FileDetails } from '@/app/[locale]/pages/file/[id]/page';
|
import { FileDetails } from '@/app/[locale]/pages/file/[id]/page';
|
||||||
import { FileAnAppeal } from '@/app/actions/fileEntity';
|
import { FileAnAppeal } from '@/app/actions/fileEntity';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { toast } from 'sonner';
|
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,
|
fileId: string,
|
||||||
|
appeal?: AppealInfos[],
|
||||||
setWindowClose: any,
|
setWindowClose: any,
|
||||||
setWindowChildren: any
|
setWindowChildren: any
|
||||||
}) {
|
}) {
|
||||||
@@ -17,6 +18,8 @@ export function FileAppealModalWindow({ fileId, setWindowClose, setWindowChildre
|
|||||||
const [appealReason, setAppealReason] = useState('');
|
const [appealReason, setAppealReason] = useState('');
|
||||||
const [additionalInfo, setAdditionalInfo] = useState('');
|
const [additionalInfo, setAdditionalInfo] = useState('');
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
|
const existingAppeal = appeal && appeal.length > 0 ? appeal[0] : null;
|
||||||
|
const hasActiveAppeal = existingAppeal && existingAppeal.status === 'pending';
|
||||||
|
|
||||||
const handleSubmitAppeal = async () => {
|
const handleSubmitAppeal = async () => {
|
||||||
if (!appealReason.trim()) {
|
if (!appealReason.trim()) {
|
||||||
@@ -49,7 +52,79 @@ export function FileAppealModalWindow({ fileId, setWindowClose, setWindowChildre
|
|||||||
return (
|
return (
|
||||||
<div className="modal-window-view-file">
|
<div className="modal-window-view-file">
|
||||||
<div className="modal-window-view-file-content">
|
<div className="modal-window-view-file-content">
|
||||||
{/* Форма подачи апелляции */}
|
{existingAppeal && (
|
||||||
|
<div className="file-info-card appeal-info">
|
||||||
|
<div className="info-header">
|
||||||
|
<h4>{t('appeal-information')}</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="info-item">
|
||||||
|
<div className="info-label">{t('appeal-status')}</div>
|
||||||
|
<div className="info-value">
|
||||||
|
<span className="appeal-status">
|
||||||
|
{existingAppeal.status}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="info-item">
|
||||||
|
<div className="info-label">{t('appeal-reason')}</div>
|
||||||
|
<div className="info-value">
|
||||||
|
<div className="appeal-reason-text">
|
||||||
|
{existingAppeal.appealReason || t('not-provided')}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{existingAppeal.additionalInfo && (
|
||||||
|
<div className="info-item">
|
||||||
|
<div className="info-label">{t('additional-info')}</div>
|
||||||
|
<div className="info-value">
|
||||||
|
<div className="appeal-additional-text">
|
||||||
|
{existingAppeal.additionalInfo}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{existingAppeal.createdAt && (
|
||||||
|
<div className="info-item">
|
||||||
|
<div className="info-label">{t('appeal-created-at')}</div>
|
||||||
|
<div className="info-value">
|
||||||
|
{formatDate(existingAppeal.createdAt)} {formatDateTime(existingAppeal.createdAt)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{existingAppeal.adminComment && (
|
||||||
|
<div className="info-item">
|
||||||
|
<div className="info-label">{t('admin-comment')}</div>
|
||||||
|
<div className="info-value">
|
||||||
|
<div className="admin-comment-text">
|
||||||
|
{existingAppeal.adminComment}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{existingAppeal.resolvedAt && (
|
||||||
|
<div className="info-item">
|
||||||
|
<div className="info-label">{t('resolved-at')}</div>
|
||||||
|
<div className="info-value">
|
||||||
|
{formatDateTime(existingAppeal.resolvedAt)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{hasActiveAppeal && (
|
||||||
|
<div className="appeal-warning">
|
||||||
|
{t('active-appeal-pending-message')}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{!hasActiveAppeal && (
|
||||||
<div className="file-info-card appeal-form">
|
<div className="file-info-card appeal-form">
|
||||||
<div className="info-header">
|
<div className="info-header">
|
||||||
<h4>{t('file-an-appeal')}</h4>
|
<h4>{t('file-an-appeal')}</h4>
|
||||||
@@ -83,6 +158,8 @@ export function FileAppealModalWindow({ fileId, setWindowClose, setWindowChildre
|
|||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="appeal-actions">
|
<div className="appeal-actions">
|
||||||
<button
|
<button
|
||||||
className="btn btn-cancel"
|
className="btn btn-cancel"
|
||||||
@@ -100,7 +177,7 @@ export function FileAppealModalWindow({ fileId, setWindowClose, setWindowChildre
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -493,7 +493,15 @@
|
|||||||
"enter-additional-info": "Any additional information that may help...",
|
"enter-additional-info": "Any additional information that may help...",
|
||||||
"submit-appeal": "Submit appeal",
|
"submit-appeal": "Submit appeal",
|
||||||
"submitting": "Submitting...",
|
"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": {
|
"Login-register-form": {
|
||||||
"and": "and",
|
"and": "and",
|
||||||
|
|||||||
@@ -493,7 +493,15 @@
|
|||||||
"enter-additional-info": "Любая дополнительная информация, которая может помочь...",
|
"enter-additional-info": "Любая дополнительная информация, которая может помочь...",
|
||||||
"submit-appeal": "Отправить апелляцию",
|
"submit-appeal": "Отправить апелляцию",
|
||||||
"submitting": "Отправка...",
|
"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": {
|
"Login-register-form": {
|
||||||
"and": "и",
|
"and": "и",
|
||||||
|
|||||||
Reference in New Issue
Block a user