Inject Admin link to nav when owner logged in

cgen-5fdcc739331d424e91bf2f4ce9fa4aba
This commit is contained in:
Builder.io 2025-09-27 21:04:52 +00:00
parent a25fca38c7
commit b8dbf10fa5

View file

@ -60,24 +60,30 @@ export default function Layout({ children }: LayoutProps) {
{/* Navigation */} {/* Navigation */}
<nav className="hidden md:flex items-center space-x-8"> <nav className="hidden md:flex items-center space-x-8">
{(user ? userNavigation : navigation).map((item, index) => ( {(() => {
<Link const isOwner = user?.email?.toLowerCase() === "mrpiglr@gmail.com";
key={item.name} const navItems = user
to={item.href} ? (isOwner ? [{ name: "Admin", href: "/admin" }, ...userNavigation] : userNavigation)
className={cn( : navigation;
"text-sm font-medium transition-all duration-300 hover:text-aethex-400 hover:scale-105 relative animate-fade-in", return navItems.map((item, index) => (
location.pathname === item.href <Link
? "text-aethex-500 animate-pulse-glow" key={item.name}
: "text-muted-foreground", to={item.href}
)} className={cn(
style={{ animationDelay: `${index * 0.1}s` }} "text-sm font-medium transition-all duration-300 hover:text-aethex-400 hover:scale-105 relative animate-fade-in",
> location.pathname === item.href
{item.name} ? "text-aethex-500 animate-pulse-glow"
{location.pathname === item.href && ( : "text-muted-foreground",
<div className="absolute -bottom-1 left-0 right-0 h-0.5 bg-gradient-to-r from-aethex-400 to-neon-blue animate-scale-in" /> )}
)} style={{ animationDelay: `${index * 0.1}s` }}
</Link> >
))} {item.name}
{location.pathname === item.href && (
<div className="absolute -bottom-1 left-0 right-0 h-0.5 bg-gradient-to-r from-aethex-400 to-neon-blue animate-scale-in" />
)}
</Link>
));
})()}
</nav> </nav>
{/* Auth Section */} {/* Auth Section */}