Implemented the new react version of the frontend

This commit is contained in:
Mohammed Abad committed 2026-03-31 01:56:38 +01:00
1 parent 236e6e06fb
commit ffe7e52527
65 files changed
+5228 -177

No files matched your search

@@ -0,0 +1,136 @@
import { NavLink } from 'react-router-dom';
import {
LayoutDashboard,
Home,
Library,
ListVideo,
FolderOpen,
Image,
CalendarDays,
Users,
Settings,
Moon,
Sun,
Film,
} from 'lucide-react';
import { useThemeStore } from '@/stores/useThemeStore';
import { Button } from '@/components/ui/button';
import { Separator } from '@/components/ui/separator';
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from '@/components/ui/tooltip';
const mainNav = [
{ to: '/dashboard', icon: LayoutDashboard, label: 'Dashboard' },
{ to: '/', icon: Home, label: 'Home' },
];
const libraryNav = [
{ to: '/library', icon: Library, label: 'Library' },
{ to: '/watchlist', icon: ListVideo, label: 'Watchlist' },
{ to: '/collections', icon: FolderOpen, label: 'Collections' },
{ to: '/media', icon: Image, label: 'Media' },
];
const otherNav = [
{ to: '/calendar', icon: CalendarDays, label: 'Calendar' },
{ to: '/people', icon: Users, label: 'People' },
];
function NavItem({
to,
icon: Icon,
label,
}: {
to: string;
icon: React.ComponentType<{ className?: string }>;
label: string;
}) {
return (
<Tooltip>
<TooltipTrigger asChild>
<NavLink
to={to}
end={to === '/'}
className={({ isActive }) =>
`flex items-center gap-3 rounded-lg px-3 py-2 text-sm transition-colors ${
isActive
? 'bg-sidebar-accent text-sidebar-primary font-medium'
: 'text-sidebar-foreground/70 hover:bg-sidebar-accent/50 hover:text-sidebar-foreground'
}`
}
>
<Icon className="h-4 w-4 shrink-0" />
<span>{label}</span>
</NavLink>
</TooltipTrigger>
<TooltipContent side="right">{label}</TooltipContent>
</Tooltip>
);
}
export function Sidebar() {
const { theme, toggleTheme } = useThemeStore();
return (
<aside className="fixed inset-y-0 left-0 z-50 flex w-56 flex-col border-r border-sidebar-border bg-sidebar">
{/* Logo */}
<div className="flex h-14 items-center gap-2 px-4">
<Film className="h-6 w-6 text-sidebar-primary" />
<span className="text-lg font-bold text-sidebar-foreground">
Showy
</span>
</div>
<Separator className="bg-sidebar-border" />
{/* Nav */}
<nav className="flex-1 space-y-1 overflow-y-auto px-3 py-4">
<p className="mb-2 px-3 text-xs font-semibold uppercase tracking-wider text-sidebar-foreground/50">
Main
</p>
{mainNav.map((item) => (
<NavItem key={item.to} {...item} />
))}
<Separator className="my-3 bg-sidebar-border" />
<p className="mb-2 px-3 text-xs font-semibold uppercase tracking-wider text-sidebar-foreground/50">
Library
</p>
{libraryNav.map((item) => (
<NavItem key={item.to} {...item} />
))}
<Separator className="my-3 bg-sidebar-border" />
<p className="mb-2 px-3 text-xs font-semibold uppercase tracking-wider text-sidebar-foreground/50">
Other
</p>
{otherNav.map((item) => (
<NavItem key={item.to} {...item} />
))}
</nav>
{/* Bottom actions */}
<div className="border-t border-sidebar-border px-3 py-3 space-y-1">
<Button
variant="ghost"
size="sm"
className="w-full justify-start gap-3 text-sidebar-foreground/70 hover:bg-sidebar-accent/50 hover:text-sidebar-foreground"
onClick={toggleTheme}
>
{theme === 'dark' ? (
<Sun className="h-4 w-4" />
) : (
<Moon className="h-4 w-4" />
)}
<span>{theme === 'dark' ? 'Light Mode' : 'Dark Mode'}</span>
</Button>
<NavItem to="/settings" icon={Settings} label="Settings" />
</div>
</aside>
);
}