diff --git a/src/app/(app)/settings/Settings.tsx b/src/app/(app)/settings/Settings.tsx index b971531..717a756 100644 --- a/src/app/(app)/settings/Settings.tsx +++ b/src/app/(app)/settings/Settings.tsx @@ -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 ( + +
+ +
+ {msg && {msg}} +
+ ); +} + 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 && {msg}} + Edit money profile diff --git a/src/components/ProfileForm.tsx b/src/components/ProfileForm.tsx index b67af5d..e2b2ac4 100644 --- a/src/components/ProfileForm.tsx +++ b/src/components/ProfileForm.tsx @@ -118,17 +118,6 @@ export function ProfileForm({ initial }: { initial: Profile }) {

Your credit range picks which cards fit you on the Cards page.

- - { setP({ ...p, month: v === "payday" ? "payday" : undefined }); setSaved(false); }} - placeholder="On the 1st" - /> -

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.

-
- { setP({ ...p, goals, goalPlans: goalPlans as GoalPlan[] }); setSaved(false); }} />