adding habit_streak_milestones

This commit is contained in:
masongga
2026-05-23 22:18:28 -06:00
parent 53f3cec385
commit 4d22c04f83
7 changed files with 279 additions and 65 deletions

28
lib/coins.ts Normal file
View File

@@ -0,0 +1,28 @@
export const COINS_PER_TASK_COMPLETE = 50;
export const COINS_PER_TASK_UNCHECK = -50;
export const STREAK_MILESTONE_COINS: Record<number, number> = {
5: 50,
7: 75,
10: 100,
20: 150,
30: 200,
50: 350,
100: 750,
};
export const STREAK_MILESTONES = Object.keys(STREAK_MILESTONE_COINS)
.map(Number)
.sort((a, b) => a - b);
export function getStreakMilestoneBonus(streak: number) {
return STREAK_MILESTONE_COINS[streak] ?? null;
}
export function formatCoinsDelta(delta: number) {
if (delta === 0) {
return "0 points";
}
return `${delta > 0 ? "+" : ""}${delta} points`;
}