chore(repo): initialize Tradarr repository
Add the existing application baseline and repository documentation/ignore rules. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
94
frontend/src/components/layout/Sidebar.tsx
Normal file
94
frontend/src/components/layout/Sidebar.tsx
Normal file
@ -0,0 +1,94 @@
|
||||
import { NavLink } from 'react-router-dom'
|
||||
import { LayoutDashboard, Newspaper, Star, Settings, Key, Cpu, Database, ClipboardList, Users, LogOut, CalendarDays, FileText } from 'lucide-react'
|
||||
import { useAuth } from '@/lib/auth'
|
||||
import { cn } from '@/lib/cn'
|
||||
|
||||
const navItems = [
|
||||
{ to: '/', icon: LayoutDashboard, label: 'Dashboard' },
|
||||
{ to: '/feed', icon: Newspaper, label: 'Actualités' },
|
||||
{ to: '/watchlist', icon: Star, label: 'Watchlist' },
|
||||
{ to: '/reports', icon: FileText, label: 'Rapports' },
|
||||
]
|
||||
|
||||
const adminItems = [
|
||||
{ to: '/admin/ai', icon: Cpu, label: 'Fournisseurs IA' },
|
||||
{ to: '/admin/credentials', icon: Key, label: 'Identifiants' },
|
||||
{ to: '/admin/sources', icon: Database, label: 'Sources' },
|
||||
{ to: '/admin/jobs', icon: ClipboardList, label: 'Jobs' },
|
||||
{ to: '/admin/users', icon: Users, label: 'Utilisateurs' },
|
||||
{ to: '/admin/schedule', icon: CalendarDays, label: 'Planning' },
|
||||
{ to: '/admin/settings', icon: Settings, label: 'Paramètres' },
|
||||
]
|
||||
|
||||
function NavItem({ to, icon: Icon, label }: { to: string; icon: React.ElementType; label: string }) {
|
||||
return (
|
||||
<NavLink
|
||||
to={to}
|
||||
end={to === '/'}
|
||||
className={({ isActive }) =>
|
||||
cn(
|
||||
'flex items-center gap-3 rounded-md px-3 py-2 text-sm transition-colors',
|
||||
isActive
|
||||
? 'bg-primary/8 text-primary font-medium border-l-2 border-primary pl-[10px]'
|
||||
: 'text-muted-foreground hover:bg-accent hover:text-foreground font-normal'
|
||||
)
|
||||
}
|
||||
>
|
||||
<Icon className="h-4 w-4 shrink-0" />
|
||||
{label}
|
||||
</NavLink>
|
||||
)
|
||||
}
|
||||
|
||||
export function Sidebar() {
|
||||
const { user, logout, isAdmin } = useAuth()
|
||||
|
||||
return (
|
||||
<aside className="flex h-screen w-60 flex-col border-r bg-card px-3 py-5">
|
||||
{/* Logo */}
|
||||
<div className="mb-7 px-3">
|
||||
<span className="font-serif text-xl font-bold tracking-tight text-foreground">
|
||||
Financ<span className="text-primary">IA</span>l
|
||||
</span>
|
||||
<p className="text-[10px] text-muted-foreground mt-0.5 tracking-wide uppercase">Journal financier IA</p>
|
||||
</div>
|
||||
|
||||
{/* Séparateur */}
|
||||
<div className="border-t mb-4" />
|
||||
|
||||
{/* Navigation principale */}
|
||||
<nav className="flex flex-col gap-0.5">
|
||||
{navItems.map(item => <NavItem key={item.to} {...item} />)}
|
||||
</nav>
|
||||
|
||||
{/* Section admin */}
|
||||
{isAdmin && (
|
||||
<>
|
||||
<div className="mt-5 mb-2 px-3 flex items-center gap-2">
|
||||
<div className="flex-1 border-t" />
|
||||
<p className="text-[10px] font-semibold uppercase tracking-widest text-muted-foreground">Admin</p>
|
||||
<div className="flex-1 border-t" />
|
||||
</div>
|
||||
<nav className="flex flex-col gap-0.5">
|
||||
{adminItems.map(item => <NavItem key={item.to} {...item} />)}
|
||||
</nav>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* User + logout */}
|
||||
<div className="mt-auto border-t pt-4">
|
||||
<div className="px-3 mb-2">
|
||||
<p className="text-sm font-medium truncate text-foreground">{user?.email}</p>
|
||||
<p className="text-xs text-muted-foreground capitalize">{user?.role}</p>
|
||||
</div>
|
||||
<button
|
||||
onClick={logout}
|
||||
className="flex w-full items-center gap-3 rounded-md px-3 py-2 text-sm text-muted-foreground hover:bg-accent hover:text-foreground transition-colors"
|
||||
>
|
||||
<LogOut className="h-4 w-4" />
|
||||
Déconnexion
|
||||
</button>
|
||||
</div>
|
||||
</aside>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user