Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
f4dcdc0
fix: modify api.ts
Benjtalkshow Oct 14, 2025
b90d4ed
Merge branch 'main' of https://github.com/Benjtalkshow/boundless into…
Benjtalkshow Oct 16, 2025
9ea81a5
Merge branch 'main' of https://github.com/Benjtalkshow/boundless into…
Benjtalkshow Oct 16, 2025
5be269f
fix: remove google auth buttom
Benjtalkshow Oct 16, 2025
490dcb2
Merge branch 'main' of https://github.com/Benjtalkshow/boundless into…
Benjtalkshow Oct 20, 2025
842fd48
fix: fixes responsive fixes on organization
Benjtalkshow Oct 20, 2025
596a7f8
fix: minor fixes
Benjtalkshow Nov 6, 2025
96fee24
fix: minor fixes
Benjtalkshow Nov 6, 2025
9dfb149
fix: modify create organization
Benjtalkshow Nov 7, 2025
a194d90
fix: modify create organization
Benjtalkshow Nov 7, 2025
b2ceee0
fix: fix organization permission
Benjtalkshow Nov 8, 2025
9ea97d1
fix: merge into main
Benjtalkshow Nov 8, 2025
adb4629
Merge branch 'main' of https://github.com/Benjtalkshow/boundless into…
Benjtalkshow Nov 8, 2025
0c11420
fix: merge into main
Benjtalkshow Nov 8, 2025
1f5ec24
feat: hackathon overview page
Benjtalkshow Nov 11, 2025
bca1ef6
feat: hackathon overview page
Benjtalkshow Nov 11, 2025
9202b4f
feat: implement participant overview
Benjtalkshow Nov 12, 2025
096f265
feat: implement participant overview
Benjtalkshow Nov 12, 2025
b3478d0
feat: implement resources tab
Benjtalkshow Nov 12, 2025
e83a0be
feat: implement the submission tab
Benjtalkshow Nov 12, 2025
398be9b
feat: implement comment tab
Benjtalkshow Nov 12, 2025
de546b1
fix: implement provider for hackathon
Benjtalkshow Nov 14, 2025
0fd2690
fix: implement provider for hackathon
Benjtalkshow Nov 14, 2025
0d7417f
fix: minor fixes
Benjtalkshow Nov 15, 2025
4d3efee
fix: merge branch 'main' of https://github.com/Benjtalkshow/boundless…
Benjtalkshow Nov 15, 2025
83893e4
fix: hackathon banner
Benjtalkshow Nov 15, 2025
8013d62
fix: hackathon banner
Benjtalkshow Nov 15, 2025
3fb1323
fix: fix hackthon conflict
Benjtalkshow Nov 15, 2025
b7fc94f
Merge branch 'main' of https://github.com/Benjtalkshow/boundless into…
Benjtalkshow Nov 15, 2025
0594ac8
Merge branch 'main' of https://github.com/Benjtalkshow/boundless into…
Benjtalkshow Nov 15, 2025
7e08bc1
fix: fix organization page
Benjtalkshow Nov 15, 2025
22c12c1
fix: fix organization page
Benjtalkshow Nov 16, 2025
08e5be5
fix: fix organization page
Benjtalkshow Nov 16, 2025
8e6bded
Merge branch 'main' of https://github.com/Benjtalkshow/boundless into…
Benjtalkshow Nov 16, 2025
5e6c9e6
fix: use transform
Benjtalkshow Nov 17, 2025
9135f2e
Merge branch 'main' of https://github.com/Benjtalkshow/boundless into…
Benjtalkshow Nov 17, 2025
c2409f4
fix: add tagline
Benjtalkshow Nov 18, 2025
b08579a
fix: add tagline
Benjtalkshow Nov 18, 2025
4b8ef58
fix: fix conflict
Benjtalkshow Nov 18, 2025
0ee756e
Merge branch 'main' of https://github.com/Benjtalkshow/boundless into…
Benjtalkshow Nov 19, 2025
ab0384d
fix: minor fixes
Benjtalkshow Nov 20, 2025
91b5c18
Merge branch 'main' of https://github.com/Benjtalkshow/boundless into…
Benjtalkshow Nov 20, 2025
67c9fee
fix: minor fixes
Benjtalkshow Nov 21, 2025
9b2029b
Merge branch 'main' of https://github.com/Benjtalkshow/boundless into…
Benjtalkshow Nov 21, 2025
1fca425
fix: fix timeline and prizes
Benjtalkshow Nov 23, 2025
3c057a0
Merge branch 'main' of https://github.com/Benjtalkshow/boundless into…
Benjtalkshow Nov 23, 2025
a75f5ee
fix: correct timeline events
Benjtalkshow Nov 26, 2025
da0d27f
Merge branch 'main' of https://github.com/Benjtalkshow/boundless into…
Benjtalkshow Nov 26, 2025
3a0c19b
fix: implement registration deadline policy
Benjtalkshow Nov 27, 2025
c616182
fix: implement registration deadline policy
Benjtalkshow Nov 27, 2025
9a98077
fix: implement registration deadline policy
Benjtalkshow Nov 27, 2025
3ac17f8
Merge branch 'main' of https://github.com/Benjtalkshow/boundless into…
Benjtalkshow Nov 28, 2025
386a338
feat: implement leave hackathon
Benjtalkshow Nov 28, 2025
f4ed466
feat: implement leave hackathon
Benjtalkshow Nov 28, 2025
12a1705
feat: implement leave hackathon
Benjtalkshow Nov 28, 2025
dd60321
fix: delete hackathon
Benjtalkshow Nov 28, 2025
a4e22b0
Merge branch 'main' of https://github.com/Benjtalkshow/boundless into…
Benjtalkshow Nov 28, 2025
19dd6ee
fix: implement invite participants
Benjtalkshow Nov 30, 2025
8211c60
Merge branch 'main' of https://github.com/Benjtalkshow/boundless into…
Benjtalkshow Nov 30, 2025
fdebd0b
fix: implement participant profile viewing
Benjtalkshow Dec 1, 2025
f7fad5c
feat: fetch participants team
Benjtalkshow Dec 1, 2025
c110717
Merge branch 'main' of https://github.com/Benjtalkshow/boundless into…
Benjtalkshow Dec 1, 2025
68b1a2d
fix: redesign hackathon banner
Benjtalkshow Dec 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
211 changes: 112 additions & 99 deletions app/(landing)/hackathons/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import { useRegisterHackathon } from '@/hooks/hackathon/use-register-hackathon';
import { useLeaveHackathon } from '@/hooks/hackathon/use-leave-hackathon';
import { RegisterHackathonModal } from '@/components/hackathons/overview/RegisterHackathonModal';

