change match table styles and notification styles

This commit is contained in:
smanylov
2026-04-16 17:07:14 +07:00
parent 365aeded43
commit 839dd8cf94
14 changed files with 247 additions and 146 deletions
@@ -86,10 +86,16 @@ export default function CaseComplaint({ selectedViolation, updateStatusHandler }
<div className="note-form">
<form action={formAction}>
<input type="hidden" name="violationId" value={localViolation.id} />
<label
className="note-case-label"
htmlFor="note"
>
{t('text-of-the-complaint')}
</label>
<textarea
name="note"
className="note-textarea"
placeholder={`${t('text-of-the-complaint')}...`}
placeholder={`${t('text-area-error-fill-complaint-text')}...`}
value={noteText}
onChange={(e) => setNoteText(e.target.value)}
>
@@ -99,7 +105,7 @@ export default function CaseComplaint({ selectedViolation, updateStatusHandler }
>
<button
type="submit"
className="btn-small btn-primary-small"
className="btn-s btn-primary-small"
disabled={isPending}
onClick={(e) => {
e.preventDefault();
@@ -110,7 +116,7 @@ export default function CaseComplaint({ selectedViolation, updateStatusHandler }
<button
type="submit"
className="btn-small btn-primary-small"
className="btn-s btn-primary-small"
disabled={isPending}
>
{t('submit-violation')}
@@ -262,40 +268,35 @@ export default function CaseComplaint({ selectedViolation, updateStatusHandler }
<div className="complaint-details">
<div className="complaint-details-item">
<div className="complaint-details-header">
<h5>ID: {item.id}</h5>
<h5>COM-{item.id}</h5>
</div>
</div>
<div className="complaint-details-item">
<div className="complaint-details-header">
<span className="complaint-details-title">{t('status')}:</span>
</div>
<div className="complaint-details-content">{item.status}</div>
</div>
<div className="complaint-details-item">
<div className="complaint-details-header">
<span className="complaint-details-title">{t('date-of-creation')}:</span>
</div>
<div className="complaint-details-content">
{item.created_at ? `${formatDate(item.created_at)}: ${formatDateTime(item.created_at)}` : '---'}
<span className="complaint-details-title">{t('Status')}:</span> {item.status}
</div>
</div>
<div className="complaint-details-item">
<div className="complaint-details-header">
<span className="complaint-details-title">{t('date-of-update')}:</span>
</div>
<div className="complaint-details-content">
{item.updated_at ? `${formatDate(item.updated_at)}: ${formatDateTime(item.updated_at)}` : '---'}
<span className="complaint-details-title">{t('date-of-creation')}: {item.created_at ? `${formatDate(item.created_at)}: ${formatDateTime(item.created_at)}` : '---'}</span>
</div>
</div>
<div className="complaint-details-item">
<div className="complaint-details-header">
<span className="complaint-details-title">{t('text-of-the-complaint')}:</span>
<span className="complaint-details-title">{t('date-of-update')}: {item.updated_at ? `${formatDate(item.updated_at)}: ${formatDateTime(item.updated_at)}` : '---'}</span>
</div>
</div>
<div className="complaint-details-item">
<div className="complaint-details-header">
<span className="complaint-details-title">{t('text-of-the-complaint')}:
<br />
{item.complaint_text}
</span>
</div>
<div className="complaint-details-content">{item.complaint_text}</div>
</div>
</div>
</div>
@@ -149,6 +149,12 @@ export default function CaseViolation({ selectedViolation, updateStatusHandler }
<section
className="note-textarea-wrapper"
>
<label
className="note-case-label"
htmlFor="note"
>
{t('text-of-the-case')}
</label>
<textarea
name="note"
className="note-textarea"
@@ -177,7 +183,7 @@ export default function CaseViolation({ selectedViolation, updateStatusHandler }
>
<button
type="submit"
className="btn-small btn-primary-small"
className="btn-s btn-primary-small"
disabled={isPending}
>
{t('submit-violation')}
@@ -220,48 +226,41 @@ export default function CaseViolation({ selectedViolation, updateStatusHandler }
<div className="complaint-details-item">
<div className="complaint-details-header">
<span className="complaint-details-title">{t('status')}:</span>
</div>
<div className="complaint-details-content">{item.type}</div>
</div>
<div className="complaint-details-item">
<div className="complaint-details-header">
<span className="complaint-details-title">{t('date-of-creation')}:</span>
</div>
<div className="complaint-details-content">
{item.createdAt ? `${formatDate(item.createdAt)}: ${formatDateTime(item.createdAt)}` : '---'}
<span className="complaint-details-title">{t('Status')}: {item.type}</span>
</div>
</div>
<div className="complaint-details-item">
<div className="complaint-details-header">
<span className="complaint-details-title">{t('date-of-update')}:</span>
</div>
<div className="complaint-details-content">
{item.updatedAt ? `${formatDate(item.updatedAt)}: ${formatDateTime(item.updatedAt)}` : '---'}
<span className="complaint-details-title">{t('date-of-creation')}: {item.createdAt ? `${formatDate(item.createdAt)}: ${formatDateTime(item.createdAt)}` : '---'}</span>
</div>
</div>
<div className="complaint-details-item">
<div className="complaint-details-header">
<span className="complaint-details-title">{t('description')}:</span>
<span className="complaint-details-title">{t('date-of-update')}: {item.updatedAt ? `${formatDate(item.updatedAt)}: ${formatDateTime(item.updatedAt)}` : '---'}</span>
</div>
<div className="complaint-details-content">{item.description}</div>
</div>
<div className="complaint-details-item">
<div className="complaint-details-header">
<span className="complaint-details-title">{t('amount-of-damage')}:</span>
<span className="complaint-details-title">{t('amount-of-damage')}: {item.amount}</span>
</div>
<div className="complaint-details-content">{item.amount}</div>
</div>
<div className="complaint-details-item">
<div className="complaint-details-header">
<span className="complaint-details-title">{t('lawyer')}:</span>
<span className="complaint-details-title">{t('lawyer')}: {item.lawyer}</span>
</div>
</div>
<div className="complaint-details-item">
<div className="complaint-details-header">
<span className="complaint-details-title">{t('description')}:
<br />
{item.description}
</span>
</div>
<div className="complaint-details-content">{item.lawyer}</div>
</div>
</div>
</div>
@@ -68,13 +68,13 @@ export default function FilePageViolationInfoTabs({ selectedViolation, updateSta
<div className="violation-info-tabs-wrapper">
<div className="violation-info-tabs">
<button
className={`btn btn-primary ${activeTab === 'complaint' ? 'active' : ''}`}
className={`btn-s btn-primary ${activeTab === 'complaint' ? 'active' : ''} ${localViolation.status === 'COMPLAINT_IN_WORK' || localViolation.status === 'COMPLAINT_AND_LEGAL_IN_WORK' ? '' : 'action'}`}
onClick={() => setActiveTab('complaint')}
>
{localViolation.status === 'COMPLAINT_IN_WORK' || localViolation.status === 'COMPLAINT_AND_LEGAL_IN_WORK' ? 'Жалоба' : 'Подать жалобу'}
</button>
<button
className={`btn btn-primary ${activeTab === 'legal' ? 'active' : ''}`}
className={`btn-s btn-primary ${activeTab === 'legal' ? 'active' : ''} ${localViolation.status === 'LEGAL_IN_WORK' || localViolation.status === 'COMPLAINT_AND_LEGAL_IN_WORK' ? '' : 'action'}`}
onClick={() => setActiveTab('legal')}
>
{localViolation.status === 'LEGAL_IN_WORK' || localViolation.status === 'COMPLAINT_AND_LEGAL_IN_WORK' ? 'Претензия' : 'Подать претензию'}
@@ -15,6 +15,7 @@ import FilePageViolationEpmtyScreen from '@/app/ui/file-page/violation-table/fil
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';
export default function FilePageViolationInfo({ selectedViolation }: { selectedViolation: ViolationFileDetail | null }) {
const t = useTranslations('Global');
@@ -23,6 +24,8 @@ export default function FilePageViolationInfo({ selectedViolation }: { selectedV
const [localViolation, setLocalViolation] = useState<ViolationFileDetail | null>(null);
const [isUpdating, setIsUpdating] = useState(false);
const [isModalOpen, setIsModalOpen] = useState(false);
const [isHovered, setIsHovered] = useState(false);
const [copied, setCopied] = useState(false);
const openInNewTab = () => {
if (selectedViolation?.url) {
@@ -95,6 +98,32 @@ export default function FilePageViolationInfo({ selectedViolation }: { selectedV
);
};
const handleCopyLink = () => {
if (!selectedViolation?.page_url) return;
const linkToCopy = cleanUrlForDisplay(selectedViolation.page_url);
if (!navigator.clipboard) {
const textarea = document.createElement('textarea');
textarea.value = linkToCopy;
document.body.appendChild(textarea);
textarea.select();
document.execCommand('copy');
document.body.removeChild(textarea);
setCopied(true);
setTimeout(() => setCopied(false), 2000);
toast.success(`${t('copied')}: ${linkToCopy}`)
return;
}
navigator.clipboard.writeText(linkToCopy)
.then(() => {
setCopied(true);
setTimeout(() => setCopied(false), 2000);
toast.success(`${t('copied')}: ${linkToCopy}`)
})
.catch();
};
return (
<div
@@ -139,23 +168,14 @@ export default function FilePageViolationInfo({ selectedViolation }: { selectedV
onClick={() => setIsModalOpen(true)}
title="Увеличить"
>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<circle cx="11" cy="11" r="8" />
<line x1="21" y1="21" x2="16.65" y2="16.65" />
<line x1="11" y1="8" x2="11" y2="14" />
<line x1="8" y1="11" x2="14" y2="11" />
</svg>
<IconFullScreen />
</button>
<button
className="image-btn image-btn-open"
onClick={openInNewTab}
title="Открыть в новой вкладке"
>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" />
<polyline points="15 3 21 3 21 9" />
<line x1="10" y1="14" x2="21" y2="3" />
</svg>
<IconFollowToLink />
</button>
</div>
</div>
@@ -172,17 +192,34 @@ export default function FilePageViolationInfo({ selectedViolation }: { selectedV
className="violation-info-source"
>
<span>
{t('source')}:
{t('full-link')}:
</span>
<br />
<Link
href={selectedViolation?.page_url ? selectedViolation?.page_url : '#'}
className="source"
target="_blank"
scroll={false}
<div
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
>
{selectedViolation?.page_url ? cleanUrlForDisplay(selectedViolation?.page_url) : selectedViolation?.page_url}
</Link>
<span
className="source"
>
{selectedViolation?.page_url ? cleanUrlForDisplay(selectedViolation?.page_url) : selectedViolation?.page_url}
</span>
<span
className={`violation-info-icon ${!isHovered ? 'hiden' : ''}`}
onClick={handleCopyLink}
>
<IconContentCopy />
</span>
<Link
className={`violation-info-icon ${!isHovered ? 'hiden' : ''}`}
href={selectedViolation?.page_url ? cleanUrlForDisplay(selectedViolation?.page_url) : '#'}
target="_blank"
scroll={false}
>
<IconFollowToLink />
</Link>
</div>
</div>
<div
@@ -216,7 +253,7 @@ export default function FilePageViolationInfo({ selectedViolation }: { selectedV
className="violation-info-date"
>
<span>
{t('date-of-creation')}:
{t('date-of-discovery')}:
</span>
<div
className="violation-info-date-value"
@@ -235,7 +272,7 @@ export default function FilePageViolationInfo({ selectedViolation }: { selectedV
className="violation-info-action"
>
<button
className="btn-action btn-resolve"
className="btn-s btn-resolve"
onClick={() => {
if (selectedViolation?.id) {
updateStatusHandler(selectedViolation.id, 'AUTHORIZED_USE');
@@ -8,7 +8,7 @@ import FilePageViolationInfo from '@/app/ui/file-page/violation-table/file-page-
import { useFileViolations } from '@/app/hooks/react-query/useFileViolations';
import { ViolationFileDetail } from '@/app/hooks/react-query/useFileViolations';
import DropDownList from '@/app/components/DropDownList';
import { IconArrowLeft, IconArrowRight, IconDoubleArrowLeft, IconDoubleArrowRight } from '@/app/ui/icons/icons';
import { IconArrowLeft, IconArrowRight, IconDoubleArrowLeft, IconDoubleArrowRight, IconFollowToLink } from '@/app/ui/icons/icons';
import FilePageViolationsLoadingList from '@/app/ui/file-page/violation-table/file-page-violations-loading-list';
import Image from 'next/image';
@@ -194,11 +194,10 @@ export default function FilePageViolationsList({
<div className="source-actions">
<Link
href={item.page_url}
className="btn-small btn-primary-small"
target="_blank"
scroll={false}
>
{t('open')}
<IconFollowToLink />
</Link>
</div>
</div>