-
Notifications
You must be signed in to change notification settings - Fork 85
Description
Add "New Hackathon" Option to Hackathon Switcher
Description
The hackathon switcher dropdown — used to navigate between different hackathons within an organization — should include a "New Hackathon" option with a + icon at the bottom of the list. This provides organizers with a quick shortcut to start a new event without having to navigate back to the main hackathon list, reducing friction in the creation workflow.
Impact: Low/Medium (UX Improvement) — a small but meaningful quality-of-life addition for active organizers managing multiple hackathons.
Requirements
- Add a "New Hackathon" item at the end of the dropdown list, separated from the existing hackathon entries by a
DropdownMenuSeparator - Include a
+icon (fromlucide-react) next to the label - This option must only appear if the organization already has at least one hackathon (draft or published) — the component already returns
nullwhen the list is empty, so this is a natural extension of the existing guard - Clicking the option must navigate the user to the "Create Hackathon" page:
/organizations/[id]/hackathons/new
Technical Details
Component to Modify
HackathonSelector.tsx
Proposed Changes
1. Update DropdownMenuContent
After mapping through the existing hackathons list, conditionally render a new DropdownMenuItem preceded by a separator. The item should only render when hackathons.length > 0:
{hackathons.length > 0 && (
<>
<DropdownMenuItem
onClick={() => router.push(`/organizations/${organizationId}/hackathons/new`)}
className="flex cursor-pointer items-center gap-3 rounded-md px-3 py-2.5 hover:bg-[#252525] focus:bg-[#252525] text-primary"
>
New Hackathon
</>
)}2. Handle organizationId
HackathonSelector currently receives hackathons and currentHackathon as props but does not have direct access to organizationId. Resolve this using one of the following approaches — choose whichever is most consistent with the existing patterns in the component:
- Option A (Preferred): Pass
organizationIdas an explicit prop fromHackathonSidebar.tsx, keeping the component's data dependencies transparent and easy to trace - Option B: Extract
organizationIdfromcurrentHackathon.hrefif the href reliably follows the/organizations/[id]/...pattern - Option C: Use
useParams()to read theidsegment directly from the URL
3. Add Plus Icon Import
Import Plus from lucide-react — it is not currently imported in HackathonSelector.tsx.
Proposed Resolution Plan
- Pass
organizationIdtoHackathonSelectorfromHackathonSidebar.tsxas an explicit prop (or useuseParams()if that is the cleaner fit) - Import
Plusfromlucide-react - Implement the conditional "New Hackathon" menu item with the
DropdownMenuSeparatoras described above - Verify navigation routes correctly to
/organizations/[id]/hackathons/newon click - Verify the item is hidden when the hackathon list is empty — the component already returns
nullin this case, but confirm the conditional guard aligns with that behavior
⚠️ Caution
This is a production environment — not a sandbox.
- Code must be performant, accessible, and clean
- AI-generated code will be scrutinized; poorly structured or "hallucinated" code will result in immediate issue closure
- Follow the existing design system: shadcn/ui, Tailwind, Framer Motion
- Match the exact className conventions already used in
HackathonSelector.tsx— do not introduce inconsistent styling
Testing & Verification
Automated Tests
npm run lint # Ensure code quality
npm run build # Verify no breaking changes in routing or typesManual Verification
- Open the hackathon switcher dropdown when the organization has one or more hackathons — confirm the "New Hackathon" option with
+icon appears at the bottom, separated by a divider - Confirm the "New Hackathon" option is hidden when the hackathon list is empty — the switcher should not render the item in that state
- Click "New Hackathon" — confirm navigation routes correctly to
/organizations/[id]/hackathons/newwith the correct organization ID in the URL - Verify the
organizationIdused in the navigation URL is accurate — confirm it matches the current organization, not a stale or incorrect value - Confirm the
DropdownMenuSeparatorrenders correctly and uses thebg-[#2B2B2B]class consistent with the existing design - Verify the new
DropdownMenuItemstyling matches the existing item conventions inHackathonSelector.tsx— no visual inconsistencies - Confirm there is no regression in the existing hackathon switching behavior — selecting an existing hackathon from the dropdown should still navigate correctly
- Provide video evidence