import { HackathonBanner } from '@/components/hackathons/hackathonBanner';
import { HackathonNavTabs } from '@/components/hackathons/hackathonNavTabs';
import { HackathonOverview } from '@/components/hackathons/overview/hackathonOverview';
Expand All @@ -18,8 +17,8 @@
import LoadingScreen from '@/components/landing-page/project/CreateProjectModal/LoadingScreen';
import { useTimelineEvents } from '@/hooks/hackathon/use-timeline-events';
import { toast } from 'sonner';
import { Participant } from '@/lib/api/hackathons';
// import { HackathonResources } from '@/components/hackathons/resources/resources';
import type { Participant } from '@/lib/api/hackathons';
import { HackathonStickyCard } from '@/components/hackathons/hackathonStickyCard';

export default function HackathonPage() {
const router = useRouter();
Expand Down Expand Up @@ -64,7 +63,6 @@
},
]
: []),

{
id: 'submission',
label: 'Submissions',
Expand All @@ -76,7 +74,6 @@
const participantType = currentHackathon?.participation?.participantType;
const isTeamHackathon =
participantType === 'team' || participantType === 'team_or_individual';

const isTabEnabled =
currentHackathon?.participation?.tabVisibility?.joinATeamTab !== false;

Expand All @@ -85,7 +82,7 @@
}

