hide AUTHORIZED_USE and NOT_OWNER_FILE button while match in work

This commit is contained in:
smanylov
2026-04-27 13:33:02 +07:00
parent 904c615665
commit abc07a5e2f
2 changed files with 30 additions and 24 deletions
@@ -18,6 +18,8 @@ import { createPortal } from 'react-dom';
import { IconContentCopy, IconFollowToLink, IconFullScreen } from '@/app/ui/icons/icons';
import { useViewport } from '@/app/hooks/useViewport';
const IN_WORK_STATUS = ['COMPLAINT_AND_LEGAL_IN_WORK', 'LEGAL_IN_WORK', 'COMPLAINT_IN_WORK'];
export default function FilePageViolationInfo(
{
selectedViolation,
@@ -67,7 +69,6 @@ export default function FilePageViolationInfo(
queryClient.invalidateQueries({ queryKey: ['violationData'] });
queryClient.invalidateQueries({ queryKey: ['lastCases'] });
queryClient.invalidateQueries({ queryKey: ['lastComplaints'] });
if (status === 'NOT_OWNER_FILE') {
console.log('NOT_OWNER_FILE');
@@ -333,28 +334,33 @@ export default function FilePageViolationInfo(
<div
className="violation-info-action"
>
<button
className="btn-s btn-no-my-file"
onClick={() => {
if (selectedViolation?.id) {
updateStatusHandler(selectedViolation.id, 'NOT_OWNER_FILE');
}
}}
disabled={isUpdating}
>
{tStatus('NOT_OWNER_FILE')}
</button>
<button
className="btn-s btn-resolve"
onClick={() => {
if (selectedViolation?.id) {
updateStatusHandler(selectedViolation.id, 'AUTHORIZED_USE');
}
}}
disabled={isUpdating}
>
{t('allow-use')}
</button>
{!IN_WORK_STATUS.includes(selectedViolation.status) && (
<button
className="btn-s btn-no-my-file"
onClick={() => {
if (selectedViolation?.id) {
updateStatusHandler(selectedViolation.id, 'NOT_OWNER_FILE');
}
}}
disabled={isUpdating}
>
{tStatus('NOT_OWNER_FILE')}
</button>
)}
{!IN_WORK_STATUS.includes(selectedViolation.status) && (
<button
className="btn-s btn-resolve"
onClick={() => {
if (selectedViolation?.id) {
updateStatusHandler(selectedViolation.id, 'AUTHORIZED_USE');
}
}}
disabled={isUpdating}
>
{t('allow-use')}
</button>
)}
</div>
</div>
</div>