Skip to content

Commit 867d7b0

Browse files
authored
Fix hackathon (#375)
* 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 * fix: team formation updates * fix: implement team invitation * feat: hackathon submissions bulk actions, ranking and ui refinements
1 parent b01a431 commit 867d7b0

21 files changed

Lines changed: 1641 additions & 435 deletions

File tree

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

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ import { toast } from 'sonner';
1919
import type { Participant } from '@/lib/api/hackathons';
2020
import { HackathonStickyCard } from '@/components/hackathons/hackathonStickyCard';
2121
import { HackathonParticipants } from '@/components/hackathons/participants/hackathonParticipant';
22+
import { useCommentSystem } from '@/hooks/use-comment-system';
23+
import { CommentEntityType } from '@/types/comment';
24+
import { useTeamPosts } from '@/hooks/hackathon/use-team-posts';
2225

2326
export default function HackathonPage() {
2427
const router = useRouter();
@@ -38,6 +41,26 @@ export default function HackathonPage() {
3841
dateFormat: { month: 'short', day: 'numeric', year: 'numeric' },
3942
});
4043

44+
const hackathonId = params.slug as string;
45+
const [activeTab, setActiveTab] = useState('overview');
46+
const [showRegisterModal, setShowRegisterModal] = useState(false);
47+
48+
// Fetch discussion comments for count
49+
const { comments: discussionComments } = useCommentSystem({
50+
entityType: CommentEntityType.HACKATHON,
51+
entityId: hackathonId,
52+
page: 1,
53+
limit: 1000,
54+
enabled: !!hackathonId,
55+
});
56+
57+
// Fetch team posts for count
58+
const { posts: teamPosts } = useTeamPosts({
59+
hackathonSlugOrId: hackathonId,
60+
organizationId: currentHackathon?.organizationId,
61+
autoFetch: !!hackathonId,
62+
});
63+
4164
const hackathonTabs = useMemo(() => {
4265
const hasParticipants =
4366
Array.isArray(currentHackathon?.participants) &&
@@ -77,11 +100,19 @@ export default function HackathonPage() {
77100
label: 'Submissions',
78101
badge: submissions.filter(p => p.status === 'Approved').length,
79102
},
80-
{ id: 'discussions', label: 'Discussions' },
103+
{
104+
id: 'discussions',
105+
label: 'Discussions',
106+
badge: discussionComments.comments.length,
107+
},
81108
];
82109

83110
if (isTeamHackathon && isTabEnabled) {
84-
tabs.push({ id: 'team-formation', label: 'Find Team' });
111+
tabs.push({
112+
id: 'team-formation',
113+
label: 'Find Team',
114+
badge: teamPosts.length,
115+
});
85116
}
86117

87118
return tabs;
@@ -90,13 +121,13 @@ export default function HackathonPage() {
90121
currentHackathon?.resources,
91122
currentHackathon?.participantType,
92123
currentHackathon?.enabledTabs,
124+
currentHackathon?.organizationId,
93125
submissions,
126+
discussionComments.comments.length,
127+
teamPosts.length,
128+
hackathonId,
94129
]);
95130

96-
const hackathonId = params.slug as string;
97-
const [activeTab, setActiveTab] = useState('overview');
98-
const [showRegisterModal, setShowRegisterModal] = useState(false);
99-
100131
// Refresh hackathon data
101132
const refreshHackathonData = useCallback(async () => {
102133
if (hackathonId && refreshCurrentHackathon) {

0 commit comments

Comments
 (0)