return tabs;
}, [

Check warning on line 85 in app/(landing)/hackathons/[slug]/page.tsx

View workflow job for this annotation

GitHub Actions / Code Quality & Linting

React Hook useMemo has a missing dependency: 'currentHackathon?.resources?.resources'. Either include it or remove the dependency array
participants.length,
submissions,
currentHackathon?.participation?.participantType,
Expand All @@ -96,19 +93,18 @@
const [activeTab, setActiveTab] = useState('overview');
const [showRegisterModal, setShowRegisterModal] = useState(false);

// Function to refresh all hackathon data
// Refresh hackathon data
const refreshHackathonData = useCallback(async () => {
if (hackathonId && refreshCurrentHackathon) {
await refreshCurrentHackathon();
}
}, [hackathonId, refreshCurrentHackathon]);

// Registration logic - use the updated hook with setters
// Registration status
const {
isRegistered,
hasSubmitted,
checkStatus,
// isChecking,
setIsRegistered,
setParticipant,
} = useRegisterHackathon({
Expand All @@ -117,29 +113,29 @@
autoCheck: !!hackathonId,
});

// Leave hackathon logic
// Leave hackathon functionality
const { isLeaving, leave: leaveHackathon } = useLeaveHackathon({
hackathonSlugOrId: hackathonId,
organizationId: undefined,
});

const isEnded = useMemo(() => {
if (!currentHackathon?.deadline) return false;
const deadline = new Date(currentHackathon.deadline);
const now = new Date();
return now > deadline;
}, [currentHackathon?.deadline]);
// Check if hackathon has ended
// const isEnded = useMemo(() => {
// if (!currentHackathon?.deadline) return false
// const deadline = new Date(currentHackathon.deadline)
// const now = new Date()
// return now > deadline
// }, [currentHackathon?.deadline])

// Check if team formation is available
// Team formation availability
const isTeamHackathon =
currentHackathon?.participation?.participantType === 'team' ||
currentHackathon?.participation?.participantType === 'team_or_individual';

const isTeamFormationEnabled =
isTeamHackathon &&
currentHackathon?.participation?.tabVisibility?.joinATeamTab !== false;

// Button handlers
// Event handlers
const handleJoinClick = () => {
setShowRegisterModal(true);
};
Expand All @@ -148,11 +144,8 @@
try {
setIsRegistered(false);
setParticipant(null);

await leaveHackathon();

refreshHackathonData();

router.push('?tab=overview');
} catch (error) {
const errorMessage =
Expand All @@ -164,13 +157,9 @@
};

const handleRegisterSuccess = async (participantData: Participant) => {
// IMMEDIATELY update state with the returned participant data
setIsRegistered(true);
setParticipant(participantData);

// Refresh hackathon data in background (participants count)
await refreshHackathonData();

router.push('?tab=submission');
};

Expand All @@ -186,12 +175,14 @@
router.push('?tab=team-formation');
};

// Set current hackathon on mount
useEffect(() => {
if (hackathonId) {
setCurrentHackathon(hackathonId);
}
}, [hackathonId, setCurrentHackathon]);

