Skip to content

Commit 5694dab

Browse files
0xdevcollinsBenjtalkshowclaude
authored
Enhance hackathon submission features and UI improvements (#581)
* fix(hackathons): single-column teams tab and primary-colored pager (#562) * fix(hackathons): single-column teams tab and primary-colored pager Revert the teams tab grid to a single column and rework the shared Pagination component to match the icon-chevron layout used by the organizer submissions and participants pages, styled with the primary color. * feat(submissions): link submission card avatars to profile pages Wrap the individual avatar on SubmissionCard in a profile link and forward team-member usernames to GroupAvatar so each clustered avatar opens that user's profile in a new tab. * feat(hackathons): track-based prize structure + submission polish + tracks UI (#564) * feat(hackathons): add "hidden until results" submission visibility mode Surfaces the new HIDDEN_UNTIL_RESULTS option (added in the nestjs PR) in the organizer settings tab. Reorders the three visibility options so the recommended "Shortlisted only" leads, the new "Hidden until results are announced" sits in the middle, and "All submissions" comes last. Rewrites the copy on the "All submissions" choice that incorrectly claimed disqualified projects would be shown -- they never were on the backend, and Phase 2 makes that an explicit guarantee. Aligns the form's default and API-fallback value with the backend default (ACCEPTED_SHORTLISTED, not ALL) so organizers don't see a misleading initial selection. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(hackathons): track-based prize structure, submission polish, tracks UI Wires the frontend for the new track-based prize flow: - New TracksSettingsTab with full CRUD: name/slug/description/eligibility/ prompt/customQuestions/requiredArtifacts; per-row bulk-opt-in action with confirmation dialog for retrofitting existing submissions - RewardsTab gains a 3-card prize structure picker, per-tier kind toggle and track dropdown, amber "tracks unbound" banner, and an inline Manage Tracks dialog embedding the settings table - SubmissionForm: track picker + per-track answers (prompt / custom questions / required artifacts), tagline, builtWith chips, screenshots, license, code attestation, with soft compliance gate for already-submitted submissions. trackIds hydrate from trackEntries on edit so bulk-opted-in submitters don't strip themselves out - SubmissionDetailModal renders tagline, screenshots, built-with, license badge, and per-track answers - Public hackathon page: Overview splits prizes into Overall/Track sections; sidebar tier list shows TRACK prefix and looks up track names; Winners tab gets a Track Winners section with per-track cards - API client: lib/api/hackathons/tracks.ts with listTracks / listOrganizerTracks / createTrack / updateTrack / deleteTrack / bulkOptInAllSubmissions, plus types for HackathonTrack, TrackCustomQuestion, TrackRequiredArtifact, TrackAnswer, SubmissionTrackEntry, BulkOptInResult - Hackathon provider/hooks expose trackWinners and per-track entries Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Feat/submission visibility hidden until results (#566) * feat(hackathons): add "hidden until results" submission visibility mode Surfaces the new HIDDEN_UNTIL_RESULTS option (added in the nestjs PR) in the organizer settings tab. Reorders the three visibility options so the recommended "Shortlisted only" leads, the new "Hidden until results are announced" sits in the middle, and "All submissions" comes last. Rewrites the copy on the "All submissions" choice that incorrectly claimed disqualified projects would be shown -- they never were on the backend, and Phase 2 makes that an explicit guarantee. Aligns the form's default and API-fallback value with the backend default (ACCEPTED_SHORTLISTED, not ALL) so organizers don't see a misleading initial selection. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(hackathons): track-based prize structure, submission polish, tracks UI Wires the frontend for the new track-based prize flow: - New TracksSettingsTab with full CRUD: name/slug/description/eligibility/ prompt/customQuestions/requiredArtifacts; per-row bulk-opt-in action with confirmation dialog for retrofitting existing submissions - RewardsTab gains a 3-card prize structure picker, per-tier kind toggle and track dropdown, amber "tracks unbound" banner, and an inline Manage Tracks dialog embedding the settings table - SubmissionForm: track picker + per-track answers (prompt / custom questions / required artifacts), tagline, builtWith chips, screenshots, license, code attestation, with soft compliance gate for already-submitted submissions. trackIds hydrate from trackEntries on edit so bulk-opted-in submitters don't strip themselves out - SubmissionDetailModal renders tagline, screenshots, built-with, license badge, and per-track answers - Public hackathon page: Overview splits prizes into Overall/Track sections; sidebar tier list shows TRACK prefix and looks up track names; Winners tab gets a Track Winners section with per-track cards - API client: lib/api/hackathons/tracks.ts with listTracks / listOrganizerTracks / createTrack / updateTrack / deleteTrack / bulkOptInAllSubmissions, plus types for HackathonTrack, TrackCustomQuestion, TrackRequiredArtifact, TrackAnswer, SubmissionTrackEntry, BulkOptInResult - Hackathon provider/hooks expose trackWinners and per-track entries Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(submissions): tighten Zod schema + surface backend debug info - Add max constraints that previously only existed on the backend DTO so validation fires inline (projectName 100, description 5000, URL 500). - ApiErrorField gains an optional `debug` field that the backend Prisma filter populates outside production. - useSubmission's error formatter prefers `debug` over the generic field message when present, so toasts show the real Prisma reason behind "Data validation failed" instead of a blank "validation: …" line. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(submit-page): hydrate Phase A fields + stop wiping user input on re-render The submit page mapped `initialData` inline on every render, which (a) recreated the object reference on every render so the form's reset effect fired continuously and wiped values the user was typing, and (b) dropped the Phase A fields entirely (tagline, builtWith, screenshots, license, codeAttestedAt) plus trackEntries. The combined effect was the documented symptom — only logo and videoUrl survived the save because those round-tripped through the type-narrowed object literal, while tagline / builtWith / license kept appearing to "switch to empty". - Memoize `initialData` against `mySubmission` so the reference only changes when the underlying submission actually changes. - Pass through Phase A fields and trackEntries so the form can hydrate the saved values, and so a follow-up save doesn't write back empties. - Widen SubmissionFormContent's `initialData` prop to accept the raw server-side extras (trackEntries, codeAttestedAt) that the form already consumes via cast — keeps the parent's hydration explicit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(hackathons): always open submissions in a new tab (#568) * fix(hackathons): single-column teams tab and primary-colored pager Revert the teams tab grid to a single column and rework the shared Pagination component to match the icon-chevron layout used by the organizer submissions and participants pages, styled with the primary color. * feat(submissions): link submission card avatars to profile pages Wrap the individual avatar on SubmissionCard in a profile link and forward team-member usernames to GroupAvatar so each clustered avatar opens that user's profile in a new tab. * fix(hackathons): always open submissions in a new tab Across the hackathon, organizer, judge, and profile surfaces, clicking a submission now opens the project page in a new tab so reviewers and participants do not lose their list/queue context. Switched the remaining anchor tags to next/link Link components. * feat(judging): organizer dashboard — coverage, preview, per-track results (#570) (#572) Pairs with boundless-nestjs feat(judging) organizer dashboard upgrades. Adds three new components to the organizer judging page; no changes to existing components, judges, or scoring flows. - `CoverageMatrix` — heatmap on the Overview tab. Rows are submissions, columns are judges. Surfaces idle judges (mostly-empty columns) and orphan submissions (rows with 0-1 scores) at a glance — both block a defensible publish. - `AllocationPreviewCard` — sits above the Publish button on the Results tab. Read-only allocator dry-run showing overall placements + per-track winners exactly as publish-results would commit. Calls out EXCLUSIVE stacking effects (track leader losing to overall), plus surfaces publish gates (deadline, completeness, partner allocation) so the organizer sees blockers without attempting to publish. - `TrackResultsSection` — per-track collapsible standings on the Results tab. Each section is scoped to a track's opt-ins, sorted by averageScore, with the bound prize tier shown as a chip. The leader is highlighted as the current pick — soft preview only; the Allocation Preview above shows the authoritative EXCLUSIVE-stacked outcome. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(judging): unallocated partner funds become a warning, not a blocker (#574) Mirrors the backend relaxation. The allocator preview's "Ready to publish" badge previously turned amber whenever any partner contribution had unallocated balance — but the backend gate that backed that signal has been relaxed (the funds stay in escrow post-publish; they're not lost). Split the existing publish-readiness messaging into two lists: - Blockers — the hard gates (deadline, completeness, no reviews). Same red treatment, same ready-to-publish badge logic. - Warnings — informational, never blocks. Renders in blue, calls out the unallocated amount with a note that it remains in escrow. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(rewards): show track winners on the organizer rewards page (#576) The rewards page was filtering winners by `submission.rank` only, so on the track-based prize structure it silently dropped every track winner. For the Boundless × Trustless Work hackathon (3 overall + 5 track tiers), the page rendered 3 of 8 winners and the publish wizard preview showed 3 of 8 prize tiers paired. Same root cause as boundlessfi/boundless-nestjs#132: track winners live on `SubmissionTrackEntry.wonRank`, not on `submission.rank`, and the rewards UI was rank-keyed end to end. Changes: - Extend `Submission` with optional track-winner fields (`isTrackWinner`, `trackId`, `trackName`, `trackPrize`, `trackWonRank`). - `useHackathonRewards` now fetches `getHackathonWinners` in a dedicated effect that runs once results are published. The `trackWinners` payload is stamped onto matching submissions AND returned raw so the page can render a per-track section. - `useHackathonRewards` also preserves `tier.kind` and `tier.trackId` on the mapped `prizeTiers` and re-sorts so track tiers no longer collapse to the 999 fallback rank. - `rewards/page.tsx` winners filter now ORs `s.isTrackWinner` with the rank-based check, and `maxRank` counts only OVERALL tiers so the rank-keyed lookups don't get polluted with synthetic track ranks. - New `TrackWinnersSection` component renders below the existing rank-based `PodiumSection`. Mirrors the public WinnersTab pattern: one card per track with prize chip, project name, team, avatars. - `PublishWinnersWizard` includes track winners in its preview list and threads `kind`/`trackId` through to `WinnersGrid`. - `WinnersGrid` now renders overall + track tiers as separate sections. Overall keeps the 2-1-3 podium re-order; track tiers render in display order. Each tier is matched to its winner via rank OR trackId. Pairs with boundless-nestjs#132 (BE trigger endpoint already respects track winners after that merged). Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(rewards): polish publish-wizard preview to industry-standard layout (#580) The wizard preview's "3/8 Winners Assigned" line plus the existing WinnerCard layout was confusing — "$300 USDC" double-signed the currency, "0 Comments" was meaningless in a payout preview, and track winners got a "4th Position" ribbon they didn't earn. Redesigned to match the patterns Devpost / Devfolio / ETHGlobal use in their publish flows: WinnersGrid header: - Replace the cryptic "X/Y Winners Assigned" with a callout chip: green check + "All N winners assigned" when complete, amber warning + "X of Y assigned (Z unassigned)" when not. - Show the total prize pool ("1,500 USDC pool") as a sibling chip so the organizer sees the dollar figure they're committing. - Render "Overall Placements" as a sub-header only when track winners also exist (avoids redundant heading on OVERALL_ONLY). WinnerCard: - Drop the dollar sign for non-dollar currencies — `"$300 USDC"` is now `"300 USDC"`, a cleaner industry-standard read. - Track winners get a track-name chip ("Best UI/UX") instead of a synthetic-rank ribbon ("4th Position"). - Drop the "0 Comments" noise; not a meaningful signal at payout time. - Drop the placeholder bitmed.png; surface project name + participant name + category as the primary content. - Cards now have consistent dimensions (no podium scaling for tracks), uniform border + hover treatment, prize chip aligned to the right. Only the publish-wizard preview is touched; the public Winners tab and the rewards podium are unchanged. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(hackathons): add judging dataset to export dropdown (#577) Surface a new "Judging" entry alongside the existing export options (Winners, Submissions, etc.) so organizers can download judging criteria, judges, aggregated results, per-judge scores, and judge comments. Requires the matching backend dataset to be deployed. --------- Co-authored-by: Nnaji Benjamin <60315147+Benjtalkshow@users.noreply.github.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Benjtalkshow <chinedubenj@gmail.com>
1 parent 8ac968c commit 5694dab

4 files changed

Lines changed: 199 additions & 125 deletions

File tree

components/organization/hackathons/details/ExportButton.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ const DATASETS = [
5050
label: 'Winners',
5151
description: 'Wallet address, activation & USDC trustline',
5252
},
53+
{
54+
id: 'judging',
55+
label: 'Judging',
56+
description: 'Results, judges, scores & comments',
57+
},
5358
] as const;
5459

5560
export function ExportButton({

components/organization/hackathons/rewards/WinnerCard.tsx

Lines changed: 114 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
'use client';
22

33
import React from 'react';
4-
import Image from 'next/image';
5-
import { ArrowUpRight } from 'lucide-react';
4+
import { Trophy, Layers } from 'lucide-react';
65
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
76
import { Badge } from '@/components/ui/badge';
87
import {
@@ -12,8 +11,7 @@ import {
1211
} from '@/components/ui/tooltip';
1312
import { cn } from '@/lib/utils';
1413
import { Submission } from './types';
15-
import Ribbon from '@/components/svg/Ribbon';
16-
import { getRibbonColors, getRibbonText } from './winnersUtils';
14+
import { getRibbonColors } from './winnersUtils';
1715

1816
interface WinnerCardProps {
1917
rank: number;
@@ -22,123 +20,141 @@ interface WinnerCardProps {
2220
currency?: string;
2321
prizeLabel?: string;
2422
maxRank: number;
23+
/**
24+
* Track name to render as the primary badge instead of the
25+
* rank ribbon. When present, the card switches to track-winner
26+
* styling (no podium scaling, neutral border accent).
27+
*/
28+
trackName?: string;
2529
}
2630

31+
const formatPrize = (amount?: string, currency?: string) => {
32+
if (!amount || amount === '0' || amount === '0.00') return null;
33+
const c = currency || 'USDC';
34+
// Industry-standard format: amount first, single currency suffix.
35+
// The previous "$300 USDC" double-signed the value and read as
36+
// confusing for USDC payouts (USDC is the unit, not USD).
37+
const numeric = Number(amount);
38+
const display = Number.isFinite(numeric)
39+
? numeric.toLocaleString('en-US')
40+
: amount;
41+
return `${display} ${c}`;
42+
};
43+
44+
const ordinalSuffix = (rank: number) => {
45+
const j = rank % 10;
46+
const k = rank % 100;
47+
if (j === 1 && k !== 11) return 'st';
48+
if (j === 2 && k !== 12) return 'nd';
49+
if (j === 3 && k !== 13) return 'rd';
50+
return 'th';
51+
};
52+
2753
export default function WinnerCard({
2854
rank,
2955
winner,
3056
prizeAmount,
3157
currency,
3258
prizeLabel,
3359
maxRank,
60+
trackName,
3461
}: WinnerCardProps) {
35-
const getScaleClass = () => {
36-
if (maxRank <= 3) {
37-
if (rank === 1) return 'md:scale-110';
38-
if (rank === 2 || rank === 3) return 'md:scale-95';
39-
} else {
40-
if (rank === 1) return 'md:scale-105';
41-
}
42-
return '';
43-
};
62+
const isTrack = !!trackName;
63+
const prizeText = formatPrize(prizeAmount, currency) || prizeLabel || null;
64+
const ribbonColors = getRibbonColors(rank);
65+
66+
// Subtle scale only for overall podium (rank 1-3). Track cards stay
67+
// uniform — they're a flat sibling row, not a podium.
68+
const scaleClass =
69+
!isTrack && rank === 1 && maxRank <= 3 ? 'md:scale-105' : '';
4470

4571
return (
4672
<div
4773
className={cn(
48-
'bg-background-card relative w-fit overflow-hidden rounded-lg p-4 transition-transform',
49-
getScaleClass()
74+
'bg-background-card relative flex flex-col gap-3 overflow-hidden rounded-xl border border-white/5 p-4 transition-all hover:border-white/10',
75+
scaleClass
5076
)}
5177
>
52-
<div className='mb-3 flex items-center justify-center gap-2'>
53-
<Image
54-
src='/trophy.svg'
55-
alt='Trophy'
56-
width={16}
57-
height={16}
58-
className='h-4 w-4 text-yellow-400'
59-
/>
60-
<span className='text-primary text-base font-medium'>
61-
{prizeAmount != null && currency && prizeAmount !== '0'
62-
? `$${prizeAmount} ${currency}`
63-
: prizeLabel || 'No prize configured'}
64-
</span>
65-
</div>
66-
67-
<div className='mb-3 flex justify-center'>
68-
<Avatar className='h-16 w-16'>
69-
{winner ? (
70-
<>
71-
<AvatarImage
72-
src={winner.avatar || 'https://github.com/shadcn.png'}
73-
/>
74-
<AvatarFallback>
75-
{winner.name.charAt(0).toUpperCase()}
76-
</AvatarFallback>
77-
</>
78-
) : (
79-
<AvatarFallback className='text-2xl text-gray-500'>
80-
?
81-
</AvatarFallback>
82-
)}
83-
</Avatar>
84-
</div>
78+
{/* Header: rank/track badge + prize chip */}
79+
<div className='flex flex-wrap items-center justify-between gap-2'>
80+
{isTrack ? (
81+
<Badge
82+
variant='outline'
83+
className='border-primary/40 text-primary gap-1'
84+
>
85+
<Layers className='h-3 w-3' />
86+
{trackName}
87+
</Badge>
88+
) : (
89+
<Badge
90+
variant='outline'
91+
className='gap-1 border-yellow-500/40 bg-yellow-500/10 text-yellow-300'
92+
style={{
93+
borderColor: `${ribbonColors.primaryColor}66`,
94+
backgroundColor: `${ribbonColors.primaryColor}1A`,
95+
color: ribbonColors.primaryColor,
96+
}}
97+
>
98+
{rank}
99+
<sup className='font-semibold'>{ordinalSuffix(rank)}</sup>
100+
<span className='ml-0.5'>Place</span>
101+
</Badge>
102+
)}
85103

86-
<div className='relative mb-3 flex items-center justify-center'>
87-
<Ribbon
88-
primaryColor={getRibbonColors(rank).primaryColor}
89-
secondaryColor={getRibbonColors(rank).secondaryColor}
90-
/>
91-
<span className='absolute inset-0 -bottom-3 flex items-center justify-center text-[12px] font-black text-white'>
92-
{getRibbonText(rank)}
93-
</span>
104+
{prizeText && (
105+
<div className='flex items-center gap-1.5 rounded-full border border-[#2775CA]/20 bg-[#2775CA]/10 px-2.5 py-1'>
106+
<Trophy className='h-3.5 w-3.5 text-yellow-500' />
107+
<span className='text-[10px] font-bold tracking-wide text-white uppercase'>
108+
{prizeText}
109+
</span>
110+
</div>
111+
)}
94112
</div>
95113

96-
<div className='mb-3 text-center'>
97-
<h3 className='text-xs font-medium text-white'>
98-
{winner?.name || '?'}
99-
</h3>
100-
</div>
114+
{/* Project block: avatar + name + category */}
115+
{winner ? (
116+
<div className='flex items-center gap-3'>
117+
<Avatar className='h-12 w-12'>
118+
<AvatarImage
119+
src={winner.avatar || undefined}
120+
alt={winner.name || 'Participant'}
121+
/>
122+
<AvatarFallback className='bg-gray-800 text-sm text-white uppercase'>
123+
{winner.name?.charAt(0) || '?'}
124+
</AvatarFallback>
125+
</Avatar>
101126

102-
{winner && (
103-
<div className='flex items-center justify-between rounded-lg border border-gray-900 p-2'>
104-
<div className='grid grid-cols-[44px_1fr] grid-rows-2 gap-x-2'>
105-
<div className='row-span-2 h-11 w-11 overflow-hidden rounded'>
106-
<Image
107-
src='/bitmed.png'
108-
alt={winner.projectName}
109-
width={44}
110-
height={44}
111-
className='h-full w-full object-cover'
112-
/>
113-
</div>
114-
<div className='flex items-center gap-1'>
115-
<Tooltip>
116-
<TooltipTrigger asChild>
117-
<p className='line-clamp-1 cursor-help text-sm font-medium text-white'>
118-
{winner.projectName}
119-
</p>
120-
</TooltipTrigger>
121-
<TooltipContent side='top' className='max-w-xs'>
122-
<p className='break-words'>{winner.projectName}</p>
123-
</TooltipContent>
124-
</Tooltip>
125-
<Badge className='bg-office-brown border-office-brown-darker text-office-brown-darker rounded-[4px] border px-1 py-0.5 text-[10px] font-medium'>
126-
{winner.category || 'General'}
127-
</Badge>
128-
</div>
129-
<div className='flex items-center gap-2 text-[10px] text-gray-500'>
130-
<span>
131-
{winner.averageScore
132-
? winner.averageScore.toFixed(1)
133-
: winner.score || 0}{' '}
134-
Score
135-
</span>
136-
<div className='h-2 w-px bg-gray-900' />
137-
<span>{winner.commentCount || 0} Comments</span>
138-
<ArrowUpRight className='h-3 w-3' />
127+
<div className='min-w-0 flex-1'>
128+
<Tooltip>
129+
<TooltipTrigger asChild>
130+
<p className='line-clamp-1 cursor-help text-sm font-semibold text-white'>
131+
{winner.projectName}
132+
</p>
133+
</TooltipTrigger>
134+
<TooltipContent side='top' className='max-w-xs'>
135+
<p className='break-words'>{winner.projectName}</p>
136+
</TooltipContent>
137+
</Tooltip>
138+
<div className='mt-0.5 flex items-center gap-2 text-xs text-gray-400'>
139+
<span className='line-clamp-1'>{winner.name || 'Unknown'}</span>
140+
{winner.category && (
141+
<>
142+
<span className='text-gray-700'></span>
143+
<span className='line-clamp-1'>{winner.category}</span>
144+
</>
145+
)}
139146
</div>
140147
</div>
141148
</div>
149+
) : (
150+
<div className='flex items-center gap-3 opacity-50'>
151+
<Avatar className='h-12 w-12'>
152+
<AvatarFallback className='bg-gray-900 text-gray-500'>
153+
?
154+
</AvatarFallback>
155+
</Avatar>
156+
<div className='text-xs text-gray-500'>No winner assigned</div>
157+
</div>
142158
)}
143159
</div>
144160
);

0 commit comments

Comments
 (0)