Add accounts: link a bank without Plaid keys points to Setup; delete test data right there

- With no Plaid keys, the page said bank linking "isn't available in United
  States yet". It is: the keys are missing. It now shows Link a bank or card,
  which opens Setup to add the free Plaid keys.
- Test banks: the Delete test data link went to Settings. It's now a button on
  this page, with a confirm, that removes the test bank and its transactions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
minimus7andClaude Opus 5.5 committed 2026-11-11 10:07:02 -06:00
1 parent 3e51cc4fcc
commit fb8e5425c3
5 files changed
+10 -5

No files matched your search

+1 -1
View File
@@ -20,7 +20,7 @@ export default async function AddAccountsPage({ searchParams }: { searchParams:
{connect === "done" && <p className="card px-5 py-3 text-sm" role="status">Your bank is connected. Its transactions are on the way.</p>}
{connect === "cancelled" && <p className="card px-5 py-3 text-sm" role="status">The connection was cancelled. Nothing changed.</p>}
{connect === "failed" && <p className="card px-5 py-3 text-sm text-bad" role="alert">That bank didn&apos;t connect. Try again, or import a statement instead.</p>}
{!choices.bank && !choices.feeds.length && !choices.akahuMissing && !choices.alsoAkahu && <p className="text-sm text-muted px-1">Automatic bank linking isn&apos;t available in {country.name} yet. Import a statement from your bank instead: it takes a minute and works with any bank.</p>}
{!choices.bank && !choices.plaidMissing && !choices.feeds.length && !choices.akahuMissing && !choices.alsoAkahu && <p className="text-sm text-muted px-1">Automatic bank linking isn&apos;t available in {country.name} yet. Import a statement from your bank instead: it takes a minute and works with any bank.</p>}
<AddAccounts choices={choices} accounts={accounts} locale={country.locale} currency={country.currency} country={country.code} />
{choices.akahuMissing && (
<p className="text-sm text-muted px-1">To sync NZ banks automatically, add Akahu keys on the <a href="/setup" className="underline underline-offset-2">Setup page</a>. Until then, import a statement from your bank.</p>
+1
View File
@@ -211,6 +211,7 @@ export function AddAccounts({ choices, accounts, locale, currency, country }: {
{choices.feeds.map((f) => <FeedConnect key={f} id={f} country={country} />)}
<div className="grid grid-cols-1 @xl:grid-cols-2 gap-4">
{choices.bank === "plaid" && <PlaidCard link={link} />}
{choices.plaidMissing && <Card icons={[BankIcon, CreditCardIcon, WalletIcon]} title="Link a bank or card" body="Add your free Plaid keys in Setup first. It takes about 2 minutes." onClick={() => window.location.assign("/setup")} />}
{(choices.bank === "akahu" || choices.alsoAkahu) && <AkahuCard />}
{choices.investments && <InvestCard link={link} />}
<ImportStatement accounts={accounts} locale={locale} currency={currency} trigger={(open) => (
+2 -2
View File
@@ -11,7 +11,7 @@ export function RemoveTest({ items, intro }: { items: { id: string; name: string
const [busy, setBusy] = useState(false);
const [left, setLeft] = useState(items);
const [err, setErr] = useState("");
if (!left.length) return <span className="text-sm text-good inline-flex items-center gap-1"><Check size={13} /> Test connections removed.</span>;
if (!left.length) return <span className="text-sm text-good inline-flex items-center gap-1"><Check size={13} /> Test data deleted.</span>;
async function remove() {
setBusy(true);
setErr("");
@@ -37,7 +37,7 @@ export function RemoveTest({ items, intro }: { items: { id: string; name: string
<button className="text-muted hover:text-ink" disabled={busy} onClick={() => setConfirm(false)}>Cancel</button>
</div>
) : (
<button className="btn" onClick={() => setConfirm(true)}>Remove test connections</button>
<button className="btn" onClick={() => setConfirm(true)}>Delete test data</button>
)}
{err && <p className="text-bad">{err}</p>}
</div>
+4 -2
View File
@@ -1,6 +1,6 @@
import Link from "next/link";
import { Merchant } from "@/components/Merchant";
import { RemoveCopy } from "@/components/PlaidButtons";
import { RemoveTest } from "@/components/ClearTestData";
import { duplicateItems } from "@/lib/links";
import { fmtFor, fmtWith } from "@/lib/format";
import { historyPending } from "@/lib/sync";
@@ -76,7 +76,9 @@ export async function LinkedNow({ userId, profile }: { userId: string; profile?:
)}
</ul>
{conns.some((c) => c.test) && (
<p className="px-5 py-3.5 border-t border-line text-sm">Test banks count in your totals. <Link href="/settings#banks" className="underline underline-offset-2">Delete test data</Link></p>
<div className="px-5 py-3.5 border-t border-line">
<RemoveTest items={conns.filter((c) => c.test).map((c) => ({ id: c.id, name: c.name }))} intro="Test banks count in your totals." />
</div>
)}
</section>
);
+2
View File
@@ -38,6 +38,8 @@ export function addChoices(country?: string | null, alsoNz = false) {
sandbox: plaid && process.env.PLAID_ENV === "sandbox",
// No Plaid keys at all: a made-up bank instead (api/demo-bank), so broke can be tried with only a database.
demo: !configured("plaid"),
// The country has Plaid banks but this copy has no Plaid keys yet: offer the bank card anyway, pointing at Setup.
plaidMissing: countryOf(code).providers.includes("plaid") && !configured("plaid"),
// NZ without Akahu keys: say where to add them.
akahuMissing: (countryOf(code).providers.includes("akahu") || alsoNz) && !configured("akahu"),
// Lives elsewhere but also banks in NZ (Settings, money profile): the NZ option beside their own.