Skip to content

Commit 96b454f

Browse files
committed
Merge branch 'main' of github.com:0xdevcollins/boundless
2 parents 3936cff + 1a7f46a commit 96b454f

7 files changed

Lines changed: 343 additions & 121 deletions

File tree

app/(landing)/hackathons/[slug]/page.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import SubmissionTab from '@/components/hackathons/submissions/submissionTab';
1515
import { HackathonDiscussions } from '@/components/hackathons/discussion/comment';
1616
import { TeamFormationTab } from '@/components/hackathons/team-formation/TeamFormationTab';
1717
import LoadingScreen from '@/components/landing-page/project/CreateProjectModal/LoadingScreen';
18-
// import { useTimelineEvents } from '@/hooks/hackathon/use-timeline-events';
18+
import { useTimelineEvents } from '@/hooks/hackathon/use-timeline-events';
1919

2020
export default function HackathonPage() {
2121
const router = useRouter();
@@ -24,18 +24,15 @@ export default function HackathonPage() {
2424

2525
const {
2626
currentHackathon,
27-
// content,
28-
timelineEvents,
2927
participants,
3028
submissions,
31-
prizes,
3229
loading,
3330
setCurrentHackathon,
3431
} = useHackathonData();
35-
// const timeline_Events = useTimelineEvents(currentHackathon, {
36-
// includeEndDate: false,
37-
// dateFormat: { month: 'short', day: 'numeric', year: 'numeric' },
38-
// });
32+
const timeline_Events = useTimelineEvents(currentHackathon, {
33+
includeEndDate: false,
34+
dateFormat: { month: 'short', day: 'numeric', year: 'numeric' },
35+
});
3936

4037
const hackathonTabs = useMemo(() => {
4138
const tabs = [
@@ -198,8 +195,9 @@ export default function HackathonPage() {
198195
{activeTab === 'overview' && (
199196
<HackathonOverview
200197
content={currentHackathon.description}
201-
timelineEvents={timelineEvents}
202-
prizes={prizes}
198+
timelineEvents={timeline_Events}
199+
prizes={currentHackathon.prizeTiers}
200+
totalPrizePool={currentHackathon.totalPrizePool}
203201
hackathonSlugOrId={hackathonId}
204202
/>
205203
)}

app/(landing)/hackathons/preview/[orgId]/[draftId]/page.tsx

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { useRouter, useSearchParams } from 'next/navigation';
55
import { ArrowLeft } from 'lucide-react';
66
import {
77
previewDraft,
8+
PrizeTier,
89
transformPublicHackathonToHackathon,
910
} from '@/lib/api/hackathons';
1011
import { HackathonBanner } from '@/components/hackathons/hackathonBanner';
@@ -28,30 +29,29 @@ const mockTimelineEvents = [
2829
{ event: 'Winners Announced', date: new Date().toISOString() },
2930
];
3031

31-
const mockPrizes = [
32+
const mockPrizes: PrizeTier[] = [
3233
{
33-
title: 'First Place',
34-
rank: '1st',
35-
prize: '$5,000',
36-
icon: '🥇',
37-
details: ['Cash prize', 'Certificate', 'Featured on homepage'],
34+
position: '1st',
35+
amount: 5000,
36+
currency: 'USD',
37+
description: 'Cash prize, Certificate, Featured on homepage',
3838
},
3939
{
40-
title: 'Second Place',
41-
rank: '2nd',
42-
prize: '$3,000',
43-
icon: '🥈',
44-
details: ['Cash prize', 'Certificate'],
40+
position: '2nd',
41+
amount: 3000,
42+
currency: 'USD',
43+
description: 'Cash prize, Certificate',
4544
},
4645
{
47-
title: 'Third Place',
48-
rank: '3rd',
49-
prize: '$2,000',
50-
icon: '🥉',
51-
details: ['Cash prize', 'Certificate'],
46+
position: '3rd',
47+
amount: 2000,
48+
currency: 'USD',
49+
description: 'Cash prize, Certificate',
5250
},
5351
];
5452

53+
const totalPrizePool = mockPrizes.reduce((sum, prize) => sum + prize.amount, 0);
54+
5555
interface PreviewPageProps {
5656
params: Promise<{
5757
orgId: string;
@@ -400,6 +400,7 @@ export default function DraftPreviewPage({ params }: PreviewPageProps) {
400400
<div className='mx-auto max-w-7xl px-6 py-12 text-white'>
401401
{activeTab === 'overview' && (
402402
<HackathonOverview
403+
totalPrizePool={totalPrizePool.toString()}
403404
content={mockContent}
404405
timelineEvents={mockTimelineEvents}
405406
prizes={mockPrizes}

components/hackathons/overview/hackathonOverview.tsx

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,17 @@
22
import { useMarkdown } from '@/hooks/use-markdown';
33
import { HackathonTimeline } from './hackathonTimeline';
44
import { HackathonPrizes } from './hackathonPrizes';
5+
import { PrizeTier } from '@/lib/api/hackathons';
56

6-
interface TimelineEvent {
7+
interface Timeline {
78
event: string;
89
date: string;
910
}
10-
11-
interface Prize {
12-
title: string;
13-
rank: string;
14-
prize: string;
15-
details: string[];
16-
icon?: string;
17-
}
18-
1911
interface HackathonOverviewProps {
2012
content: string;
21-
timelineEvents?: TimelineEvent[];
22-
prizes?: Prize[];
13+
timelineEvents?: Timeline[];
14+
prizes?: PrizeTier[];
15+
totalPrizePool: string;
2316
className?: string;
2417
hackathonSlugOrId?: string;
2518
organizationId?: string;
@@ -30,6 +23,7 @@ export function HackathonOverview({
3023
timelineEvents,
3124
prizes,
3225
className = '',
26+
totalPrizePool,
3327
}: HackathonOverviewProps) {
3428
// Use the markdown hook to parse and style the content
3529
const { styledContent, loading, error } = useMarkdown(content, {
@@ -50,7 +44,9 @@ export function HackathonOverview({
5044
</article>
5145

5246
{timelineEvents && <HackathonTimeline events={timelineEvents} />}
53-
{prizes && <HackathonPrizes prizes={prizes} />}
47+
{prizes && (
48+
<HackathonPrizes totalPrizePool={totalPrizePool} prizes={prizes} />
49+
)}
5450
</div>
5551
);
5652
}
Lines changed: 79 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,110 @@
11
'use client';
22

3+
import { PrizeTier } from '@/lib/api/hackathons';
4+
35
interface HackathonPrizesProps {
46
title?: string;
5-
totalPrizes?: string;
7+
totalPrizePool?: string;
68
otherPrizes?: string;
7-
prizes: Array<{
8-
title: string;
9-
rank: string;
10-
prize: string;
11-
details: string[];
12-
icon?: string;
13-
}>;
9+
prizes: PrizeTier[];
1410
}
1511

1612
export function HackathonPrizes({
1713
title = 'PRIZES',
18-
totalPrizes = '$1,000+ in prizes',
14+
totalPrizePool,
1915
otherPrizes,
2016
prizes,
2117
}: HackathonPrizesProps) {
18+
const firstThreePrizes = prizes.slice(0, 3);
19+
const remainingPrizes = prizes.slice(3);
20+
2221
return (
2322
<div className='space-y-6 py-8'>
2423
<div>
2524
<h2 className='text-primary mb-4 text-2xl font-bold'>{title}</h2>
2625
<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>
2827
{otherPrizes && (
2928
<span className='text-xs text-[#a7f950]'>+ {otherPrizes}</span>
3029
)}
3130
</div>
3231
</div>
3332

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>
4557
</div>
46-
</div>
4758

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>
5163
</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>
6064
</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>
61105
</div>
62-
))}
63-
</div>
106+
</div>
107+
)}
64108
</div>
65109
);
66110
}

0 commit comments

Comments
 (0)