feat: §6 Gruppo B residuo — pannello macros, esclusioni granulari, achievement

- Plan: pannello macros laterale "oggi" con consumati/pianificati vs target (kcal/P/F/C). Sticky su lg, in-flow su mobile. Profile/derived ora include kcalTarget e i macro target (BMR aggiustato per condizioni e diet history).
- Preferenze: nuova sezione "Ingredienti specifici da evitare" con ricerca debounced sul catalogo (cap 50). Schema Preferences.bannedIngredientIds + matchmaking che scarta ricette contenenti ingredient bandito (test unit).
- Achievement: tabella Achievement (userId+key unique), 4 traguardi iniziali (first_weigh_in, first_plan, first_fast_complete, ten_meals_consumed). Service idempotente eval+persist agganciato a 4 trigger (weight POST, plan POST, fast PATCH→COMPLETED, slot consumed). Push notification best-effort all'unlock. Pannello badge nel profilo.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
lucianoandClaude Opus 4.7 committed 2026-05-06 15:45:30 +02:00
1 parent 3b895191f5
commit d17c5ef869
29 files changed
+1048 -86

No files matched your search

+17 -1
View File
@@ -6,6 +6,8 @@ import { setRequestLocale } from 'next-intl/server';
import { Masthead } from '@/components/masthead';
import { getServerSession } from '@/lib/auth';
import { fetchAchievements } from './achievements-actions';
import { AchievementsPanel } from './achievements-panel';
import { fetchProfile } from './actions';
import { DataPanel } from './data-panel';
import { fetchNotificationConfig } from './notifications-actions';
@@ -28,9 +30,15 @@ export default async function ProfilePage({ params: { locale } }: { params: { lo
const profile = (await fetchProfile()) as Parameters<typeof ProfileForm>[0]['initial'];
const notifications = await fetchNotificationConfig();
const preferences = await fetchPreferences();
const achievements = await fetchAchievements();
return (
<ProfilePageContent initial={profile} notifications={notifications} preferences={preferences} />
<ProfilePageContent
initial={profile}
notifications={notifications}
preferences={preferences}
achievements={achievements}
/>
);
}
@@ -38,10 +46,12 @@ function ProfilePageContent({
initial,
notifications,
preferences,
achievements,
}: {
initial: Parameters<typeof ProfileForm>[0]['initial'];
notifications: Awaited<ReturnType<typeof fetchNotificationConfig>>;
preferences: Awaited<ReturnType<typeof fetchPreferences>>;
achievements: Awaited<ReturnType<typeof fetchAchievements>>;
}) {
const t = useTranslations('Profile');
@@ -79,6 +89,12 @@ function ProfilePageContent({
<div className="rule animate-rule-in my-16 [animation-delay:780ms]" />
<div className="animate-fade-up [animation-delay:840ms]">
<AchievementsPanel unlocked={achievements} />
</div>
<div className="rule animate-rule-in my-16 [animation-delay:900ms]" />
<div className="animate-fade-up [animation-delay:960ms]">
<DataPanel />
</div>
</main>