diff --git a/src/routes/archive.index.tsx b/src/routes/archive.index.tsx index 7182009..2e32482 100644 --- a/src/routes/archive.index.tsx +++ b/src/routes/archive.index.tsx @@ -500,9 +500,13 @@ function UploadDialog({ }); }; + const previewKeys = preview.length > 0 ? Object.keys(preview[0]).slice(0, 4) : []; + const totalKeys = preview.length > 0 ? Object.keys(preview[0]).length : 0; + const previewRows = preview.slice(0, 3); + return ( - + Upload CSV to {category.label} @@ -510,7 +514,7 @@ function UploadDialog({ -
+
0 && (
-
- Preview (first {preview.length} rows) +
+ + Preview ({previewRows.length} {previewRows.length === 1 ? "row" : "rows"}, showing {previewKeys.length} of {totalKeys} columns) +
-
- - +
+
+ - {Object.keys(preview[0]).map((k) => ( - ))} + {totalKeys > previewKeys.length && ( + + )} - {preview.map((row, i) => ( + {previewRows.map((row, i) => ( - {Object.keys(preview[0]).map((k) => ( - ))} + {totalKeys > previewKeys.length && ( + + )} ))} @@ -565,7 +579,7 @@ function UploadDialog({ )} - +
+ {previewKeys.map((k) => ( + {k} + +{totalKeys - previewKeys.length} +
+ {previewKeys.map((k) => ( + {row[k]} …