2024-08-09 14:50:25 +00:00
|
|
|
import { Button, Sheet, SheetContent, SheetTrigger } from "@/ui";
|
2024-06-09 20:04:46 +00:00
|
|
|
|
2024-08-25 20:20:38 +00:00
|
|
|
import { cn } from "@/lib/utils";
|
2024-08-09 14:50:25 +00:00
|
|
|
import { MenuIcon, Package2Icon } from "lucide-react";
|
2024-08-25 20:20:38 +00:00
|
|
|
import { useCallback } from "react";
|
2024-06-09 20:04:46 +00:00
|
|
|
import { Trans } from "react-i18next";
|
2024-08-25 20:20:38 +00:00
|
|
|
import { Link, useLocation } from "react-router-dom";
|
2024-06-09 20:04:46 +00:00
|
|
|
import { UeckoLogo } from "../UeckoLogo";
|
2024-08-09 14:50:25 +00:00
|
|
|
import { UserButton } from "./components";
|
2024-06-09 20:04:46 +00:00
|
|
|
|
|
|
|
|
export const LayoutHeader = () => {
|
2024-08-25 20:20:38 +00:00
|
|
|
const location = useLocation();
|
|
|
|
|
|
|
|
|
|
const isActiveLink = useCallback(
|
|
|
|
|
(path: string) => location.pathname === path,
|
|
|
|
|
[location.pathname]
|
|
|
|
|
);
|
|
|
|
|
|
2024-06-09 20:04:46 +00:00
|
|
|
return (
|
2024-08-27 18:58:35 +00:00
|
|
|
<header className='sticky top-0 z-20 flex items-center h-16 gap-6 px-4 border-b shadow bg-accent md:px-6'>
|
|
|
|
|
<nav className='flex-col hidden gap-6 text-lg font-medium md:flex md:flex-row md:items-center md:text-sm'>
|
|
|
|
|
<Link to='/' className='flex items-center mr-6 font-semibold'>
|
2024-06-09 20:04:46 +00:00
|
|
|
<UeckoLogo className='w-24' />
|
|
|
|
|
<span className='sr-only'>Uecko</span>
|
|
|
|
|
</Link>
|
2024-08-29 14:59:33 +00:00
|
|
|
{/*<Link
|
2024-08-25 20:20:38 +00:00
|
|
|
to='/home'
|
|
|
|
|
className={cn(
|
|
|
|
|
"transition-colors text-muted-foreground hover:text-foreground",
|
|
|
|
|
isActiveLink("/home") ? "text-foreground" : "text-muted-foreground"
|
|
|
|
|
)}
|
|
|
|
|
>
|
2024-07-03 18:05:26 +00:00
|
|
|
<Trans i18nKey='main_menu.home' />
|
2024-08-29 14:59:33 +00:00
|
|
|
</Link>*/}
|
2024-06-09 20:04:46 +00:00
|
|
|
<Link
|
|
|
|
|
to='/quotes'
|
2024-08-25 20:20:38 +00:00
|
|
|
className={cn(
|
|
|
|
|
"transition-colors text-muted-foreground hover:text-foreground",
|
|
|
|
|
isActiveLink("/quotes") ? "text-foreground" : "text-muted-foreground"
|
|
|
|
|
)}
|
2024-06-09 20:04:46 +00:00
|
|
|
>
|
|
|
|
|
<Trans i18nKey='main_menu.quotes' />
|
|
|
|
|
</Link>
|
|
|
|
|
<Link
|
|
|
|
|
to='/catalog'
|
2024-08-25 20:20:38 +00:00
|
|
|
className={cn(
|
|
|
|
|
"transition-colors text-muted-foreground hover:text-foreground",
|
|
|
|
|
isActiveLink("/catalog") ? "text-foreground" : "text-muted-foreground"
|
|
|
|
|
)}
|
2024-06-09 20:04:46 +00:00
|
|
|
>
|
|
|
|
|
<Trans i18nKey='main_menu.catalog' />
|
|
|
|
|
</Link>
|
2024-08-25 20:20:38 +00:00
|
|
|
{/*<Link
|
2024-06-09 20:04:46 +00:00
|
|
|
to='/dealers'
|
2024-08-25 20:20:38 +00:00
|
|
|
className={cn(
|
|
|
|
|
"transition-colors text-muted-foreground hover:text-foreground",
|
|
|
|
|
isActiveLink("/dealers") ? "text-foreground" : "text-muted-foreground"
|
|
|
|
|
)}
|
2024-06-09 20:04:46 +00:00
|
|
|
<Trans i18nKey='main_menu.dealers' />
|
2024-08-25 20:20:38 +00:00
|
|
|
</Link>*/}
|
|
|
|
|
<Link
|
|
|
|
|
to='/settings'
|
|
|
|
|
className={cn(
|
|
|
|
|
"transition-colors text-muted-foreground hover:text-foreground",
|
|
|
|
|
isActiveLink("/settings") ? "text-foreground" : "text-muted-foreground"
|
|
|
|
|
)}
|
|
|
|
|
>
|
2024-06-09 20:04:46 +00:00
|
|
|
<Trans i18nKey='main_menu.settings' />
|
|
|
|
|
</Link>
|
|
|
|
|
</nav>
|
|
|
|
|
<Sheet>
|
|
|
|
|
<SheetTrigger asChild>
|
|
|
|
|
<Button variant='outline' size='icon' className='shrink-0 md:hidden'>
|
|
|
|
|
<MenuIcon className='w-5 h-5' />
|
|
|
|
|
<span className='sr-only'>Toggle navigation menu</span>
|
|
|
|
|
</Button>
|
|
|
|
|
</SheetTrigger>
|
|
|
|
|
<SheetContent side='left'>
|
|
|
|
|
<nav className='grid gap-6 text-lg font-medium'>
|
|
|
|
|
<Link to='/' className='flex items-center gap-2 text-lg font-semibold'>
|
|
|
|
|
<Package2Icon className='w-6 h-6' />
|
|
|
|
|
<span className='sr-only'>Uecko</span>
|
|
|
|
|
</Link>
|
2024-08-29 14:59:33 +00:00
|
|
|
{/*<Link to='/home' className='text-muted-foreground hover:text-foreground'>
|
2024-07-03 18:05:26 +00:00
|
|
|
<Trans i18nKey='main_menu.home' />
|
2024-08-29 14:59:33 +00:00
|
|
|
</Link>*/}
|
2024-06-09 20:04:46 +00:00
|
|
|
<Link to='/quotes' className='text-muted-foreground hover:text-foreground'>
|
|
|
|
|
<Trans i18nKey='main_menu.quotes' />
|
|
|
|
|
</Link>
|
|
|
|
|
<Link to='/catalog' className='text-muted-foreground hover:text-foreground'>
|
|
|
|
|
<Trans i18nKey='main_menu.catalog' />
|
|
|
|
|
</Link>
|
|
|
|
|
<Link to='/dealers' className='text-muted-foreground hover:text-foreground'>
|
|
|
|
|
<Trans i18nKey='main_menu.dealers' />
|
|
|
|
|
</Link>
|
|
|
|
|
<Link to='/settings' className='hover:text-foreground'>
|
|
|
|
|
<Trans i18nKey='main_menu.settings' />
|
|
|
|
|
</Link>
|
|
|
|
|
</nav>
|
|
|
|
|
</SheetContent>
|
|
|
|
|
</Sheet>
|
2024-08-27 18:58:35 +00:00
|
|
|
<Link to='/' className='flex items-center font-semibold shrink-0 md:hidden'>
|
|
|
|
|
<UeckoLogo className='w-24' />
|
|
|
|
|
<span className='sr-only'>Uecko</span>
|
|
|
|
|
</Link>
|
2024-08-09 14:50:25 +00:00
|
|
|
<div className='flex items-center justify-end w-full gap-4 md:ml-auto md:gap-2 lg:gap-4'>
|
2024-06-09 20:04:46 +00:00
|
|
|
<UserButton />
|
|
|
|
|
</div>
|
|
|
|
|
</header>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
LayoutHeader.displayName = "LayoutHeader";
|