Files
brokeless/src/components/WeekCard.tsx
T
minimus7andClaude Opus 5.5 73208b79df Sign in with a code, made-up data without Plaid, and easier everyday use
- Sign in with a code from your email (the link still works); setup item for the code email
- Use made-up data: a pretend bank with three months of spending, no Plaid account needed
- Is this your pay? when regular money in is filed as something else, with a one-press fix
- They look right: keep every bank-given category in one press
- Your week on Home, Plan in the main menu, history start per bank on Accounts
- A new version of broke is ready, in the sidebar and Settings
- Start skips the rebuild when nothing changed; country screen says it was guessed
- Fix: skipping banks no longer sends you back to setup

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:54:31 -06:00

32 lines
1.7 KiB
TypeScript

"use client";
import { useEffect, useState } from "react";
import { AskButton } from "@/components/Assistant";
import { useMoney } from "@/components/Money";
import { changeLines, trackLines, type CheckinFacts } from "@/lib/checkins";
type Checkin = { id: string; created_at: string; facts: CheckinFacts; summary: string | null };
// "Your week" on Home: the weekly review, written once a week (POST /api/checkins makes a new one when the last is 7+
// days old, else returns it). Your AI's words when one is connected, else the plain facts. A few lines, no more.
export function WeekCard() {
const { money0, dateLabel } = useMoney();
const [c, setC] = useState<Checkin | null>(null);
useEffect(() => {
fetch("/api/checkins", { method: "POST", headers: { "content-type": "application/json" }, body: "{}" })
.then((r) => (r.ok ? r.json() : null)).then((x: Checkin | null) => x?.facts && setC(x)).catch(() => {});
}, []);
if (!c) return null;
const lines = (c.summary ? c.summary.split("\n").map((l) => l.replace(/^- /, "").trim()) : [...changeLines(c.facts, { $: money0 }), ...trackLines(c.facts, money0)]).filter(Boolean).slice(0, 4);
if (!lines.length) return null;
return (
<section className="card p-5 space-y-2.5">
<div className="flex items-baseline justify-between gap-3">
<span className="text-sm text-muted">Your week · {dateLabel(c.created_at.slice(0, 10), { month: "short", day: "numeric" })}</span>
<AskButton q="Talk me through my week: what changed, and what should I do about it?" className="text-sm text-muted hover:text-ink">Ask about this</AskButton>
</div>
<ul className="space-y-1.5 text-sm list-disc pl-5">{lines.map((l) => <li key={l}>{l}</li>)}</ul>
</section>
);
}