diff --git a/apps/web/src/components/DashboardLayout.tsx b/apps/web/src/components/DashboardLayout.tsx index d02ac11..54666ba 100644 --- a/apps/web/src/components/DashboardLayout.tsx +++ b/apps/web/src/components/DashboardLayout.tsx @@ -22,7 +22,7 @@ import { import Image from 'next/image'; import Link from 'next/link'; import {useRouter} from 'next/router'; -import {useCallback, useEffect, useRef, useState} from 'react'; +import {useCallback, useEffect, useMemo, useRef, useState} from 'react'; interface DashboardLayoutProps { children: React.ReactNode; @@ -74,6 +74,11 @@ export function DashboardLayout({children}: DashboardLayoutProps) { const mobileProjectMenuRef = useRef(null); const mobileUserMenuRef = useRef(null); + // Sort projects alphabetically by name + const sortedProjects = useMemo(() => { + return [...availableProjects].sort((a, b) => a.name.localeCompare(b.name)); + }, [availableProjects]); + // Handle click outside for project menu useEffect(() => { function handleClickOutside(event: MouseEvent) { @@ -179,8 +184,8 @@ export function DashboardLayout({children}: DashboardLayoutProps) { {/* Project Dropdown */} {showProjectMenu && ( -
- {availableProjects.map(project => ( +
+ {sortedProjects.map(project => ( ))} @@ -204,7 +209,7 @@ export function DashboardLayout({children}: DashboardLayoutProps) { setShowProjectMenu(false)} - className="w-full flex items-center gap-2 px-3 py-2 text-sm hover:bg-neutral-50 transition-colors text-neutral-700" + className="w-full flex items-center gap-2 px-3 py-2 text-sm hover:bg-neutral-50 transition-colors text-neutral-700 whitespace-nowrap" > Create project