fix: keep brand text visible on sidebar collapse, hide sub-items until hover

- TopBar: always show "ResolutionFlow" text regardless of sidebar state
- NavItem: sub-items (Troubleshooting, Projects) hidden by default,
  revealed on hover or when a child route is active

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-02-15 22:31:51 -05:00
parent fe94f16b61
commit 034fee371c
2 changed files with 12 additions and 12 deletions

View File

@@ -58,7 +58,7 @@ export function NavItem({ href, icon: Icon, label, badge, matchPaths, collapsed,
} }
return ( return (
<div> <div className="group/nav">
<Link <Link
to={href} to={href}
className={cn( className={cn(
@@ -90,9 +90,14 @@ export function NavItem({ href, icon: Icon, label, badge, matchPaths, collapsed,
)} )}
</Link> </Link>
{/* Sub-items */} {/* Sub-items — visible on hover or when a child is active */}
{children && children.length > 0 && ( {children && children.length > 0 && (
<div className="mt-0.5 space-y-0.5"> <div className={cn(
'mt-0.5 space-y-0.5 overflow-hidden transition-all duration-200',
isActive || activeChild
? 'max-h-40 opacity-100'
: 'max-h-0 opacity-0 group-hover/nav:max-h-40 group-hover/nav:opacity-100'
)}>
{children.map(child => { {children.map(child => {
const childActive = fullPath === child.href || fullPath.startsWith(child.href + '&') const childActive = fullPath === child.href || fullPath.startsWith(child.href + '&')
return ( return (

View File

@@ -3,7 +3,6 @@ import { Link, useNavigate } from 'react-router-dom'
import { Search, Zap, LogOut, User, Shield, Settings } from 'lucide-react' import { Search, Zap, LogOut, User, Shield, Settings } from 'lucide-react'
import { useAuthStore } from '@/store/authStore' import { useAuthStore } from '@/store/authStore'
import { usePermissions } from '@/hooks/usePermissions' import { usePermissions } from '@/hooks/usePermissions'
import { useUserPreferencesStore } from '@/store/userPreferencesStore'
import { BrandLogo } from '@/components/common/BrandLogo' import { BrandLogo } from '@/components/common/BrandLogo'
import { CommandPalette } from './CommandPalette' import { CommandPalette } from './CommandPalette'
import { QuickLaunch } from './QuickLaunch' import { QuickLaunch } from './QuickLaunch'
@@ -14,7 +13,6 @@ export function TopBar() {
const navigate = useNavigate() const navigate = useNavigate()
const { user, logout } = useAuthStore() const { user, logout } = useAuthStore()
const { effectiveRole, isSuperAdmin } = usePermissions() const { effectiveRole, isSuperAdmin } = usePermissions()
const sidebarCollapsed = useUserPreferencesStore(s => s.sidebarCollapsed)
const [userMenuOpen, setUserMenuOpen] = useState(false) const [userMenuOpen, setUserMenuOpen] = useState(false)
const [commandPaletteOpen, setCommandPaletteOpen] = useState(false) const [commandPaletteOpen, setCommandPaletteOpen] = useState(false)
@@ -61,17 +59,14 @@ export function TopBar() {
<Link <Link
to="/" to="/"
className="flex items-center gap-2.5 pr-4 transition-all duration-200" className="flex items-center gap-2.5 pr-4 transition-all duration-200"
style={{ width: sidebarCollapsed ? '32px' : 'calc(260px - 40px)' }}
> >
<div className="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-gradient-brand"> <div className="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-gradient-brand">
<BrandLogo size="sm" className="h-4 w-4" /> <BrandLogo size="sm" className="h-4 w-4" />
</div> </div>
{!sidebarCollapsed && ( <span className="text-sm font-heading font-bold tracking-tight whitespace-nowrap">
<span className="text-sm font-heading font-bold tracking-tight"> <span className="text-foreground">Resolution</span>
<span className="text-foreground">Resolution</span> <span className="text-gradient-brand">Flow</span>
<span className="text-gradient-brand">Flow</span> </span>
</span>
)}
</Link> </Link>
{/* Spacer - push search to center */} {/* Spacer - push search to center */}