diff --git a/src/features/workspace/components/WorkspaceSidebar.jsx b/src/features/workspace/components/WorkspaceSidebar.jsx index 928807d..4423a25 100644 --- a/src/features/workspace/components/WorkspaceSidebar.jsx +++ b/src/features/workspace/components/WorkspaceSidebar.jsx @@ -1,146 +1,220 @@ -import React, { useState } from 'react'; -import { cn } from '@/lib/utils'; +import React, { useState, useMemo } from 'react'; +import { useLocation } from 'react-router-dom'; +import { motion, AnimatePresence } from 'framer-motion'; import { - LayoutDashboard, - ArrowUpRight, - ArrowDownRight, - ArrowRightLeft, - Settings, ChevronLeft, - ChevronRight, - Search, + ChevronRight, + Search, + ChevronDown, + LayoutDashboard, + ArrowUpRight, + ArrowDownRight, + ArrowRightLeft, + Settings, + ShieldCheck, Zap, - User, - LogOut, - HelpCircle + Lock, + LogOut } from 'lucide-react'; +import { cn } from '@/lib/utils'; +import logo from '@/assets/Img/Util/iT_Guys/logo1.png'; +// Reusando os estilos do Sidebar original (Reproduced) +import '@/features/layout/components/Sidebar/Sidebar.css'; + +const MENU_ITEMS = [ + { + id: 'dashboard', + label: 'Dashboard', + icon: LayoutDashboard, + category: 'Geral' + }, + { + id: 'financeiro', + label: 'Financeiro', + icon: ShieldCheck, + category: 'Financeiro', + children: [ + { id: 'entradas', label: 'Receitas (Entradas)', icon: ArrowUpRight, pathId: 'entradas' }, + { id: 'saidas', label: 'Despesas (Saídas)', icon: ArrowDownRight, pathId: 'saidas' }, + { id: 'conciliacao', label: 'Conciliação Bancária', icon: ArrowRightLeft, pathId: 'conciliacao' } + ] + }, + { + id: 'configuracoes', + label: 'Ajustes', + icon: Settings, + category: 'Sistema', + pathId: 'config' + } +]; + +/** + * WorkspaceSidebar - Versão "Reproduced" com alta fidelidade visual (Angular Style) + * Implementa a logo oficial iTGUYS e acentos em Ouro (#f1c232). + */ export const WorkspaceSidebar = ({ activeScreen, onScreenChange }) => { - const [collapsed, setCollapsed] = useState(false); + const [isCollapsed, setIsCollapsed] = useState(false); const [searchTerm, setSearchTerm] = useState(''); + const [expandedItems, setExpandedItems] = useState({ 'financeiro': true }); - const menuItems = [ - { id: 'dashboard', label: 'Dashboard', icon: LayoutDashboard, category: 'Geral' }, - { id: 'entradas', label: 'Receitas', icon: ArrowUpRight, category: 'Financeiro' }, - { id: 'saidas', label: 'Despesas', icon: ArrowDownRight, category: 'Financeiro' }, - { id: 'conciliacao', label: 'Conciliação', icon: ArrowRightLeft, category: 'Financeiro' }, - { id: 'config', label: 'Ajustes', icon: Settings, category: 'Sistema' }, - ]; + const toggleSidebar = () => setIsCollapsed(!isCollapsed); - const filteredItems = menuItems.filter(item => - item.label.toLowerCase().includes(searchTerm.toLowerCase()) || - item.category.toLowerCase().includes(searchTerm.toLowerCase()) - ); + const toggleExpand = (id) => { + setExpandedItems(prev => ({ + ...prev, + [id]: !prev[id] + })); + }; - const categories = [...new Set(menuItems.map(item => item.category))]; + const filteredItems = useMemo(() => { + if (!searchTerm) return MENU_ITEMS; + + return MENU_ITEMS.filter(item => { + const matchParent = item.label.toLowerCase().includes(searchTerm.toLowerCase()); + const matchChildren = item.children?.some(child => + child.label.toLowerCase().includes(searchTerm.toLowerCase()) + ); + return matchParent || matchChildren; + }); + }, [searchTerm]); + + const MenuItem = ({ item, isSub = false }) => { + const Icon = item.icon; + const hasChildren = item.children && item.children.length > 0; + const isExpanded = expandedItems[item.id]; + + // Identificar se está ativo + const isActive = activeScreen === (item.pathId || item.id) || + (hasChildren && item.children.some(c => activeScreen === (c.pathId || c.id))); + + const content = ( +