// Handle tab changes from URL
useEffect(() => {
const tabFromUrl = searchParams.get('tab');
if (tabFromUrl && hackathonTabs.some(tab => tab.id === tabFromUrl)) {
Expand All @@ -206,10 +197,12 @@
router.push(`?${params.toString()}`, { scroll: false });
};

// Loading state
if (loading) {
return <LoadingScreen />;
}

// Hackathon not found
if (!currentHackathon) {
return (
<div className='flex min-h-screen items-center justify-center'>
Expand All @@ -225,33 +218,100 @@
);
}

// Shared props for banner and sticky card
const sharedActionProps = {
deadline: currentHackathon.deadline,
startDate: currentHackathon.startDate,
totalPrizePool: currentHackathon.totalPrizePool,
isRegistered,
hasSubmitted,
isTeamFormationEnabled,
registrationDeadlinePolicy: currentHackathon.registrationDeadlinePolicy as
| 'before_start'
| 'before_submission_deadline'
| 'custom',
registrationDeadline: currentHackathon.registrationDeadline,
onJoinClick: handleJoinClick,
onLeaveClick: handleLeaveClick,
isLeaving,
onSubmitClick: handleSubmitClick,
onViewSubmissionClick: handleViewSubmissionClick,
onFindTeamClick: handleFindTeamClick,
};

return (
<div className='mx-auto mt-10 max-w-[1440px] px-5 py-5 text-center text-4xl font-bold text-white md:px-[50px] lg:px-[100px]'>
{/* Banner */}
<HackathonBanner
title={currentHackathon.title}
tagline={currentHackathon.tagline}
deadline={currentHackathon.deadline}
categories={currentHackathon.categories}
status={currentHackathon.status}
participants={currentHackathon.participants}
totalPrizePool={currentHackathon.totalPrizePool}
imageUrl={currentHackathon.imageUrl}
startDate={currentHackathon.startDate}
endDate={currentHackathon.endDate}
isRegistered={isRegistered}
hasSubmitted={hasSubmitted}
isEnded={isEnded}
registrationDeadlinePolicy={currentHackathon.registrationDeadlinePolicy}
registrationDeadline={currentHackathon.registrationDeadline}
isTeamFormationEnabled={isTeamFormationEnabled}
onJoinClick={handleJoinClick}
onLeaveClick={handleLeaveClick}
isLeaving={isLeaving}
onSubmitClick={handleSubmitClick}
onViewSubmissionClick={handleViewSubmissionClick}
onFindTeamClick={handleFindTeamClick}
/>
<div className='mx-auto mt-10 max-w-[1440px] px-5 py-5 md:px-[50px] lg:px-[100px]'>
<div className='grid grid-cols-1 gap-6 lg:grid-cols-3'>
{/* Main Content (2/3 width on desktop) */}
<div className='lg:col-span-2'>
{/* Banner - Shows on all screens */}
<HackathonBanner
title={currentHackathon.title}
tagline={currentHackathon.tagline}
imageUrl={currentHackathon.imageUrl}
categories={currentHackathon.categories}
participants={currentHackathon.participants}
{...sharedActionProps}
/>

{/* Navigation Tabs */}
<HackathonNavTabs
tabs={hackathonTabs}
activeTab={activeTab}
onTabChange={handleTabChange}
/>

{/* Tab Content */}
<div className='py-12 text-left text-white'>
{activeTab === 'overview' && (
<HackathonOverview
content={currentHackathon.description}
timelineEvents={timeline_Events}
prizes={currentHackathon.prizeTiers}
totalPrizePool={currentHackathon.totalPrizePool}
hackathonSlugOrId={hackathonId}
venue={currentHackathon.venue}
/>
)}

{activeTab === 'participants' && participants.length > 0 && (
<HackathonParticipants />
)}

{activeTab === 'submission' && (
<SubmissionTab
hackathonSlugOrId={hackathonId}
isRegistered={isRegistered}
/>
)}

{activeTab === 'discussions' && (
<HackathonDiscussions
hackathonId={hackathonId}
isRegistered={isRegistered}
/>
)}

{activeTab === 'team-formation' && (
<TeamFormationTab hackathonSlugOrId={hackathonId} />
)}

{activeTab === 'resources' &&
currentHackathon?.resources?.resources?.[0] && (
<HackathonResources hackathonSlugOrId={hackathonId} />
)}
</div>
</div>

{/* Sidebar - Sticky Card (1/3 width on desktop, hidden on mobile) */}
<div className='lg:col-span-1'>
<HackathonStickyCard
title={currentHackathon.title}
imageUrl={currentHackathon.imageUrl}
{...sharedActionProps}
/>
</div>
</div>

{/* Registration Modal */}
{hackathonId && (
Expand All @@ -260,7 +320,7 @@
onOpenChange={setShowRegisterModal}
hackathonSlugOrId={hackathonId}
organizationId={undefined}
onSuccess={handleRegisterSuccess} // Now passes participant data
onSuccess={handleRegisterSuccess}
participantType={
(currentHackathon?.participantType as
| 'team'
Expand All @@ -269,53 +329,6 @@
}
/>
)}

{/* Tabs */}
<HackathonNavTabs
tabs={hackathonTabs}
activeTab={activeTab}
onTabChange={handleTabChange}
/>

{/* Content */}
<div className='mx-auto max-w-7xl px-6 py-12 text-white'>
{activeTab === 'overview' && (
<HackathonOverview
content={currentHackathon.description}
timelineEvents={timeline_Events}
prizes={currentHackathon.prizeTiers}
totalPrizePool={currentHackathon.totalPrizePool}
hackathonSlugOrId={hackathonId}
venue={currentHackathon.venue}
/>
)}

{activeTab === 'participants' && participants.length > 0 && (
<HackathonParticipants />
)}

{activeTab === 'submission' && (
<SubmissionTab
hackathonSlugOrId={hackathonId}
isRegistered={isRegistered}
/>
)}

{activeTab === 'discussions' && (
<HackathonDiscussions
hackathonId={hackathonId}
isRegistered={isRegistered}
/>
)}

{activeTab === 'team-formation' && (
<TeamFormationTab hackathonSlugOrId={hackathonId} />
)}
{activeTab === 'resources' &&
currentHackathon?.resources?.resources?.[0] && (
<HackathonResources hackathonSlugOrId={hackathonId} />
)}
</div>
</div>
);
}
2 changes: 1 addition & 1 deletion app/(landing)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function LandingPage() {
return (
<div className='relative overflow-hidden'>
<BeamBackground />
<div className='relative z-10 mx-auto max-w-[1440px] space-y-[60px] px-5 py-5 md:space-y-[80px] md:px-[50px] lg:px-[100px]'>
<div className='relative z-10 mx-auto max-w-[1440px] space-y-[60px] px-5 pt-0 pb-5 md:space-y-[80px] md:px-[50px] lg:px-[100px]'>
{/* <Hero /> */}
<Hero2 />
<Explore />
Expand Down
Loading
Loading