feat: add document thumbnail previews with tooltips to download and email dialogs
Build and Push Multi-Platform Images / build-and-push (push) Successful in 17s

This commit is contained in:
2026-05-10 20:49:20 +02:00
parent 4485d1673d
commit a8e27d228e
@@ -533,10 +533,11 @@ interface DownloadSegmentsDialogProps {
fileId: string;
fileName: string;
documents: DocumentSegment[];
thumbUrls: Map<number, string>;
onClose: () => void;
}
function DownloadSegmentsDialog({ open, fileId, fileName, documents, onClose }: DownloadSegmentsDialogProps) {
function DownloadSegmentsDialog({ open, fileId, fileName, documents, thumbUrls, onClose }: DownloadSegmentsDialogProps) {
const [filenames, setFilenames] = useState<string[]>([]);
const [downloading, setDownloading] = useState<number | 'all' | null>(null);
@@ -605,12 +606,20 @@ function DownloadSegmentsDialog({ open, fileId, fileName, documents, onClose }:
>
<div style={{ display: 'flex', flexDirection: 'column', gap: 10, marginTop: 16 }}>
{documents.map((doc, i) => {
const first = doc.pages[0];
const last = doc.pages[doc.pages.length - 1];
const range = first === last ? `Seite ${first}` : `Seiten ${first}${last}`;
const thumbUrl = thumbUrls.get(doc.pages[0]);
return (
<div key={doc.index} style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
<span style={{ minWidth: 90, color: '#888', fontSize: 12 }}>{range}</span>
<Tooltip
title={thumbUrl ? <img src={thumbUrl} style={{ maxWidth: 260, maxHeight: 340, display: 'block' }} alt="" /> : null}
placement="right"
mouseEnterDelay={0.2}
>
<div style={{ width: 36, height: 48, flexShrink: 0, border: '1px solid #e0e0e0', borderRadius: 3, overflow: 'hidden', background: '#fafafa', display: 'flex', alignItems: 'center', justifyContent: 'center', cursor: 'default' }}>
{thumbUrl
? <img src={thumbUrl} style={{ width: '100%', height: '100%', objectFit: 'contain' }} alt="" />
: <Spin size="small" />}
</div>
</Tooltip>
<Input
value={filenames[i] ?? ''}
onChange={(e) =>
@@ -640,10 +649,11 @@ interface SendEmailDialogProps {
fileId: string;
fileName: string;
documents: DocumentSegment[];
thumbUrls: Map<number, string>;
onClose: () => void;
}
function SendEmailDialog({ open, fileId, fileName, documents, onClose }: SendEmailDialogProps) {
function SendEmailDialog({ open, fileId, fileName, documents, thumbUrls, onClose }: SendEmailDialogProps) {
const [form] = Form.useForm();
const [submitting, setSubmitting] = useState(false);
const [filenames, setFilenames] = useState<string[]>([]);
@@ -728,12 +738,20 @@ function SendEmailDialog({ open, fileId, fileName, documents, onClose }: SendEma
<Form.Item label="Anhänge">
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
{documents.map((doc, i) => {
const first = doc.pages[0];
const last = doc.pages[doc.pages.length - 1];
const range = first === last ? `Seite ${first}` : `Seiten ${first}${last}`;
const thumbUrl = thumbUrls.get(doc.pages[0]);
return (
<div key={doc.index} style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
<span style={{ minWidth: 90, color: '#888', fontSize: 12 }}>{range}</span>
<Tooltip
title={thumbUrl ? <img src={thumbUrl} style={{ maxWidth: 260, maxHeight: 340, display: 'block' }} alt="" /> : null}
placement="right"
mouseEnterDelay={0.2}
>
<div style={{ width: 36, height: 48, flexShrink: 0, border: '1px solid #e0e0e0', borderRadius: 3, overflow: 'hidden', background: '#fafafa', display: 'flex', alignItems: 'center', justifyContent: 'center', cursor: 'default' }}>
{thumbUrl
? <img src={thumbUrl} style={{ width: '100%', height: '100%', objectFit: 'contain' }} alt="" />
: <Spin size="small" />}
</div>
</Tooltip>
<Input
value={filenames[i] ?? ''}
onChange={(e) =>
@@ -1566,6 +1584,7 @@ export default function InboxDetailPage() {
fileId={file.id}
fileName={file.name}
documents={documents}
thumbUrls={thumbUrls}
onClose={() => setDownloadDialogOpen(false)}
/>
<SendEmailDialog
@@ -1573,6 +1592,7 @@ export default function InboxDetailPage() {
fileId={file.id}
fileName={file.name}
documents={documents}
thumbUrls={thumbUrls}
onClose={() => setEmailDialogOpen(false)}
/>
</div>