@@ -365,7 +370,67 @@ const CsvPreview: React.FC<{ artifact: PreviewArtifact }> = ({ artifact }) => {
- {(truncated || lines.length > 20) && Preview limited to first 20 rows. Click Open for the full file.}
+ {(truncated || moreRows > 0) && (
+
+ {truncated
+ ? 'Preview truncated at 200 KB. Click Open for the full file.'
+ : `${moreRows} more row${moreRows === 1 ? '' : 's'} not shown. Click Open for the full file.`}
+
+ )}
+
+ );
+};
+
+// Word .docx → HTML via mammoth (~200 KB, fully client-side). Lazy-load so
+// inspectors that never see a Word file don't pay the bundle cost. Format
+// loss is acceptable for preview — mammoth produces clean semantic HTML
+// (headings, lists, tables, bold/italic) and skips rare inline shapes. For
+// pixel-faithful render the user clicks Open and uses Word / Office Online.
+const DocxPreview: React.FC<{ artifact: PreviewArtifact }> = ({ artifact }) => {
+ const { url, loading: urlLoading } = useSignedFileUrl(artifact.fileName);
+ const [html, setHtml] = useState