Move "A month starts" to Settings, Profile

It sat in the money profile form on Optimize, where nobody looks for a
display setting. Now it's its own card in Settings, Profile, and saves
as soon as it's picked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
MangaValkandClaude Opus 5.5 committed 2026-11-22 18:12:11 +01:00
1 parent 943b19d743
commit bda9265d70
2 files changed
+22 -11

No files matched your search

+22
View File
@@ -181,6 +181,27 @@ function Card({ title, what, s, children }: { title: string; what?: string; s?:
);
}
// When a month starts: on the 1st, or on payday (lib/paymonths.ts). Saved as soon as it's picked.
function MonthStart({ profile }: { profile: Profile }) {
const router = useRouter();
const [v, setV] = useState(profile.month === "payday" ? "payday" : "calendar");
const [msg, setMsg] = useState("");
async function pick(next: string) {
setV(next);
const { error } = await updateMeta(createClient(), { data: { profile: { ...profile, month: next === "payday" ? "payday" : undefined } } });
setMsg(error ? "Couldn't save that. Try again." : "Saved.");
if (!error) router.refresh();
}
return (
<Card title="A month starts" what="On payday: each month runs from one salary to the day before the next, and is named after the month it mostly covers. Salary is money in under Income.">
<div className="max-w-sm">
<Dropdown label="A month starts" value={v} options={[{ value: "calendar", label: "On the 1st" }, { value: "payday", label: "On payday" }]} onChange={pick} placeholder="On the 1st" />
</div>
{msg && <span className="text-sm text-muted">{msg}</span>}
</Card>
);
}
function ProfileCards({ email, profile }: { email: string; profile: Profile }) {
const router = useRouter();
const start = { country: profile.country ?? "US", currency: profile.currency ?? countryOf(profile.country).currency };
@@ -210,6 +231,7 @@ function ProfileCards({ email, profile }: { email: string; profile: Profile }) {
{msg && <span className="text-sm text-muted">{msg}</span>}
</div>
</Card>
<MonthStart profile={profile} />
<Card title="Money profile" what="Filing status, income, goals and more. Ask broke and Optimize use it to tailor advice.">
<Link href="/optimize#profile" className="btn inline-block">Edit money profile</Link>
</Card>