Skip to content

Commit 6e78420

Browse files
committed
refactor: update hackathon data structure and UI components
- Removed deprecated fields such as endDate and registrationDeadlinePolicy from various components and pages. - Updated prize amount references to use prizeAmount instead of amount. - Enhanced the HackathonPageClient and DraftPreviewPage to reflect new data structure. - Improved UI elements for better user experience, including a view mode toggle in the submissions tab. - Adjusted status handling in the HackathonSidebar and NewHackathonSidebar components to align with updated status definitions. - Refactored submission handling to utilize the new useOrganizerSubmissions hook for better data management.
1 parent 4ec4081 commit 6e78420

42 files changed

Lines changed: 1217 additions & 2042 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

COMMENT_SYSTEM_README.md

Lines changed: 0 additions & 571 deletions
This file was deleted.

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,12 +313,11 @@ export default function HackathonPageClient() {
313313
deadline: currentHackathon.submissionDeadline,
314314
startDate: currentHackathon.startDate,
315315
totalPrizePool: currentHackathon.prizeTiers
316-
.reduce((acc, prize) => acc + Number(prize.amount || 0), 0)
316+
.reduce((acc, prize) => acc + Number(prize.prizeAmount || 0), 0)
317317
.toString(),
318318
isRegistered,
319319
hasSubmitted,
320320
isTeamFormationEnabled,
321-
registrationDeadlinePolicy: currentHackathon.registrationDeadlinePolicy,
322321
registrationDeadline: currentHackathon.registrationDeadline,
323322
participantType: currentHackathon.participantType,
324323
onJoinClick: handleJoinClick,
@@ -359,10 +358,13 @@ export default function HackathonPageClient() {
359358
currency: tier.currency,
360359
passMark: tier.passMark,
361360
description: tier.description,
362-
prizeAmount: tier.amount,
361+
prizeAmount: tier.prizeAmount,
363362
}))}
364363
totalPrizePool={currentHackathon.prizeTiers
365-
.reduce((acc, prize) => acc + Number(prize.amount || 0), 0)
364+
.reduce(
365+
(acc, prize) => acc + Number(prize.prizeAmount || 0),
366+
0
367+
)
366368
.toString()}
367369
hackathonSlugOrId={hackathonId}
368370
venue={{

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

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -145,36 +145,14 @@ export default function DraftPreviewPage({ params }: PreviewPageProps) {
145145
timezone: draft.data.timeline?.timezone || 'UTC',
146146

147147
startDate: draft.data.timeline?.startDate || '',
148-
endDate:
149-
draft.data.timeline?.winnersAnnouncedAt ||
150-
draft.data.timeline?.winnerAnnouncementDate ||
151-
draft.data.timeline?.judgingEnd ||
152-
draft.data.timeline?.judgingDate ||
153-
draft.data.timeline?.judgingStart ||
154-
draft.data.timeline?.submissionDeadline ||
155-
draft.data.timeline?.startDate ||
156-
'',
157148
submissionDeadline: draft.data.timeline?.submissionDeadline || '',
158149
registrationDeadline:
159-
draft.data.participation?.registrationDeadline || '',
160-
judgingStart: draft.data.timeline?.judgingStart || '',
161-
judgingEnd: draft.data.timeline?.judgingEnd || '',
162-
winnersAnnouncedAt:
163-
draft.data.timeline?.winnersAnnouncedAt ||
164-
draft.data.timeline?.winnerAnnouncementDate ||
165-
'',
166-
customRegistrationDeadline:
167-
draft.data.participation?.registrationDeadline || null,
150+
draft.data.timeline?.registrationDeadline || '',
151+
judgingDeadline: draft.data.timeline?.judgingDeadline || '',
168152

169153
registrationOpen: false,
170-
registrationDeadlinePolicy:
171-
(draft.data.participation?.registrationDeadlinePolicy as
172-
| 'BEFORE_START'
173-
| 'BEFORE_SUBMISSION_DEADLINE'
174-
| 'CUSTOM') || 'BEFORE_SUBMISSION_DEADLINE',
175154

176155
daysUntilStart: 0,
177-
daysUntilEnd: 0,
178156

179157
participantType: (draft.data.participation?.participantType ===
180158
'individual'
@@ -527,7 +505,6 @@ export default function DraftPreviewPage({ params }: PreviewPageProps) {
527505
participants={0}
528506
imageUrl={previewHackathon.banner}
529507
startDate={previewHackathon.startDate}
530-
endDate={previewHackathon.endDate}
531508
/>
532509

533510
{/* Tabs */}

app/(landing)/org/[id]/org-profile-client.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export default function OrgProfileClient({ slug }: OrgProfileClientProps) {
8585
return (
8686
<section className='mx-auto max-w-[1440px] px-5 py-10 md:px-[50px] lg:px-[100px]'>
8787
{/* Banner / Header */}
88-
<div className='relative mb-8 overflow-hidden rounded-2xl border border-[#a7f950]/20 bg-gradient-to-br from-[#a7f950]/10 via-zinc-900/80 to-zinc-900/40'>
88+
<div className='relative mb-8 overflow-hidden rounded-2xl border border-[#a7f950]/20 bg-linear-to-br from-[#a7f950]/10 via-zinc-900/80 to-zinc-900/40'>
8989
<div className='absolute -top-24 -right-24 h-64 w-64 rounded-full bg-[#a7f950]/5 blur-3xl' />
9090
<div className='absolute -bottom-16 -left-16 h-48 w-48 rounded-full bg-[#a7f950]/5 blur-3xl' />
9191

app/(landing)/organizations/[id]/hackathons/[hackathonId]/page.tsx

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -158,31 +158,7 @@ export default function HackathonPage() {
158158
e => e.phase === 'Winner Announcement'
159159
);
160160

161-
// Manually append Winner Announcement if missing and date exists
162161
const fullTimeline = [...timelineEvents];
163-
if (!hasWinnerAnnouncement && currentHackathon?.endDate) {
164-
const winnerDate = new Date(currentHackathon.endDate);
165-
const now = new Date();
166-
// Simple status logic for single date event
167-
// If date is passed, completed. If today (roughly), ongoing?
168-
// Or just use 'upcoming' if future, 'completed' if past.
169-
// Ideally we'd match the phase logic, but for a single date event:
170-
let status: 'completed' | 'ongoing' | 'upcoming' =
171-
'upcoming';
172-
if (now > winnerDate) {
173-
status = 'completed';
174-
}
175-
// For "Winner Announcement", it might be "ongoing" on the day of?
176-
// keeping simple for now.
177-
178-
fullTimeline.push({
179-
phase: 'Winner Announcement',
180-
description:
181-
'Final results published and prizes distributed to winners.',
182-
date: currentHackathon.endDate,
183-
status: status,
184-
});
185-
}
186162

187163
return fullTimeline.map((phase, index) => {
188164
const isLast = index === fullTimeline.length - 1;

app/(landing)/organizations/[id]/hackathons/[hackathonId]/settings/page.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,16 @@ export default function SettingsPage() {
8080
if (!h) return undefined;
8181
return {
8282
startDate: h.startDate ? new Date(h.startDate) : undefined,
83-
endDate: h.endDate ? new Date(h.endDate) : undefined,
8483
submissionDeadline: h.submissionDeadline
8584
? new Date(h.submissionDeadline)
8685
: undefined,
87-
judgingStart: h.judgingStart ? new Date(h.judgingStart) : undefined,
88-
judgingEnd: h.judgingEnd ? new Date(h.judgingEnd) : undefined,
89-
winnersAnnouncedAt: h.winnersAnnouncedAt
90-
? new Date(h.winnersAnnouncedAt)
91-
: undefined,
9286
timezone: h.timezone || 'UTC',
87+
registrationDeadline: h.registrationDeadline
88+
? new Date(h.registrationDeadline)
89+
: undefined,
90+
judgingDeadline: h.judgingDeadline
91+
? new Date(h.judgingDeadline)
92+
: undefined,
9393
phases: h.phases?.map(p => ({
9494
...p,
9595
startDate: p.startDate ? new Date(p.startDate) : undefined,
@@ -107,9 +107,6 @@ export default function SettingsPage() {
107107
require_github: h.requireGithub,
108108
require_demo_video: h.requireDemoVideo,
109109
require_other_links: h.requireOtherLinks,
110-
registrationDeadlinePolicy:
111-
h.registrationDeadlinePolicy?.toLowerCase() as any,
112-
registrationDeadline: h.customRegistrationDeadline || undefined,
113110
detailsTab: h.enabledTabs.includes('detailsTab'),
114111
participantsTab: h.enabledTabs.includes('participantsTab'),
115112
resourcesTab: h.enabledTabs.includes('resourcesTab'),
@@ -269,7 +266,12 @@ export default function SettingsPage() {
269266
await handleSave('General', data);
270267
}}
271268
isLoading={isSaving}
272-
isPublished={hackathon?.status === 'PUBLISHED'}
269+
isPublished={[
270+
'UPCOMING',
271+
'ACTIVE',
272+
'JUDGING',
273+
'COMPLETED',
274+
].includes(hackathon?.status ?? '')}
273275
/>
274276
</TabsContent>
275277

app/(landing)/organizations/[id]/hackathons/[hackathonId]/submissions/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { useParams } from 'next/navigation';
44
import { useEffect, useState } from 'react';
55
import { Loader2, AlertCircle } from 'lucide-react';
6-
import { useHackathonSubmissions } from '@/hooks/hackathon/use-hackathon-submissions';
6+
import { useOrganizerSubmissions } from '@/hooks/hackathon/use-organizer-submissions';
77
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
88
import { AuthGuard } from '@/components/auth';
99
import Loading from '@/components/Loading';
@@ -26,7 +26,7 @@ export default function SubmissionsPage() {
2626
updateFilters,
2727
goToPage,
2828
refresh,
29-
} = useHackathonSubmissions(hackathonId);
29+
} = useOrganizerSubmissions(hackathonId);
3030

3131
const [currentUserId, setCurrentUserId] = useState<string | null>(null);
3232
const [hackathon, setHackathon] = useState<Hackathon | null>(null);

0 commit comments

Comments
 (0)