feat(evidence): inline preview for images and text/JSON files

Adds a View button (eye icon) on each evidence card for previewable file
types. Opens a full-screen modal:
- Images (png/jpg/gif/webp/svg/…): rendered directly via <img> tag
- JSON: fetched authenticated, pretty-printed in green mono
- Text/log/md/csv/xml/yaml/…: fetched authenticated, shown in <pre>

Non-previewable files only show the Download button as before.
Modal closes on Escape or backdrop click.
This commit is contained in:
kitos
2026-05-28 13:49:35 +02:00
parent cd718512ad
commit 1a974265de
3 changed files with 273 additions and 48 deletions
+15
View File
@@ -63,6 +63,21 @@ export async function getEvidence(evidenceId: string): Promise<EvidenceOut> {
return data;
}
// ── Content fetch (for inline preview) ────────────────────────────
/** Fetch raw file content for inline preview (text / JSON). */
export async function getEvidenceRawContent(
evidenceId: string,
): Promise<{ text: string; contentType: string }> {
const response = await client.get(`/evidence/${evidenceId}/file`, {
responseType: "blob",
});
const blob = response.data as Blob;
const text = await blob.text();
const contentType = (response.headers["content-type"] as string) || "";
return { text, contentType };
}
// ── Delete ─────────────────────────────────────────────────────────
/** Delete an evidence record (only in editable states). */