diff --git a/frontend/app/components/Sidebar.tsx b/frontend/app/components/Sidebar.tsx index a13b3f9c..4e6edf5a 100644 --- a/frontend/app/components/Sidebar.tsx +++ b/frontend/app/components/Sidebar.tsx @@ -1,7 +1,8 @@ import { useState, useEffect } from 'react'; import { Link, useRouterState } from '@tanstack/react-router'; -import { Home, Box, ArrowRightLeft, Users, FileText, Layers, Globe, ChevronLeft, ChevronRight, Sun, Moon, Coins, Image, Clock, BarChart3, Code2, Pin, PinOff, Play } from 'lucide-react'; +import { Home, Box, ArrowRightLeft, Users, FileText, Layers, Globe, ChevronLeft, ChevronRight, Sun, Moon, Coins, Image, Clock, BarChart3, Code2, Pin, PinOff, Play, Type, ChevronDown } from 'lucide-react'; import { useTheme } from '../contexts/ThemeContext'; +import { useFont, type FontFamily, type PixelVariant } from '../contexts/FontContext'; import { useMobileMenu } from '../contexts/MobileMenuContext'; import { FlowIndexLogo } from './FlowIndexLogo'; import { motion, AnimatePresence } from 'framer-motion'; @@ -10,14 +11,16 @@ export default function Sidebar() { const routerState = useRouterState(); const location = routerState.location; const { theme, toggleTheme } = useTheme(); - const [isCollapsed, setIsCollapsed] = useState(() => location.pathname.startsWith('/developer')); + const { fontFamily, pixelVariant, setFontFamily, setPixelVariant } = useFont(); + const [fontMenuOpen, setFontMenuOpen] = useState(false); + const [isCollapsed, setIsCollapsed] = useState(() => location.pathname.startsWith('/developer') || location.pathname.startsWith('/playground')); const [autoCollapse, setAutoCollapse] = useState(false); const [hoverExpanded, setHoverExpanded] = useState(false); const { isOpen: isMobileOpen, close: closeMobileMenu } = useMobileMenu(); - // Auto-collapse when entering Developer Portal, auto-expand when leaving + // Auto-collapse when entering Developer Portal or Playground, auto-expand when leaving useEffect(() => { - if (location.pathname.startsWith('/developer')) { + if (location.pathname.startsWith('/developer') || location.pathname.startsWith('/playground')) { setIsCollapsed(true); } }, [location.pathname]); @@ -122,7 +125,7 @@ export default function Sidebar() { {/* Footer */} -
+
+ {/* Mobile Font Selector */} +
+ + + {fontMenuOpen && ( + +
+ {([['mono', 'Mono'], ['sans', 'Sans']] as [FontFamily, string][]).map(([key, label]) => ( + + ))} +
+ Pixel +
+ {(['square', 'grid', 'circle', 'triangle', 'line'] as PixelVariant[]).map((v) => ( + + ))} +
+
+
+
+ )} +
+
@@ -237,6 +299,78 @@ export default function Sidebar() { )} + {/* Font Selector */} + {!effectiveCollapsed && ( +
+ + + {fontMenuOpen && ( + +
+ {([['mono', 'Mono'], ['sans', 'Sans']] as [FontFamily, string][]).map(([key, label]) => ( + + ))} + {/* Pixel section */} +
+ Pixel +
+ {(['square', 'grid', 'circle', 'triangle', 'line'] as PixelVariant[]).map((v) => ( + + ))} +
+
+
+
+ )} +
+
+ )} + {effectiveCollapsed && ( + + )} + {/* Collapse & Auto-collapse Controls */} {effectiveCollapsed ? (