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>
-11
View File
@@ -118,17 +118,6 @@ export function ProfileForm({ initial }: { initial: Profile }) {
</div>
<p className="text-xs text-muted -mt-2">Your credit range picks which cards fit you on the Cards page.</p>
<Field label="A month starts">
<Dropdown
label="A month starts"
value={p.month ?? "calendar"}
options={[{ value: "calendar", label: "On the 1st" }, { value: "payday", label: "On payday" }]}
onChange={(v) => { setP({ ...p, month: v === "payday" ? "payday" : undefined }); setSaved(false); }}
placeholder="On the 1st"
/>
<p className="text-xs text-muted pt-1">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.</p>
</Field>
<Field label="Goals">
<GoalPicker goals={p.goals ?? []} plans={p.goalPlans ?? []} onChange={(goals, goalPlans) => { setP({ ...p, goals, goalPlans: goalPlans as GoalPlan[] }); setSaved(false); }} />
</Field>