From dd8c06a8fa12e775f7a3325cc09f8b8e4d146c6a Mon Sep 17 00:00:00 2001 From: Mattsson <111893710+mattssonn@users.noreply.github.com> Date: Mon, 31 Aug 2026 00:10:28 +0200 Subject: [PATCH] fix(dashboard): offer bank connection in the all-clear Att gora state (#2049) * fix(dashboard): offer bank connection in the all-clear Att gora state When the Att gora worklist is all-clear but the company has no active bank connection, the plain "Allt klart!" praised silence that was really a setup gap: nothing flows in automatically. The empty state now says so and offers "Anslut bank" linking to /settings/banking. Fetch errors degrade to the ordinary all-clear copy, mirroring the emptyLedger rule. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_011oUS7VoKWMj3jqQmdnop6R * fix(dashboard): reword no-bank hint so it holds for automatic non-bank feeds Skeptic finding: a company on the Stripe transaction feed (nightly cron into transactions) with no PSD2 connection would read "inga nya transaktioner kommer in automatiskt" as a false statement. Reworded to an invitation that is true for every cohort. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_011oUS7VoKWMj3jqQmdnop6R * fix(dashboard): scope the no-bank hint to bank transactions CodeRabbit: "nya transaktioner" could still read as covering non-bank feeds; say "banktransaktioner" / "bank transactions". Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_011oUS7VoKWMj3jqQmdnop6R --------- Co-authored-by: Claude Fable 5 --- app/(dashboard)/hem-sections.tsx | 8 +++++++- components/dashboard/AttGoraSection.tsx | 20 +++++++++++++++++++- messages/en.json | 3 +++ messages/sv.json | 3 +++ 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/app/(dashboard)/hem-sections.tsx b/app/(dashboard)/hem-sections.tsx index 3286d3e6..cdca1ac7 100644 --- a/app/(dashboard)/hem-sections.tsx +++ b/app/(dashboard)/hem-sections.tsx @@ -190,7 +190,7 @@ export async function HemPanesSection({ // the worklist count is the list's length (it used to scan the same rows // twice). Everything else runs in the same wave. const suggestedMatchesPromise = listSuggestedMatches(supabase, companyId, SUGGESTED_MATCH_SCAN_CAP) - const [worklist, suggestedMatches, resumeItems, { data: bankConnections }, postedEntries] = + const [worklist, suggestedMatches, resumeItems, bankConnectionsRes, postedEntries] = await Promise.all([ // Pending-work counts come from lib/worklist: the same source as the // sidebar badges, so the numbers can never diverge. @@ -210,6 +210,11 @@ export async function HemPanesSection({ // bookkeeping that its ledger is blank, so errors degrade to the normal copy. const emptyLedger = setupOpen && !postedEntries.error && (postedEntries.count || 0) === 0 + const bankConnections = bankConnectionsRes.data + // Same degrade-on-error rule as emptyLedger: a failed fetch must NOT tell a + // connected company that no bank is connected, so errors read as connected. + const hasActiveBankConnection = !!bankConnectionsRes.error || (bankConnections ?? []).length > 0 + // Same day-math as the bank_connection_expiring notice predicate // (lib/notices/categories.ts): the Bevaka row and the notice can never // disagree on the threshold. @@ -225,6 +230,7 @@ export async function HemPanesSection({ suggestedMatches={suggestedMatches.slice(0, 5)} expiringBankConnections={expiringBankConnections} emptyLedger={emptyLedger} + hasActiveBankConnection={hasActiveBankConnection} /> diff --git a/components/dashboard/AttGoraSection.tsx b/components/dashboard/AttGoraSection.tsx index 0bb42d58..f43cf70b 100644 --- a/components/dashboard/AttGoraSection.tsx +++ b/components/dashboard/AttGoraSection.tsx @@ -60,6 +60,14 @@ interface AttGoraSectionProps { * state then says "nothing here yet" instead of a false "all caught up". */ emptyLedger?: boolean + /** + * False when the company has no active bank connection. The all-clear state + * then explains that nothing flows in automatically and offers "Anslut bank" + * instead of a bare "all caught up": for a disconnected company the silence + * is a setup gap, not an achievement. Defaults to true so a fetch error + * degrades to the ordinary all-clear copy, never to a wrong nag. + */ + hasActiveBankConnection?: boolean } interface WorklistRowProps { @@ -108,6 +116,7 @@ export default function AttGoraSection({ suggestedMatches, expiringBankConnections = [], emptyLedger = false, + hasActiveBankConnection = true, }: AttGoraSectionProps) { const t = useTranslations('dashboard') const { toast } = useToast() @@ -237,13 +246,22 @@ export default function AttGoraSection({ description={t('att_gora_new_body')} className="py-10" /> - ) : ( + ) : hasActiveBankConnection ? ( + ) : ( + ) ) : (
diff --git a/messages/en.json b/messages/en.json index 2ae25ac3..c32d3cb0 100644 --- a/messages/en.json +++ b/messages/en.json @@ -6927,6 +6927,9 @@ "att_gora_empty_title": "All caught up!", "att_gora_empty_body": "No transactions to record and no documents to handle.", "att_gora_new_status": "Nothing here yet", + "att_gora_no_bank_title": "All clear for now", + "att_gora_no_bank_body": "No bank is connected. Connect your bank to fetch bank transactions automatically.", + "att_gora_no_bank_action": "Connect bank", "att_gora_new_title": "Your books are empty so far", "att_gora_new_body": "The get-started steps above will fill them: your history, the bank and the receipts.", "band_bokfor": "Record", diff --git a/messages/sv.json b/messages/sv.json index 938be1d8..7e7a7c8f 100644 --- a/messages/sv.json +++ b/messages/sv.json @@ -6927,6 +6927,9 @@ "att_gora_empty_title": "Allt klart!", "att_gora_empty_body": "Inga transaktioner att bokföra och inga underlag att hantera.", "att_gora_new_status": "Inget här än", + "att_gora_no_bank_title": "Allt klart just nu", + "att_gora_no_bank_body": "Ingen bank är ansluten. Anslut din bank så hämtas banktransaktioner automatiskt.", + "att_gora_no_bank_action": "Anslut bank", "att_gora_new_title": "Bokföringen är tom än så länge", "att_gora_new_body": "Kom igång-stegen ovan fyller den: historiken, banken och kvittona.", "band_bokfor": "Bokför",