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 (from lucide-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
null when 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
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
organizationId as an explicit prop from HackathonSidebar.tsx, keeping the component's data dependencies transparent and easy to trace
- Option B: Extract
organizationId from currentHackathon.href if the href reliably follows the /organizations/[id]/... pattern
- Option C: Use
useParams() to read the id segment 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
organizationId to HackathonSelector from HackathonSidebar.tsx as an explicit prop (or use useParams() if that is the cleaner fit)
- Import
Plus from lucide-react
- Implement the conditional "New Hackathon" menu item with the
DropdownMenuSeparator as described above
- Verify navigation routes correctly to
/organizations/[id]/hackathons/new on click
- Verify the item is hidden when the hackathon list is empty — the component already returns
null in 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 types
Manual Verification
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
DropdownMenuSeparator+icon (fromlucide-react) next to the labelnullwhen the list is empty, so this is a natural extension of the existing guard/organizations/[id]/hackathons/newTechnical Details
Component to Modify
HackathonSelector.tsxProposed Changes
1. Update
DropdownMenuContentAfter mapping through the existing
hackathonslist, conditionally render a newDropdownMenuItempreceded by a separator. The item should only render whenhackathons.length > 0:2. Handle
organizationIdHackathonSelectorcurrently receiveshackathonsandcurrentHackathonas props but does not have direct access toorganizationId. Resolve this using one of the following approaches — choose whichever is most consistent with the existing patterns in the component:organizationIdas an explicit prop fromHackathonSidebar.tsx, keeping the component's data dependencies transparent and easy to traceorganizationIdfromcurrentHackathon.hrefif the href reliably follows the/organizations/[id]/...patternuseParams()to read theidsegment directly from the URL3. Add
PlusIcon ImportImport
Plusfromlucide-react— it is not currently imported inHackathonSelector.tsx.Proposed Resolution Plan
organizationIdtoHackathonSelectorfromHackathonSidebar.tsxas an explicit prop (or useuseParams()if that is the cleaner fit)Plusfromlucide-reactDropdownMenuSeparatoras described above/organizations/[id]/hackathons/newon clicknullin this case, but confirm the conditional guard aligns with that behaviorHackathonSelector.tsx— do not introduce inconsistent stylingTesting & Verification
Automated Tests
Manual Verification
+icon appears at the bottom, separated by a divider/organizations/[id]/hackathons/newwith the correct organization ID in the URLorganizationIdused in the navigation URL is accurate — confirm it matches the current organization, not a stale or incorrect valueDropdownMenuSeparatorrenders correctly and uses thebg-[#2B2B2B]class consistent with the existing designDropdownMenuItemstyling matches the existing item conventions inHackathonSelector.tsx— no visual inconsistencies