diff --git a/frontend/website/src/components/Sidebar.jsx b/frontend/website/src/components/Sidebar.jsx index 08f381f..c6a04c1 100755 --- a/frontend/website/src/components/Sidebar.jsx +++ b/frontend/website/src/components/Sidebar.jsx @@ -3,56 +3,103 @@ import { useNavigate, useLocation } from 'react-router-dom' import { getUserName, getUserEmail, fetchDashboardData } from '../services/api' import { useProfilePic } from '../utils/profilePic' -const NAV_ITEMS = [ +const NAV_SECTIONS = [ { - icon: ( - - - - ), - label: 'Dashboard', - path: '/dashboard', - color: '#6366F1', - }, - { - icon: ( - - - - ), - label: 'Training', - path: '/problems', - color: '#22D3EE', - }, - { - icon: ( - - - - ), - label: 'Challenges', - path: '/challenges', - color: '#F59E0B', + label: 'MAIN', + items: [ + { + icon: ( + + + + + ), + label: 'Dashboard', + path: '/dashboard', + }, + { + icon: ( + + + + ), + label: 'Problems', + path: '/problems', + badge: '1347', + }, + { + icon: ( + + + + ), + label: 'Topics', + path: '/problems', + }, + { + icon: ( + + + + + ), + label: 'Sheets', + path: '/problems', + }, + ], }, { - icon: ( - - - - ), - label: 'Community', - path: '/community', - color: '#34D399', + label: 'COMPETE', + items: [ + { + icon: ( + + + + ), + label: 'Contests', + path: '/challenges', + notif: true, + }, + { + icon: ( + + + + + + ), + label: 'Arena', + path: '/challenges', + }, + ], }, { - icon: ( - - - - ), - label: 'Profile', - path: '/profile', - color: '#F472B6', + label: 'SOCIAL', + items: [ + { + icon: ( + + + + + + + ), + label: 'Community', + path: '/community', + }, + { + icon: ( + + + + + ), + label: 'Friends', + path: '/community', + }, + ], }, ] @@ -60,15 +107,14 @@ export default function Sidebar() { const navigate = useNavigate() const { pathname } = useLocation() - // ── Real user data ── - const rawName = getUserName() || getUserEmail() || '' - const initial = rawName ? rawName[0].toUpperCase() : '?' - const shortName = rawName.includes('@') + const rawName = getUserName() || getUserEmail() || '' + const initial = rawName ? rawName[0].toUpperCase() : '?' + const shortName = rawName.includes('@') ? rawName.split('@')[0] : (rawName.split(' ')[0] || 'User') const profilePic = useProfilePic() - const [streak, setStreak] = useState(null) // null = still loading + const [streak, setStreak] = useState(null) useEffect(() => { fetchDashboardData() @@ -77,33 +123,40 @@ export default function Sidebar() { }, []) const streakColor = - streak === null ? '#6B7280' : - streak > 14 ? '#F59E0B' : - streak > 6 ? '#FB923C' : - streak > 0 ? '#FCD34D' : - '#6B7280' + streak === null ? '#6B7280' : + streak > 14 ? '#a78bfa' : + streak > 6 ? '#fb923c' : + streak > 0 ? '#fbbf24' : + '#6B7280' const streakText = - streak === null ? '…' : - streak === 0 ? 'No streak yet' : - streak === 1 ? '🔥 1 day' : + streak === null ? '…' : + streak === 0 ? 'No streak yet' : + streak === 1 ? '🔥 1 day' : `🔥 ${streak} days` return ( ) -} +} \ No newline at end of file