Files
supervisor-ui/components/layout/Navbar.tsx
Sebastian Krüger dda335d501
All checks were successful
Build and Push Docker Image to Gitea / build-and-push (push) Successful in 1m8s
fix: resolve 7 critical UI issues - charts, layouts, and mobile responsiveness
This commit fixes all reported UI issues across the dashboard:

## Issue 1: Chart Colors and Tooltips 
- Create chartColors utility with static hex colors for Recharts compatibility
- Replace CSS variable colors (hsl(var(--))) with hex colors in all charts
- Add custom tooltip styling with dark background and white text for readability
- Fixes: ProcessStateChart, ProcessUptimeChart, GroupStatistics

## Issue 2: Process Card Heights 
- Add h-full and flex flex-col to ProcessCard component
- Add auto-rows-fr to process grid layout
- Ensures all cards have consistent heights regardless of content

## Issue 3: Batch Actions Button Labels 
- Simplify button labels from "Start Selected" to "Start"
- Remove "Stop Selected" to "Stop", "Restart Selected" to "Restart"
- Labels now always visible on all screen sizes

## Issue 4: Mobile Menu Background 
- Change mobile menu from semi-transparent (bg-background/95) to solid (bg-background)
- Removes backdrop blur for better visibility

## Issue 5: Group Header Button Overflow 
- Add flex-wrap to button container in GroupCard
- Stack buttons vertically on mobile (flex-col md:flex-row)
- Buttons take full width on mobile, auto width on desktop

## Issue 6: Logs Search Input Overflow 
- Change LogSearch from max-w-md to w-full sm:flex-1 sm:max-w-md
- Search input now full width on mobile, constrained on desktop

## Issue 7: Logs Action Button Overflow 
- Add flex-wrap to LogControls button container
- Buttons wrap to new row when space is limited

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 21:52:35 +01:00

143 lines
4.3 KiB
TypeScript

'use client';
import { useState, useEffect } from 'react';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { Moon, Sun, Activity, Menu, X } from 'lucide-react';
import { useTheme } from '@/components/providers/ThemeProvider';
import { Button } from '@/components/ui/button';
import { cn } from '@/lib/utils/cn';
const navItems = [
{ href: '/', label: 'Dashboard' },
{ href: '/processes', label: 'Processes' },
{ href: '/groups', label: 'Groups' },
{ href: '/logs', label: 'Logs' },
{ href: '/config', label: 'Configuration' },
];
export function Navbar() {
const pathname = usePathname();
const [mounted, setMounted] = useState(false);
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
const themeContext = useTheme();
useEffect(() => {
setMounted(true);
}, []);
useEffect(() => {
// Close mobile menu when route changes
setMobileMenuOpen(false);
}, [pathname]);
useEffect(() => {
// Prevent scroll when mobile menu is open
if (mobileMenuOpen) {
document.body.style.overflow = 'hidden';
} else {
document.body.style.overflow = 'unset';
}
return () => {
document.body.style.overflow = 'unset';
};
}, [mobileMenuOpen]);
const toggleTheme = () => {
if (themeContext) {
themeContext.setTheme(themeContext.resolvedTheme === 'dark' ? 'light' : 'dark');
}
};
return (
<nav className="sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60">
<div className="container flex h-16 items-center px-4 md:px-6">
{/* Logo */}
<Link href="/" className="flex items-center gap-2 mr-4 md:mr-8">
<Activity className="h-6 w-6 text-primary" />
<span className="font-bold text-lg md:text-xl bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">
Supervisor
</span>
</Link>
{/* Desktop Navigation Links */}
<div className="hidden md:flex gap-1 flex-1">
{navItems.map((item) => (
<Link key={item.href} href={item.href}>
<Button
variant="ghost"
size="sm"
className={cn(
'transition-colors',
pathname === item.href && 'bg-accent text-accent-foreground'
)}
>
{item.label}
</Button>
</Link>
))}
</div>
{/* Right side buttons */}
<div className="flex items-center gap-2 ml-auto">
{/* Theme Toggle */}
{mounted && themeContext && (
<Button
variant="ghost"
size="icon"
onClick={toggleTheme}
aria-label="Toggle theme"
className="h-10 w-10"
>
{themeContext.resolvedTheme === 'dark' ? (
<Sun className="h-5 w-5" />
) : (
<Moon className="h-5 w-5" />
)}
</Button>
)}
{/* Mobile Menu Button */}
<Button
variant="ghost"
size="icon"
onClick={() => setMobileMenuOpen(!mobileMenuOpen)}
aria-label="Toggle menu"
className="md:hidden h-10 w-10"
>
{mobileMenuOpen ? (
<X className="h-6 w-6" />
) : (
<Menu className="h-6 w-6" />
)}
</Button>
</div>
</div>
{/* Mobile Menu Drawer */}
{mobileMenuOpen && (
<div className="md:hidden fixed inset-0 top-16 z-50 bg-background">
<div className="container px-4 py-6">
<nav className="flex flex-col gap-2">
{navItems.map((item) => (
<Link key={item.href} href={item.href}>
<Button
variant="ghost"
size="lg"
className={cn(
'w-full justify-start text-lg transition-colors',
pathname === item.href && 'bg-accent text-accent-foreground'
)}
>
{item.label}
</Button>
</Link>
))}
</nav>
</div>
</div>
)}
</nav>
);
}