46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
'use client'
|
|
|
|
import { formatCUSD } from '@/lib/format'
|
|
|
|
interface WinnerBadgeProps {
|
|
userWon: boolean
|
|
winnings: number
|
|
userShare?: number
|
|
}
|
|
|
|
export default function WinnerBadge({ userWon, winnings, userShare }: WinnerBadgeProps) {
|
|
if (!userWon) {
|
|
return (
|
|
<div className="bg-gray-100 rounded-xl p-6 text-center">
|
|
<div className="text-4xl mb-2">😔</div>
|
|
<h3 className="font-bold text-gray-700 text-lg">Better luck next time!</h3>
|
|
<p className="text-gray-600 text-sm mt-1">
|
|
Come back tomorrow for a new poll
|
|
</p>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<div className="bg-gradient-to-r from-celo-yellow to-celo-green rounded-xl p-6 text-center shadow-xl">
|
|
<div className="text-5xl mb-3 animate-bounce">🎉</div>
|
|
<h3 className="font-bold text-white text-2xl">You Won!</h3>
|
|
<p className="text-white/90 text-sm mt-1 mb-4">
|
|
Congratulations! You picked the correct answer.
|
|
</p>
|
|
<div className="bg-white/20 backdrop-blur-sm rounded-lg p-4">
|
|
<p className="text-white/80 text-xs mb-1">Your Winnings</p>
|
|
<p className="text-white font-bold text-3xl">{formatCUSD(winnings)}</p>
|
|
{userShare && (
|
|
<p className="text-white/80 text-sm mt-2">
|
|
Your share: {userShare.toFixed(2)}%
|
|
</p>
|
|
)}
|
|
</div>
|
|
<p className="text-white/90 text-xs mt-4">
|
|
Winnings will be distributed automatically ✨
|
|
</p>
|
|
</div>
|
|
)
|
|
}
|