Skip to content

Commit ca36f2f

Browse files
authored
Fix hackathon (#366)
* fix: modify api.ts * fix: remove google auth buttom * fix: fixes responsive fixes on organization * fix: minor fixes * fix: modify create organization * fix: modify create organization * fix: fix organization permission * fix: merge into main * feat: hackathon overview page * feat: hackathon overview page * feat: implement participant overview * feat: implement participant overview * feat: implement resources tab * feat: implement the submission tab * feat: implement comment tab * fix: implement provider for hackathon * fix: implement provider for hackathon * fix: minor fixes * fix: hackathon banner * fix: hackathon banner * fix: fix organization page * fix: fix organization page * fix: use transform * fix: add tagline * fix: add tagline * fix: minor fixes * fix: minor fixes * fix: fix timeline and prizes * fix: correct timeline events * fix: implement registration deadline policy * fix: implement registration deadline policy * feat: implement leave hackathon * feat: implement leave hackathon * fix: delete hackathon * fix: implement invite participants * fix: implement participant profile viewing * feat: fetch participants team * fix: redesign hackathon banner * fix: fix hackthon card * fix: fix search bar in blog page * fix: fix search bar in blog page * fix: fix search bar in blog page * fix: fix error in fetching team posts * feat: implement create team, get my team * feat: implement create team, get my team * feat: implement hackathon project submission flow * feat: implement voting for submission
1 parent e714497 commit ca36f2f

24 files changed

Lines changed: 2421 additions & 540 deletions

File tree

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
'use client';
2+
3+
import { useParams } from 'next/navigation';
4+
import { useEffect } from 'react';
5+
import { Loader2, AlertCircle } from 'lucide-react';
6+
import { useHackathonSubmissions } from '@/hooks/hackathon/use-hackathon-submissions';
7+
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
8+
import { AuthGuard } from '@/components/auth';
9+
import Loading from '@/components/Loading';
10+
import { SubmissionsManagement } from '@/components/organization/hackathons/submissions/SubmissionsManagement';
11+
12+
export default function SubmissionsPage() {
13+
const params = useParams();
14+
const hackathonId = params.hackathonId as string;
15+
16+
const {
17+
submissions,
18+
pagination,
19+
filters,
20+
loading,
21+
error,
22+
fetchSubmissions,
23+
updateFilters,
24+
goToPage,
25+
refresh,
26+
} = useHackathonSubmissions(hackathonId);
27+
28+
useEffect(() => {
29+
if (hackathonId) {
30+
fetchSubmissions();
31+
}
32+
}, [hackathonId, fetchSubmissions]);
33+
34+
if (error) {
35+
return (
36+
<div className='flex min-h-screen items-center justify-center bg-black p-6'>
37+
<Alert
38+
variant='destructive'
39+
className='max-w-md border-red-900/20 bg-red-950/20'
40+
>
41+
<AlertCircle className='h-4 w-4' />
42+
<AlertTitle>Unable to load submissions</AlertTitle>
43+
<AlertDescription className='text-sm text-gray-400'>
44+
{error}
45+
</AlertDescription>
46+
</Alert>
47+
</div>
48+
);
49+
}
50+
51+
return (
52+
<AuthGuard redirectTo='/auth?mode=signin' fallback={<Loading />}>
53+
<div className='min-h-screen bg-black'>
54+
{/* Header */}
55+
<div className='border-b border-gray-900 p-4'>
56+
<div className='mx-auto max-w-7xl'>
57+
<h1 className='text-3xl font-light tracking-tight text-white sm:text-4xl'>
58+
Submissions
59+
</h1>
60+
<p className='mt-2 text-sm text-gray-400'>
61+
View and manage all hackathon submissions
62+
</p>
63+
</div>
64+
</div>
65+
66+
{/* Main Content */}
67+
<div className='mx-auto max-w-7xl px-6 py-12 sm:px-8 lg:px-12'>
68+
{loading && submissions.length === 0 ? (
69+
<div className='flex items-center justify-center py-20'>
70+
<div className='flex flex-col items-center gap-3'>
71+
<Loader2 className='h-6 w-6 animate-spin text-gray-400' />
72+
<p className='text-sm text-gray-500'>Loading submissions...</p>
73+
</div>
74+
</div>
75+
) : (
76+
<SubmissionsManagement
77+
submissions={submissions}
78+
pagination={pagination}
79+
filters={filters}
80+
loading={loading}
81+
onFilterChange={updateFilters}
82+
onPageChange={goToPage}
83+
onRefresh={refresh}
84+
/>
85+
)}
86+
</div>
87+
</div>
88+
</AuthGuard>
89+
);
90+
}

0 commit comments

Comments
 (0)