|
1 | 1 | 'use client'; |
2 | 2 |
|
| 3 | +import { PrizeTier } from '@/lib/api/hackathons'; |
| 4 | + |
3 | 5 | interface HackathonPrizesProps { |
4 | 6 | title?: string; |
5 | | - totalPrizes?: string; |
| 7 | + totalPrizePool?: string; |
6 | 8 | otherPrizes?: string; |
7 | | - prizes: Array<{ |
8 | | - title: string; |
9 | | - rank: string; |
10 | | - prize: string; |
11 | | - details: string[]; |
12 | | - icon?: string; |
13 | | - }>; |
| 9 | + prizes: PrizeTier[]; |
14 | 10 | } |
15 | 11 |
|
16 | 12 | export function HackathonPrizes({ |
17 | 13 | title = 'PRIZES', |
18 | | - totalPrizes = '$1,000+ in prizes', |
| 14 | + totalPrizePool, |
19 | 15 | otherPrizes, |
20 | 16 | prizes, |
21 | 17 | }: HackathonPrizesProps) { |
| 18 | + const firstThreePrizes = prizes.slice(0, 3); |
| 19 | + const remainingPrizes = prizes.slice(3); |
| 20 | + |
22 | 21 | return ( |
23 | 22 | <div className='space-y-6 py-8'> |
24 | 23 | <div> |
25 | 24 | <h2 className='text-primary mb-4 text-2xl font-bold'>{title}</h2> |
26 | 25 | <div className='flex items-center justify-between rounded-lg border border-white/10 bg-white/5 p-4'> |
27 | | - <span className='text-sm text-white/90'>{totalPrizes}</span> |
| 26 | + <span className='text-sm text-white/90'>{totalPrizePool} USDC</span> |
28 | 27 | {otherPrizes && ( |
29 | 28 | <span className='text-xs text-[#a7f950]'>+ {otherPrizes}</span> |
30 | 29 | )} |
31 | 30 | </div> |
32 | 31 | </div> |
33 | 32 |
|
34 | | - <div className='grid grid-cols-1 gap-4 md:grid-cols-2'> |
35 | | - {prizes.map((prize, index) => ( |
36 | | - <div |
37 | | - key={index} |
38 | | - className='rounded-lg border border-[#a7f950]/30 bg-gradient-to-br from-[#a7f950]/10 to-transparent p-6 transition-colors hover:border-[#a7f950]/50' |
39 | | - > |
40 | | - <div className='mb-4 flex items-start gap-3'> |
41 | | - <span className='text-2xl'>{prize.icon || '⭐'}</span> |
42 | | - <div> |
43 | | - <h3 className='text-lg font-bold text-white'>{prize.title}</h3> |
44 | | - <p className='text-xs text-white/60'>{prize.rank}</p> |
| 33 | + {/* First 3 prizes in cards */} |
| 34 | + {firstThreePrizes.length > 0 && ( |
| 35 | + <div className='grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3'> |
| 36 | + {firstThreePrizes.map((prize, index) => ( |
| 37 | + <div |
| 38 | + key={index} |
| 39 | + className='rounded-lg border border-[#a7f950]/30 bg-gradient-to-br from-[#a7f950]/10 to-transparent p-6 transition-colors hover:border-[#a7f950]/50' |
| 40 | + > |
| 41 | + <div className='mb-4 flex items-start gap-3'> |
| 42 | + <span className='text-2xl'> |
| 43 | + {index === 0 |
| 44 | + ? '🥇' |
| 45 | + : index === 1 |
| 46 | + ? '🥈' |
| 47 | + : index === 2 |
| 48 | + ? '🥉' |
| 49 | + : '⭐'} |
| 50 | + </span> |
| 51 | + <div> |
| 52 | + <h3 className='text-lg font-bold text-white'> |
| 53 | + {prize.position} |
| 54 | + </h3> |
| 55 | + <p className='text-xs text-white/60'>{prize.position}</p> |
| 56 | + </div> |
45 | 57 | </div> |
46 | | - </div> |
47 | 58 |
|
48 | | - <div className='space-y-3'> |
49 | | - <div className='text-base font-bold text-[#a7f950]'> |
50 | | - {prize.prize} |
| 59 | + <div className='space-y-3'> |
| 60 | + <div className='text-base font-bold text-[#a7f950]'> |
| 61 | + {prize.amount} {prize.currency || 'USDC'} |
| 62 | + </div> |
51 | 63 | </div> |
52 | | - <ul className='space-y-2'> |
53 | | - {prize.details.map((detail, i) => ( |
54 | | - <li key={i} className='flex gap-2 text-sm text-white/70'> |
55 | | - <span className='flex-shrink-0 text-[#a7f950]'>✓</span> |
56 | | - <span>{detail}</span> |
57 | | - </li> |
58 | | - ))} |
59 | | - </ul> |
60 | 64 | </div> |
| 65 | + ))} |
| 66 | + </div> |
| 67 | + )} |
| 68 | + |
| 69 | + {remainingPrizes.length > 0 && ( |
| 70 | + <div className='w-full pt-8'> |
| 71 | + <div className='overflow-x-auto'> |
| 72 | + <table className='w-full'> |
| 73 | + <thead> |
| 74 | + <tr className='border-b border-white/10'> |
| 75 | + <th className='text-primary px-4 py-3 text-left text-sm font-bold'> |
| 76 | + POSITION |
| 77 | + </th> |
| 78 | + <th className='text-primary px-4 py-3 text-left text-sm font-bold'> |
| 79 | + PRIZE AMOUNT |
| 80 | + </th> |
| 81 | + <th className='text-primary px-4 py-3 text-left text-sm font-bold'> |
| 82 | + CURRENCY |
| 83 | + </th> |
| 84 | + </tr> |
| 85 | + </thead> |
| 86 | + <tbody> |
| 87 | + {remainingPrizes.map((prize, index) => ( |
| 88 | + <tr |
| 89 | + key={index} |
| 90 | + className='border-b border-white/10 transition-colors hover:bg-white/5' |
| 91 | + > |
| 92 | + <td className='px-4 py-4 text-left text-sm text-white'> |
| 93 | + {prize.position} |
| 94 | + </td> |
| 95 | + <td className='px-4 py-4 text-left text-sm text-white/70'> |
| 96 | + {prize.amount} |
| 97 | + </td> |
| 98 | + <td className='px-4 py-4 text-left text-sm text-white/70'> |
| 99 | + {prize.currency || 'USDC'} |
| 100 | + </td> |
| 101 | + </tr> |
| 102 | + ))} |
| 103 | + </tbody> |
| 104 | + </table> |
61 | 105 | </div> |
62 | | - ))} |
63 | | - </div> |
| 106 | + </div> |
| 107 | + )} |
64 | 108 | </div> |
65 | 109 | ); |
66 | 110 | } |
0 commit comments