feat: add delete-after-action dialogs and auto-refresh in inbox
Build and Push Multi-Platform Images / build-and-push (push) Successful in 17s
Build and Push Multi-Platform Images / build-and-push (push) Successful in 17s
- Show confirmation dialog to delete document after download or email send - Auto-refresh inbox list every 30 seconds - Rename "Vorschau" button to "Weiterverarbeiten" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -538,6 +538,7 @@ interface DownloadSegmentsDialogProps {
|
||||
}
|
||||
|
||||
function DownloadSegmentsDialog({ open, fileId, fileName, documents, thumbUrls, onClose }: DownloadSegmentsDialogProps) {
|
||||
const navigate = useNavigate();
|
||||
const [filenames, setFilenames] = useState<string[]>([]);
|
||||
const [downloading, setDownloading] = useState<number | 'all' | null>(null);
|
||||
|
||||
@@ -575,17 +576,39 @@ function DownloadSegmentsDialog({ open, fileId, fileName, documents, thumbUrls,
|
||||
|
||||
const downloadAll = async () => {
|
||||
setDownloading('all');
|
||||
let success = false;
|
||||
try {
|
||||
for (let i = 0; i < documents.length; i++) {
|
||||
const blob = await inboxApi.downloadSegmentBlob(fileId, documents[i].pages);
|
||||
triggerDownload(blob, filenames[i] || fileName);
|
||||
if (i < documents.length - 1) await new Promise((r) => setTimeout(r, 300));
|
||||
}
|
||||
success = true;
|
||||
} catch {
|
||||
message.error('Download fehlgeschlagen');
|
||||
} finally {
|
||||
setDownloading(null);
|
||||
}
|
||||
if (success) {
|
||||
Modal.confirm({
|
||||
title: 'Dokument löschen?',
|
||||
content: 'Das Dokument wurde heruntergeladen. Soll es jetzt aus der Eingangsbox entfernt werden?',
|
||||
okText: 'Ja, löschen',
|
||||
okButtonProps: { danger: true },
|
||||
cancelText: 'Nein, behalten',
|
||||
onOk: async () => {
|
||||
try {
|
||||
await inboxApi.remove(fileId);
|
||||
navigate('/inbox');
|
||||
} catch {
|
||||
message.error('Löschen fehlgeschlagen');
|
||||
} finally {
|
||||
onClose();
|
||||
}
|
||||
},
|
||||
onCancel: onClose,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -654,6 +677,7 @@ interface SendEmailDialogProps {
|
||||
}
|
||||
|
||||
function SendEmailDialog({ open, fileId, fileName, documents, thumbUrls, onClose }: SendEmailDialogProps) {
|
||||
const navigate = useNavigate();
|
||||
const [form] = Form.useForm();
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
const [filenames, setFilenames] = useState<string[]>([]);
|
||||
@@ -712,7 +736,24 @@ function SendEmailDialog({ open, fileId, fileName, documents, thumbUrls, onClose
|
||||
setRecipientHistory(updated);
|
||||
userSettingsApi.update({ emailRecipientHistory: updated }).catch(() => {});
|
||||
message.success('E-Mail wurde gesendet');
|
||||
onClose();
|
||||
Modal.confirm({
|
||||
title: 'Dokument löschen?',
|
||||
content: 'Die E-Mail wurde gesendet. Soll das Dokument jetzt aus der Eingangsbox entfernt werden?',
|
||||
okText: 'Ja, löschen',
|
||||
okButtonProps: { danger: true },
|
||||
cancelText: 'Nein, behalten',
|
||||
onOk: async () => {
|
||||
try {
|
||||
await inboxApi.remove(fileId);
|
||||
navigate('/inbox');
|
||||
} catch {
|
||||
message.error('Löschen fehlgeschlagen');
|
||||
} finally {
|
||||
onClose();
|
||||
}
|
||||
},
|
||||
onCancel: onClose,
|
||||
});
|
||||
} catch (err: any) {
|
||||
if (err?.errorFields) return;
|
||||
message.error('E-Mail konnte nicht gesendet werden');
|
||||
|
||||
@@ -209,6 +209,11 @@ export default function InboxPage() {
|
||||
load();
|
||||
}, [load]);
|
||||
|
||||
useEffect(() => {
|
||||
const id = setInterval(load, 30_000);
|
||||
return () => clearInterval(id);
|
||||
}, [load]);
|
||||
|
||||
const handleRescan = async () => {
|
||||
setRescanning(true);
|
||||
const hide = message.loading('Rescan läuft – das kann je nach Anzahl der Dokumente dauern …', 0);
|
||||
@@ -324,7 +329,7 @@ export default function InboxPage() {
|
||||
icon={<EyeOutlined />}
|
||||
onClick={() => navigate(`/inbox/${encodeURIComponent(record.id)}`)}
|
||||
>
|
||||
Vorschau
|
||||
Weiterverarbeiten
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<Popconfirm
|
||||
|
||||
Reference in New Issue
Block a user