import Link from "next/link"; import { FeedConnect } from "@/components/FeedConnect"; import { ImportStatement } from "@/components/ImportStatement"; import { AkahuButton, LinkBankButton, TestModeNote } from "@/components/PlaidButtons"; import { countryOf } from "@/lib/countries"; import { getUser } from "@/lib/data"; import { addChoices } from "@/lib/providers"; // The one empty state for "no bank data yet": says what the page will show and gives the next step. // Users with only investment accounts get copy that fits what they have. export async function EmptyBank({ title = "Link an account to get started", body = "broke reads your transactions through Plaid, with bank-level encryption.", children }: { title?: string; body?: string; children?: React.ReactNode }) { const { supabase, user } = await getUser(); const { data } = await supabase.from("accounts").select("user_id, type"); const own = (data ?? []).filter((a) => a.user_id === user?.id); const country = countryOf(user?.user_metadata?.profile?.country); const choices = addChoices(country.code); // the same choices as /accounts/add const investOnly = !!own.length && own.every((a) => a.type === "investment"); return (
{investOnly ? "Your linked accounts are investments. Spending and budgets come from a bank or card, or from transactions you add by hand." : body}