add not my file button
This commit is contained in:
@@ -18,7 +18,18 @@ import { createPortal } from 'react-dom';
|
||||
import { IconContentCopy, IconFollowToLink, IconFullScreen } from '@/app/ui/icons/icons';
|
||||
import { useViewport } from '@/app/hooks/useViewport';
|
||||
|
||||
export default function FilePageViolationInfo({ selectedViolation, caseType }: { selectedViolation: ViolationFileDetail | null, caseType?: 'claim' | 'complaint' }) {
|
||||
export default function FilePageViolationInfo(
|
||||
{
|
||||
selectedViolation,
|
||||
caseType,
|
||||
callBackSelectedViolation
|
||||
}:
|
||||
{
|
||||
selectedViolation: ViolationFileDetail | null,
|
||||
caseType?: 'claim' | 'complaint',
|
||||
callBackSelectedViolation: React.Dispatch<React.SetStateAction<ViolationFileDetail | null>>,
|
||||
}
|
||||
) {
|
||||
const t = useTranslations('Global');
|
||||
const tStatus = useTranslations('Match-status');
|
||||
const queryClient = useQueryClient();
|
||||
@@ -53,6 +64,13 @@ export default function FilePageViolationInfo({ selectedViolation, caseType }: {
|
||||
}
|
||||
queryClient.invalidateQueries({ queryKey: ['fileViolations'] });
|
||||
queryClient.invalidateQueries({ queryKey: ['complainInfo', id] });
|
||||
|
||||
if (status === 'NOT_OWNER_FILE') {
|
||||
console.log('NOT_OWNER_FILE');
|
||||
setLocalViolation(null);
|
||||
callBackSelectedViolation(null);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
setLocalViolation(selectedViolation);
|
||||
@@ -311,6 +329,17 @@ export default function FilePageViolationInfo({ selectedViolation, caseType }: {
|
||||
<div
|
||||
className="violation-info-action"
|
||||
>
|
||||
<button
|
||||
className="btn-s btn-resolve"
|
||||
onClick={() => {
|
||||
if (selectedViolation?.id) {
|
||||
updateStatusHandler(selectedViolation.id, 'NOT_OWNER_FILE');
|
||||
}
|
||||
}}
|
||||
disabled={isUpdating}
|
||||
>
|
||||
{tStatus('NOT_OWNER_FILE')}
|
||||
</button>
|
||||
<button
|
||||
className="btn-s btn-resolve"
|
||||
onClick={() => {
|
||||
|
||||
@@ -220,7 +220,7 @@ export default function FilePageViolationsList({
|
||||
})}
|
||||
</div>
|
||||
{/* general info for match */}
|
||||
<FilePageViolationInfo selectedViolation={selectedViolation} caseType={caseType} />
|
||||
<FilePageViolationInfo selectedViolation={selectedViolation} caseType={caseType} callBackSelectedViolation={setSelectedViolation} />
|
||||
|
||||
</div>
|
||||
{/* pagination */}
|
||||
|
||||
Reference in New Issue
Block a user