From db0b93b007867f8935c51658ee3ebd479ca6c173 Mon Sep 17 00:00:00 2001 From: antigravity-xd Date: Sat, 11 Apr 2026 01:10:55 +0300 Subject: [PATCH] feat(ui): Implement adaptive navigation system (Stage 1) - Added useDisplay hook for breakpoint-based layout - Added useScrollDirection hook for hide-on-scroll logic - Implemented three-tier navigation: - Navigation Bar (Compact < 600px) with auto-hide - Navigation Rail (Medium 600-1240px) - Expanded Navigation Rail (Expanded > 1240px) - Added support for sub-menus in expanded rail - Added notification badges support - Integrated ThemeProvider into App Refs #3 Co-Authored-By: Claude --- src/components/Layout.tsx | 9 +- src/components/Navigation.tsx | 165 +++++++++++++++++++++----- src/hooks/useDisplay.ts | 19 +++ src/hooks/useScrollDirection.ts | 23 ++++ src/store/useStore.ts | 18 ++- src/styles/globals.css | 203 ++++++++++++++++++++++++-------- 6 files changed, 360 insertions(+), 77 deletions(-) create mode 100644 src/hooks/useDisplay.ts create mode 100644 src/hooks/useScrollDirection.ts diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index cbda0ee..2c93a7e 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -1,11 +1,18 @@ import React from 'react'; import { Navigation } from './Navigation'; +import { useStore } from '../store/useStore'; +import { useDisplay } from '../hooks/useDisplay'; export const Layout: React.FC<{ children: React.ReactNode }> = ({ children }) => { + const { isRailExpanded } = useStore(); + const { navMode } = useDisplay(); + + const isExpanded = navMode === 'rail-expanded' && isRailExpanded; + return (
-
+
{children}
diff --git a/src/components/Navigation.tsx b/src/components/Navigation.tsx index 5395601..fee1d9b 100644 --- a/src/components/Navigation.tsx +++ b/src/components/Navigation.tsx @@ -1,37 +1,84 @@ -import React from 'react'; +import React, { useState } from 'react'; import { NavLink } from 'react-router-dom'; -import { User, Calendar, GraduationCap, MessageSquare, Settings } from 'lucide-react'; +import { + Calendar, + GraduationCap, + FileText, + MessageSquare, + User, + ChevronDown, + ChevronRight, + Menu +} from 'lucide-react'; +import { useStore } from '../store/useStore'; +import { useDisplay } from '../hooks/useDisplay'; +import { useScrollDirection } from '../hooks/useScrollDirection'; -const navItems = [ - { path: '/profile', label: 'Profile', icon: User }, - { path: '/schedule', label: 'Schedule', icon: Calendar }, - { path: '/grades', label: 'Grades', icon: GraduationCap }, - { path: '/messages', label: 'Messages', icon: MessageSquare }, - { path: '/settings', label: 'Settings', icon: Settings }, +interface NavItem { + path: string; + label: string; + icon: any; + iconFilled: any; + badgeKey?: 'messages'; + children?: { path: string; label: string }[]; +} + +const navItems: NavItem[] = [ + { path: '/profile', label: 'Профиль', icon: User, iconFilled: User }, + { + path: '/schedule', + label: 'Расписание', + icon: Calendar, + iconFilled: Calendar, + children: [ + { path: '/schedule/week', label: 'Текущая неделя' }, + { path: '/schedule/session', label: 'Сессия' }, + ] + }, + { + path: '/grades', + label: 'Успеваемость', + icon: GraduationCap, + iconFilled: GraduationCap, + children: [ + { path: '/grades/list', label: 'Оценки' }, + { path: '/grades/statements', label: 'Ведомости' }, + ] + }, + { + path: '/docs', + label: 'Документы', + icon: FileText, + iconFilled: FileText, + children: [ + { path: '/docs/certs', label: 'Справки' }, + { path: '/docs/apps', label: 'Заявления' }, + ] + }, + { path: '/messages', label: 'Сообщения', icon: MessageSquare, iconFilled: MessageSquare, badgeKey: 'messages' }, ]; export const Navigation: React.FC = () => { - return ( - <> - + const { navMode } = useDisplay(); + const { isRailExpanded, toggleRail, badges } = useStore(); + const scrollDir = useScrollDirection(); + const [expandedItems, setExpandedItems] = useState([]); -