fix(import): actionable hint when a bank CSV lands in the opening-balance importer (#953)

* fix(import): hint when a bank statement is uploaded as opening balances

Uploading a bank statement CSV to the opening-balance importer produced
the generic 'Inga konton med belopp hittades' error with no clue that
the file belongs in the bank-transactions importer (#918, users got
stuck together with #915).

When the opening-balance parse yields zero account rows, the parser now
runs the registered bank-file format detectors over the CSV content
(the generic CSV fallback never auto-detects, so any match is a real
bank format) and reports the matched format name as
detected_bank_format on the parse result. The upload step then shows an
actionable Swedish error naming the bank plus a button that routes to
the bank-transactions importer (/import?mode=bank).

Closes #918

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(import): use the standard bank-import CTA wording (CodeRabbit)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jakob Wennberg
2026-07-09 21:10:09 +02:00
committed by GitHub
co-authored by Claude Fable 5
parent b21aa84268
commit 982fe77f72
5 changed files with 122 additions and 2 deletions
+11 -1
View File
@@ -10,12 +10,15 @@ interface OpeningBalanceUploadStepProps {
onFileSelect: (file: File) => void
isLoading: boolean
error: string | null
/** Optional action rendered under the error text (e.g. route to the bank importer) */
errorAction?: { label: string; onClick: () => void }
}
export default function OpeningBalanceUploadStep({
onFileSelect,
isLoading,
error,
errorAction,
}: OpeningBalanceUploadStepProps) {
const [isDragging, setIsDragging] = useState(false)
@@ -108,7 +111,14 @@ export default function OpeningBalanceUploadStep({
{error && (
<div className="flex items-start gap-3 rounded-lg border border-destructive/30 bg-destructive/5 px-4 py-3">
<AlertCircle className="h-4 w-4 text-destructive mt-0.5 shrink-0" />
<p className="text-sm text-destructive">{error}</p>
<div className="space-y-2">
<p className="text-sm text-destructive">{error}</p>
{errorAction && (
<Button variant="outline" size="sm" onClick={errorAction.onClick}>
{errorAction.label}
</Button>
)}
</div>
</div>
)}