Made the UI mobile friendly, finally...

This commit is contained in:
Jaret Burkett
2026-05-19 09:27:36 -06:00
parent 6ecaf679dc
commit df851b3497
22 changed files with 325 additions and 118 deletions

View File

@@ -1,10 +1,37 @@
'use client';
import { useEffect } from 'react';
import Link from 'next/link';
import { Home, Settings, BrainCircuit, Images, Plus } from 'lucide-react';
import { usePathname } from 'next/navigation';
import { Home, Settings, BrainCircuit, Images, Plus, X } from 'lucide-react';
import { FaXTwitter, FaDiscord, FaYoutube } from 'react-icons/fa6';
import { createGlobalState } from 'react-global-hooks';
import ThemeToggle from './ThemeToggle';
import ThemeLogo from './ThemeLogo';
export const mobileSidebarState = createGlobalState<boolean>(false);
const Sidebar = () => {
const [isMobileOpen, setIsMobileOpen] = mobileSidebarState.use();
const pathname = usePathname();
// Close mobile menu on route change
useEffect(() => {
setIsMobileOpen(false);
}, [pathname]);
// Lock body scroll when mobile menu open
useEffect(() => {
if (isMobileOpen) {
document.body.style.overflow = 'hidden';
} else {
document.body.style.overflow = '';
}
return () => {
document.body.style.overflow = '';
};
}, [isMobileOpen]);
const navigation = [
{ name: 'Dashboard', href: '/dashboard', icon: Home },
{ name: 'New Job', href: '/jobs/new', icon: Plus },
@@ -17,14 +44,21 @@ const Sidebar = () => {
'flex flex-col items-center justify-center p-1 hover:bg-gray-800 rounded-lg transition-colors';
const socialIconClass = 'w-5 h-5 text-gray-400 hover:text-white';
return (
<div className="flex flex-col w-59 bg-gray-900 text-gray-100">
<div className="px-4 py-3">
const sidebarContent = (
<>
<div className="px-4 py-3 flex items-center justify-between">
<h1 className="text-l">
<ThemeLogo />
<span className="font-bold uppercase">Ostris</span>
<span className="ml-2 uppercase text-gray-300">AI-Toolkit</span>
</h1>
<button
onClick={() => setIsMobileOpen(false)}
className="md:hidden text-gray-400 hover:text-white p-1"
aria-label="Close menu"
>
<X className="w-5 h-5" />
</button>
</div>
<nav className="flex-1">
<ul className="px-2 py-4 space-y-2">
@@ -65,20 +99,40 @@ const Sidebar = () => {
<div className="grid grid-cols-4 gap-4">
<a href="https://discord.gg/VXmU2f5WEU" target="_blank" rel="noreferrer" className={socialsBoxClass}>
<FaDiscord className={socialIconClass} />
{/* <span className="text-xs text-gray-500 mt-1">Discord</span> */}
</a>
<a href="https://www.youtube.com/@ostrisai" target="_blank" rel="noreferrer" className={socialsBoxClass}>
<FaYoutube className={socialIconClass} />
{/* <span className="text-xs text-gray-500 mt-1">YouTube</span> */}
</a>
<a href="https://x.com/ostrisai" target="_blank" rel="noreferrer" className={socialsBoxClass}>
<FaXTwitter className={socialIconClass} />
{/* <span className="text-xs text-gray-500 mt-1">X</span> */}
</a>
<ThemeToggle />
</div>
</div>
</div>
</>
);
return (
<>
{/* Desktop sidebar - always visible on md+ */}
<div className="hidden md:flex flex-col w-59 bg-gray-900 text-gray-100">{sidebarContent}</div>
{/* Mobile overlay sidebar */}
<div
className={`md:hidden fixed inset-0 bg-black/60 z-40 transition-opacity duration-300 ease-in-out ${
isMobileOpen ? 'opacity-100 pointer-events-auto' : 'opacity-0 pointer-events-none'
}`}
onClick={() => setIsMobileOpen(false)}
aria-hidden="true"
/>
<div
className={`md:hidden fixed top-0 left-0 bottom-0 w-64 max-w-[85vw] bg-gray-900 text-gray-100 z-50 flex flex-col shadow-xl transform transition-transform duration-300 ease-in-out ${
isMobileOpen ? 'translate-x-0' : '-translate-x-full'
}`}
>
{sidebarContent}
</div>
</>
);
};