diff --git a/client/components/passport/PassportSummary.tsx b/client/components/passport/PassportSummary.tsx new file mode 100644 index 00000000..d3e04a06 --- /dev/null +++ b/client/components/passport/PassportSummary.tsx @@ -0,0 +1,269 @@ +import { Link } from "react-router-dom"; +import { + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, +} from "@/components/ui/card"; +import { Badge } from "@/components/ui/badge"; +import { Button } from "@/components/ui/button"; +import { Separator } from "@/components/ui/separator"; +import { Progress } from "@/components/ui/progress"; +import { Sparkles, ShieldCheck, Trophy, Users } from "lucide-react"; +import type { + AethexAchievement, + AethexUserProfile, +} from "@/lib/aethex-database-adapter"; +import { cn } from "@/lib/utils"; + +const realmMeta: Record< + string, + { label: string; description: string; gradient: string } +> = { + game_developer: { + label: "Development Forge", + description: "Building immersive experiences and advanced systems.", + gradient: "from-neon-purple to-aethex-500", + }, + client: { + label: "Strategist Nexus", + description: "Partner in high-impact delivery and technical direction.", + gradient: "from-neon-blue to-aethex-400", + }, + community_member: { + label: "Innovation Commons", + description: "Connecting innovators, researchers, and trailblazers.", + gradient: "from-neon-green to-aethex-600", + }, + customer: { + label: "Experience Hub", + description: "Unlocking AeThex products and premium adventures.", + gradient: "from-amber-400 to-aethex-700", + }, +}; + +const providerMeta: Record< + string, + { label: string; color: string; accent: string } +> = { + google: { + label: "Google", + color: "bg-red-500/10 text-red-300", + accent: "border-red-500/40", + }, + github: { + label: "GitHub", + color: "bg-slate-500/10 text-slate-100", + accent: "border-slate-500/40", + }, +}; + +interface PassportSummaryProps { + profile: Partial & { email?: string | null }; + achievements: AethexAchievement[]; + interests?: string[]; + isSelf: boolean; + linkedProviders?: Array<{ provider: string; lastSignInAt?: string }>; +} + +const MAX_HERO_ACHIEVEMENTS = 3; + +const PassportSummary = ({ + profile, + achievements, + interests, + isSelf, + linkedProviders, +}: PassportSummaryProps) => { + const realm = realmMeta[(profile as any)?.user_type || "community_member"]; + const level = profile.level ?? 1; + const totalXp = profile.total_xp ?? 0; + const loyaltyPoints = (profile as any)?.loyalty_points ?? 0; + const progressToNextLevel = Math.min(((totalXp % 1000) / 1000) * 100, 100); + const featureAchievements = achievements.slice(0, MAX_HERO_ACHIEVEMENTS); + + return ( + + +
+ + AeThex Passport + +
+ + {profile.full_name || profile.username || "AeThex Explorer"} + + {profile.email && ( + + {profile.email} + + )} +
+
+ + {realm?.label || "Innovation Commons"} + + + Level {level} + + + {totalXp} XP + + + {loyaltyPoints} Loyalty + +
+
+
+
+ + Progress to Level {level + 1} + + + {(progressToNextLevel || 0).toFixed(0)}% + +
+ + {realm && ( +

+ {realm.description} +

+ )} +
+
+ +
+
+
+ Realm Alignment + +
+

+ {(profile as any)?.user_type?.replace("_", " ") || "community member"} +

+
+
+
+ Projects Completed + +
+

+ {(profile as any)?.completed_projects ?? 0} +

+
+
+
+ Community Reach + +
+

+ {(profile as any)?.community_reach ?? "Growing"} +

+
+
+ + {featureAchievements.length > 0 && ( +
+

+ Featured Achievements +

+
+ {featureAchievements.map((achievement) => ( +
+
+ + {achievement.icon || "✨"} + + + {achievement.name} + +
+ {achievement.description && ( +

+ {achievement.description} +

+ )} +
+ ))} +
+
+ )} + + {interests && interests.length > 0 && ( +
+

+ Interests & Focus Areas +

+
+ {interests.map((interest) => ( + + {interest} + + ))} +
+
+ )} + + {linkedProviders && linkedProviders.length > 0 && ( +
+

+ Linked Accounts +

+
+ {linkedProviders.map((provider) => { + const meta = providerMeta[provider.provider] || { + label: provider.provider, + color: "bg-slate-500/10 text-slate-100", + accent: "border-slate-500/40", + }; + return ( + + + {meta.label} + + ); + })} +
+
+ )} + + {isSelf && ( + <> + +
+ + +
+ + )} +
+
+ ); +}; + +export default PassportSummary;