diff --git a/src/components/medications/intake-import-result.tsx b/src/components/medications/intake-import-result.tsx index 4493fc219..d0945bc04 100644 --- a/src/components/medications/intake-import-result.tsx +++ b/src/components/medications/intake-import-result.tsx @@ -8,9 +8,9 @@ * the thing that has to be right is the sentence at the end of the run. * * The rules are the ones the settings import panel already follows, reused - * rather than restated: `classifyImportOutcome` decides the tone from the + * rather than restated: `classifyWrittenOutcome` decides the tone from the * counts, so an import that wrote nothing can never carry the success tick, - * and `ImportOutcomeLine` owns the tick and the success colour. The skips are + * and `WrittenOutcomeLine` owns the tick and the success colour. The skips are * grouped by reason with a count, because a file that trips one rule trips it * on every row and a per-row list is the same sentence a hundred times. * @@ -18,11 +18,11 @@ * cards; the medication intake import is the third import surface and it now * answers the same way. */ +import { WrittenOutcomeLine } from "@/components/outcome/written-outcome-line"; import { - classifyImportOutcome, - type ImportOutcome, -} from "@/components/settings/import-panel/import-result-state"; -import { ImportOutcomeLine } from "@/components/settings/import-panel/import-result-view"; + classifyWrittenOutcome, + type WrittenOutcome, +} from "@/lib/outcome/written-outcome"; import { useTranslations } from "@/lib/i18n/context"; /** A skip group exactly as the import job reports it. */ @@ -132,7 +132,7 @@ export function IntakeImportResultView({ ); } - const outcome: ImportOutcome = classifyImportOutcome({ + const outcome: WrittenOutcome = classifyWrittenOutcome({ written: result.imported, skipped: result.skipped, }); @@ -153,7 +153,7 @@ export function IntakeImportResultView({ return (
+ + {message} +
+ ); +} diff --git a/src/components/settings/import-panel/apple-health-import-card.tsx b/src/components/settings/import-panel/apple-health-import-card.tsx index cfeb60c3f..1d8d12af8 100644 --- a/src/components/settings/import-panel/apple-health-import-card.tsx +++ b/src/components/settings/import-panel/apple-health-import-card.tsx @@ -11,8 +11,8 @@ import { useTranslations } from "@/lib/i18n/context"; import { cn } from "@/lib/utils"; import { apiFetchRaw, apiGet } from "@/lib/api/api-fetch"; import { ImportCardShell } from "./import-card-shell"; -import { classifyImportOutcome } from "./import-result-state"; -import { ImportOutcomeLine } from "./import-result-view"; +import { WrittenOutcomeLine } from "@/components/outcome/written-outcome-line"; +import { classifyWrittenOutcome } from "@/lib/outcome/written-outcome"; /** Terminal states the status poll stops on. */ const TERMINAL_STATES: readonly string[] = ["done", "failed"]; @@ -239,8 +239,8 @@ export function AppleHealthImportCard() {- - {message} -
- ); -} + type WrittenRowResult, +} from "@/lib/outcome/written-outcome"; export interface CsvImportResult { inserted: number; @@ -63,7 +14,7 @@ export interface CsvImportResult { skipped: number; total: number; dryRun: boolean; - rows: ImportRowResult[]; + rows: WrittenRowResult[]; } /** @@ -118,7 +69,7 @@ export function CsvImportResultView({ result }: { result: CsvImportResult }) { const labelFor = useSkipReasonLabel(); const written = result.inserted + result.updated; - const outcome = classifyImportOutcome({ written, skipped: result.skipped }); + const outcome = classifyWrittenOutcome({ written, skipped: result.skipped }); const groups = groupSkipReasons(result.rows); const skippedRows = result.rows.filter((row) => row.status === "skipped"); @@ -162,7 +113,7 @@ export function CsvImportResultView({ result }: { result: CsvImportResult }) { return (