diff --git a/src/components/user/UserProfile.tsx b/src/components/user/UserProfile.tsx index 5cd58a7..3a39464 100644 --- a/src/components/user/UserProfile.tsx +++ b/src/components/user/UserProfile.tsx @@ -6,6 +6,15 @@ interface UserProfileProps { } export default function UserProfile({ user, cards }: UserProfileProps) { + const formatPlanet = (planet: number) => { + if (planet >= 1000000) { + return `${(planet / 1000000).toFixed(2)}M`; + } else if (planet >= 1000) { + return `${(planet / 1000).toFixed(2)}K`; + } + return planet.toLocaleString(); + }; + return (

@@ -48,7 +57,7 @@ export default function UserProfile({ user, cards }: UserProfileProps) { {user.planet && (
- {user.planet} + {formatPlanet(user.planet)}
)}