Fix Achievement Logic: Correct Fighter/Goal Crusher criteria and clarify celebration UI

This commit is contained in:
Avery Felts 2026-01-31 10:52:42 -07:00
parent 36a3deddc7
commit 7046febd00
2 changed files with 8 additions and 2 deletions

View File

@ -104,6 +104,10 @@ export function CelebrationAnimation({
</p>
<h2 className="text-2xl font-bold text-white mb-1">{badge.name}</h2>
<p className="text-white/70 text-sm">{badge.description}</p>
{/* Substance indicator - Helps clarify which tracker triggered this */}
<div className="mt-3 inline-flex items-center px-2 py-0.5 rounded-full bg-white/10 text-[10px] text-white/50 border border-white/5 uppercase tracking-wider">
For {badge.id === 'first_day' || badge.id === 'streak_7' ? 'tracking' : 'staying free from'}
</div>
</div>
</div>
</div>

View File

@ -546,10 +546,12 @@ export function checkBadgeEligibility(
case 'streak_3': return streak >= 3;
case 'streak_7': return stats.totalDays >= 7;
case 'fighter':
return getStreakFromMap(stats.nicotineMap) >= 7 && getStreakFromMap(stats.weedMap) >= 7;
// Fix: Check streak for the current substance, not both simultaneously
return streak >= 7;
case 'one_month': return checkMonthlyReduction();
case 'goal_crusher':
return getStreakFromMap(stats.nicotineMap) >= 30 && getStreakFromMap(stats.weedMap) >= 30;
// Fix: Check streak for the current substance, not both simultaneously
return streak >= 30;
default: return false;
}
}