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:
1 parent
943b19d743
commit
bda9265d70
2 files changed
+22
-11
No files matched your search
@@ -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 }) {
|
function ProfileCards({ email, profile }: { email: string; profile: Profile }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const start = { country: profile.country ?? "US", currency: profile.currency ?? countryOf(profile.country).currency };
|
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>}
|
{msg && <span className="text-sm text-muted">{msg}</span>}
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
|
<MonthStart profile={profile} />
|
||||||
<Card title="Money profile" what="Filing status, income, goals and more. Ask broke and Optimize use it to tailor advice.">
|
<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>
|
<Link href="/optimize#profile" className="btn inline-block">Edit money profile</Link>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
@@ -118,17 +118,6 @@ export function ProfileForm({ initial }: { initial: Profile }) {
|
|||||||
</div>
|
</div>
|
||||||
<p className="text-xs text-muted -mt-2">Your credit range picks which cards fit you on the Cards page.</p>
|
<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">
|
<Field label="Goals">
|
||||||
<GoalPicker goals={p.goals ?? []} plans={p.goalPlans ?? []} onChange={(goals, goalPlans) => { setP({ ...p, goals, goalPlans: goalPlans as GoalPlan[] }); setSaved(false); }} />
|
<GoalPicker goals={p.goals ?? []} plans={p.goalPlans ?? []} onChange={(goals, goalPlans) => { setP({ ...p, goals, goalPlans: goalPlans as GoalPlan[] }); setSaved(false); }} />
|
||||||
</Field>
|
</Field>
|
||||||
|
|||||||
Reference in new issue
Block a user