diff --git a/packages/core/.oxlintrc.jsonc b/packages/core/.oxlintrc.jsonc index 10c46209..ef5e146b 100644 --- a/packages/core/.oxlintrc.jsonc +++ b/packages/core/.oxlintrc.jsonc @@ -8,6 +8,7 @@ "rules": { // React 19's JSX Transform handles React imports automatically "react/react-in-jsx-scope": "off", + "no-nested-ternary": "error", }, "ignorePatterns": ["dist", "node_modules"], } diff --git a/packages/core/src/components/csv-importer/CsvImporter.tsx b/packages/core/src/components/csv-importer/CsvImporter.tsx index a8f52d49..13ccf0d2 100644 --- a/packages/core/src/components/csv-importer/CsvImporter.tsx +++ b/packages/core/src/components/csv-importer/CsvImporter.tsx @@ -239,11 +239,11 @@ function MappingStep({ > {/* Status icon */} - {isMapped ? ( - - ) : col.required ? ( + {isMapped && } + {!isMapped && col.required && ( - ) : ( + )} + {!isMapped && !col.required && ( )} @@ -741,9 +741,7 @@ export function CsvImporter({ "astw:flex astw:size-7 astw:items-center astw:justify-center astw:rounded-full astw:text-xs astw:font-medium", step === s ? "astw:bg-primary astw:text-primary-foreground" - : stepIndex(step) > idx - ? "astw:bg-primary/20 astw:text-primary" - : "astw:bg-muted astw:text-muted-foreground", + : stepClassForIndex(step, idx), )} > {idx + 1} @@ -900,3 +898,9 @@ function stepIndex(step: CsvImporterStep): number { const steps: CsvImporterStep[] = ["upload", "mapping", "review", "complete"]; return steps.indexOf(step); } + +function stepClassForIndex(step: CsvImporterStep, idx: number): string { + return stepIndex(step) > idx + ? "astw:bg-primary/20 astw:text-primary" + : "astw:bg-muted astw:text-muted-foreground"; +} diff --git a/packages/core/src/components/csv-importer/process-rows.ts b/packages/core/src/components/csv-importer/process-rows.ts index 02a33b10..4a1a7560 100644 --- a/packages/core/src/components/csv-importer/process-rows.ts +++ b/packages/core/src/components/csv-importer/process-rows.ts @@ -1,5 +1,15 @@ import type { CsvCellIssue, CsvColumnMapping, CsvCorrection, CsvSchema, ParsedRow } from "./types"; +function resolveRawValue( + correction: CsvCorrection | undefined, + colIdx: number | undefined, + row: string[], +): string { + if (correction !== undefined) return String(correction.newValue); + if (colIdx !== undefined) return row[colIdx]; + return ""; +} + /** Single-pass: validate all cells and build parsed rows for onValidate. */ export function processRows( rawRows: string[][], @@ -24,12 +34,7 @@ export function processRows( const correction = corrections.find( (c) => c.row === rowIdx && c.columnKey === mapping.columnKey, ); - const rawValue: string = - correction !== undefined - ? String(correction.newValue) - : colIdx !== undefined - ? row[colIdx] - : ""; + const rawValue = resolveRawValue(correction, colIdx, row); const column = schema.columns.find((c) => c.key === mapping.columnKey); if (column?.schema) { diff --git a/packages/core/src/components/data-table/cell-renderers.tsx b/packages/core/src/components/data-table/cell-renderers.tsx index b6598462..9f2335e6 100644 --- a/packages/core/src/components/data-table/cell-renderers.tsx +++ b/packages/core/src/components/data-table/cell-renderers.tsx @@ -11,6 +11,20 @@ import type { NumberCellOptions, } from "./types"; +function resolveDateFormatOptions(format: string): Intl.DateTimeFormatOptions { + if (format === "long") return { month: "long", day: "numeric", year: "numeric" }; + if (format === "datetime") { + return { + month: "short", + day: "numeric", + year: "numeric", + hour: "numeric", + minute: "2-digit", + }; + } + return { month: "short", day: "numeric", year: "numeric" }; +} + const PLACEHOLDER = (