"use client"; import { useState } from "react"; import type { Achievement, FanGoal, FanProfile, PassportStats, ScreenId, Team, } from "../../types/passport"; import { getTeamById } from "../../utils/passportMetrics"; import MetricCard from "../shared/MetricCard"; import ProgressBar from "../shared/ProgressBar"; import StatusPill from "../shared/StatusPill"; interface FanProfileScreenProps { profile: FanProfile; teams: Team[]; fanGoals: FanGoal[]; achievements: Achievement[]; stats: PassportStats; onNavigate: (screen: ScreenId) => void; onUpdateProfile: (updates: Partial) => void; } export default function FanProfileScreen({ profile, teams, fanGoals, achievements, stats, onNavigate, onUpdateProfile, }: FanProfileScreenProps) { const [isEditing, setIsEditing] = useState(false); const [draftName, setDraftName] = useState(profile.displayName); const [draftBio, setDraftBio] = useState(profile.bio); const [draftFavoriteTeamId, setDraftFavoriteTeamId] = useState(profile.favoriteTeamId); const [draftGoalIds, setDraftGoalIds] = useState(profile.selectedGoalIds); const favoriteTeam = getTeamById(teams, profile.favoriteTeamId); const unlockedAchievements = achievements.filter((achievement) => achievement.unlocked); const selectedGoals = fanGoals.filter((goal) => profile.selectedGoalIds.includes(goal.id)); function toggleDraftGoal(goalId: string) { setDraftGoalIds((current) => { if (current.includes(goalId)) { return current.filter((id) => id !== goalId); } return [...current, goalId].slice(-3); }); } function saveProfile() { onUpdateProfile({ displayName: draftName.trim() || profile.displayName, bio: draftBio.trim(), favoriteTeamId: draftFavoriteTeamId, selectedGoalIds: draftGoalIds, }); setIsEditing(false); } return (

Fan profile

Your supporter identity.

The profile turns a collection app into a fan story: favourite team, personal goals, streaks, badges, and shareable supporter style.

Profile card

{profile.supporterStyle}

{!isEditing ? ( <>

{profile.bio}

{selectedGoals.map((goal) => ( ))}
) : (
setDraftName(event.target.value)} value={draftName} />