diff --git a/app/(landing)/hackathons/[slug]/page.tsx b/app/(landing)/hackathons/[slug]/page.tsx
index 64533e606..60c8b8872 100644
--- a/app/(landing)/hackathons/[slug]/page.tsx
+++ b/app/(landing)/hackathons/[slug]/page.tsx
@@ -10,9 +10,9 @@ import { HackathonBanner } from '@/components/hackathons/hackathonBanner';
import { HackathonNavTabs } from '@/components/hackathons/hackathonNavTabs';
import { HackathonOverview } from '@/components/hackathons/overview/hackathonOverview';
import { HackathonParticipants } from '@/components/hackathons/participants/hackathonParticipant';
-import { HackathonResources } from '@/components/hackathons/resources/resources';
+// import { HackathonResources } from '@/components/hackathons/resources/resources';
import SubmissionTab from '@/components/hackathons/submissions/submissionTab';
-import { HackathonDiscussions } from '@/components/hackathons/discussion/comment';
+// import { HackathonDiscussions } from '@/components/hackathons/discussion/comment';
import { TeamFormationTab } from '@/components/hackathons/team-formation/TeamFormationTab';
import LoadingScreen from '@/components/landing-page/project/CreateProjectModal/LoadingScreen';
import { useTimelineEvents } from '@/hooks/hackathon/use-timeline-events';
@@ -33,18 +33,29 @@ export default function HackathonPage() {
includeEndDate: false,
dateFormat: { month: 'short', day: 'numeric', year: 'numeric' },
});
-
const hackathonTabs = useMemo(() => {
+ const hasParticipants = participants.length > 0;
+ // const hasSubmissions = submissions.filter(p => p.status === 'Approved').length > 0;
+
const tabs = [
{ id: 'overview', label: 'Overview' },
- { id: 'participants', label: 'Participants', badge: participants.length },
- { id: 'resources', label: 'Resources' },
+ ...(hasParticipants
+ ? [
+ {
+ id: 'participants',
+ label: 'Participants',
+ badge: participants.length,
+ },
+ ]
+ : []),
+ // { id: 'resources', label: 'Resources' },
+
{
id: 'submission',
label: 'Submissions',
badge: submissions.filter(p => p.status === 'Approved').length,
},
- { id: 'discussions', label: 'Discussions' },
+ // { id: 'discussions', label: 'Discussions' },
];
const participantType = currentHackathon?.participation?.participantType;
@@ -77,7 +88,14 @@ export default function HackathonPage() {
autoCheck: !!hackathonId,
});
- const isEnded = currentHackathon?.status === '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
const isTeamHackathon =
@@ -180,6 +198,12 @@ export default function HackathonPage() {
hackathonSlugOrId={hackathonId}
organizationId={undefined}
onSuccess={handleRegisterSuccess}
+ participantType={
+ (currentHackathon?.participantType as
+ | 'team'
+ | 'individual'
+ | 'team_or_individual') ?? 'individual'
+ }
/>
)}
@@ -202,19 +226,23 @@ export default function HackathonPage() {
/>
)}
- {activeTab === 'participants' &&
{currentHackathon.information.description}
- )} + )} */} diff --git a/components/hackathons/HackathonsPageHero.tsx b/components/hackathons/HackathonsPageHero.tsx index 880692390..3790f4354 100644 --- a/components/hackathons/HackathonsPageHero.tsx +++ b/components/hackathons/HackathonsPageHero.tsx @@ -41,7 +41,7 @@ export default function HackathonsPageHero() { }; const handleCreateHackathon = () => { - router.push('/hackathons/create'); + router.push('/organizations'); }; return ( diff --git a/components/hackathons/hackathonBanner.tsx b/components/hackathons/hackathonBanner.tsx index f12b8776d..2ae7873ae 100644 --- a/components/hackathons/hackathonBanner.tsx +++ b/components/hackathons/hackathonBanner.tsx @@ -6,6 +6,8 @@ import { Button } from '@/components/ui/button'; import { formatDate } from '@/lib/utils'; import { useEffect, useState, useRef } from 'react'; import { FileText, Users, ArrowRight } from 'lucide-react'; +import { useAuthStatus } from '@/hooks/use-auth'; +import { useRouter } from 'next/navigation'; // import { sanitizeHtml } from '@/lib/utils/renderHtml'; interface HackathonBannerProps { @@ -139,6 +141,9 @@ export function HackathonBanner({ total: 0, }); + const { isAuthenticated } = useAuthStatus(); + const router = useRouter(); + const getStatusColor = () => { switch (status) { case 'Ongoing': @@ -157,6 +162,10 @@ export function HackathonBanner({ } }; + const handleRedirectToAuthScreen = () => { + router.push('/auth?mode=signin'); + }; + const getDeadlineInfo = () => { const days = timeRemaining.days; @@ -333,30 +342,59 @@ export function HackathonBanner({ )} {/* Action Buttons */} - {!isEnded && ( -