diff --git a/apps/edr-freight-web/backoffice/src/components/export/ExportDialog.tsx b/apps/edr-freight-web/backoffice/src/components/export/ExportDialog.tsx index 6c7af128c..c8b19e56d 100644 --- a/apps/edr-freight-web/backoffice/src/components/export/ExportDialog.tsx +++ b/apps/edr-freight-web/backoffice/src/components/export/ExportDialog.tsx @@ -67,7 +67,12 @@ export function ExportDialog({ opened, onClose, dataset, params }: ExportDialogP ); const [selected, setSelected] = useState(defaultKeys); - const [format, setFormat] = useState("csv"); + // xlsx by default: typed number and date columns, so a spreadsheet opens it + // without the "is this text?" pass CSV needs. Falls back to whatever the + // dataset does offer rather than presetting a format it would reject. + const [format, setFormat] = useState( + () => (dataset.formats.includes("xlsx") ? "xlsx" : dataset.formats[0]), + ); const [scope, setScope] = useState("all"); const [search, setSearch] = useState(""); const [exporting, setExporting] = useState(false); @@ -343,7 +348,15 @@ export function ExportDialog({ opened, onClose, dataset, params }: ExportDialogP return ( - + {/* Radio.Card's own checked state is a border tint + and nothing else, which reads as unselected at + this size. The Indicator is what actually says + which format is picked, as the report export + dialog's cards already do. */} + + + + {label} @@ -385,7 +398,7 @@ export function ExportDialog({ opened, onClose, dataset, params }: ExportDialogP {total?.toLocaleString()} rows exceeds the {cap.toLocaleString()}-row{" "} {FORMAT_META[format].label} limit. Narrow the filters - {format !== "csv" ? ", switch to CSV," : ""} or{" "} + {dataset.caps.csv > cap ? ", switch to CSV," : ""} or{" "} setScope(String(cap))}> export the first {cap.toLocaleString()}