2025-04-02 20:42:47 -03:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
import { usePathname, useRouter } from 'next/navigation';
|
|
|
|
import { Button } from '../src/components/ui/button';
|
2025-04-27 09:25:48 -03:00
|
|
|
import Image from 'next/image';
|
2025-06-21 14:30:11 -03:00
|
|
|
import { useRef, useEffect } from 'react';
|
2025-04-02 20:42:47 -03:00
|
|
|
|
|
|
|
const examples = [
|
|
|
|
{ name: "Chat", href: "/chat" },
|
2025-04-26 21:44:35 -03:00
|
|
|
{ name: "Dashboard", href: "/dashboard" },
|
2025-04-02 20:42:47 -03:00
|
|
|
{ name: "Mail", href: "/mail" },
|
2025-04-18 23:11:10 -03:00
|
|
|
{ name: "Tree", href: "/tree" },
|
|
|
|
{ name: "Editor", href: "/editor" },
|
|
|
|
{ name: "Tables", href: "/table" },
|
2025-04-27 19:03:20 -03:00
|
|
|
{ name: "Meet", href: "/meet" },
|
2025-04-26 21:44:35 -03:00
|
|
|
{ name: "Videos", href: "/videos" },
|
2025-04-18 23:11:10 -03:00
|
|
|
{ name: "Music", href: "/music" },
|
2025-04-02 20:42:47 -03:00
|
|
|
{ name: "Templates", href: "/templates" },
|
2025-04-26 21:44:35 -03:00
|
|
|
{ name: "Settings", href: "/settings" },
|
2025-04-02 20:42:47 -03:00
|
|
|
];
|
|
|
|
|
|
|
|
export function Nav() {
|
|
|
|
const pathname = usePathname();
|
|
|
|
const router = useRouter();
|
2025-06-21 14:30:11 -03:00
|
|
|
const scrollContainerRef = useRef<HTMLDivElement>(null);
|
|
|
|
const navItemsRefs = useRef<(HTMLButtonElement | null)[]>([]);
|
|
|
|
|
|
|
|
// Enhanced URL matching to handle sub-routes
|
|
|
|
const isActive = (href: string) => {
|
|
|
|
if (href === '/') return pathname === href;
|
|
|
|
return pathname.startsWith(href);
|
|
|
|
};
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
// Load GSAP from CDN
|
|
|
|
const script = document.createElement('script');
|
|
|
|
script.src = 'https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js';
|
|
|
|
script.onload = () => {
|
|
|
|
const gsap = window.gsap;
|
|
|
|
|
|
|
|
// Animate navigation items on mount
|
|
|
|
gsap.fromTo('.nav-item',
|
|
|
|
{
|
|
|
|
opacity: 0,
|
|
|
|
y: -10,
|
|
|
|
scale: 0.9
|
|
|
|
},
|
|
|
|
{
|
|
|
|
opacity: 1,
|
|
|
|
y: 0,
|
|
|
|
scale: 1,
|
|
|
|
duration: 0.6,
|
|
|
|
stagger: 0.1,
|
|
|
|
ease: "back.out(1.7)"
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
// Add hover animations
|
|
|
|
navItemsRefs.current.forEach((item, index) => {
|
|
|
|
if (item) {
|
|
|
|
item.addEventListener('mouseenter', () => {
|
|
|
|
gsap.to(item, {
|
|
|
|
scale: 1.05,
|
|
|
|
duration: 0.3,
|
|
|
|
ease: "power2.out"
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
item.addEventListener('mouseleave', () => {
|
|
|
|
gsap.to(item, {
|
|
|
|
scale: 1,
|
|
|
|
duration: 0.3,
|
|
|
|
ease: "power2.out"
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
item.addEventListener('click', () => {
|
|
|
|
gsap.to(item, {
|
|
|
|
scale: 0.95,
|
|
|
|
duration: 0.1,
|
|
|
|
yoyo: true,
|
|
|
|
repeat: 1,
|
|
|
|
ease: "power2.inOut"
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Animate logo
|
|
|
|
gsap.fromTo('.logo',
|
|
|
|
{
|
|
|
|
opacity: 0,
|
|
|
|
x: -20,
|
|
|
|
rotate: -10
|
|
|
|
},
|
|
|
|
{
|
|
|
|
opacity: 1,
|
|
|
|
x: 0,
|
|
|
|
rotate: 0,
|
|
|
|
duration: 0.8,
|
|
|
|
ease: "elastic.out(1, 0.5)"
|
|
|
|
}
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
document.head.appendChild(script);
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
if (document.head.contains(script)) {
|
|
|
|
document.head.removeChild(script);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
// Smooth scroll functions for mobile
|
|
|
|
const scrollLeft = () => {
|
|
|
|
if (scrollContainerRef.current) {
|
|
|
|
scrollContainerRef.current.scrollBy({
|
|
|
|
left: -150,
|
|
|
|
behavior: 'smooth'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const scrollRight = () => {
|
|
|
|
if (scrollContainerRef.current) {
|
|
|
|
scrollContainerRef.current.scrollBy({
|
|
|
|
left: 150,
|
|
|
|
behavior: 'smooth'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
2025-04-02 20:42:47 -03:00
|
|
|
|
|
|
|
return (
|
2025-06-21 14:30:11 -03:00
|
|
|
<>
|
|
|
|
<div className="nav-container">
|
|
|
|
<div className="nav-inner">
|
|
|
|
<div className="nav-content">
|
|
|
|
<div className="logo-container">
|
|
|
|
<Image
|
|
|
|
src="/images/generalbots-logo.svg"
|
|
|
|
alt="Logo"
|
|
|
|
width={64}
|
|
|
|
height={24}
|
|
|
|
className="logo"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<button className="scroll-btn scroll-left" onClick={scrollLeft} aria-label="Scroll left">
|
|
|
|
‹
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<div
|
|
|
|
ref={scrollContainerRef}
|
|
|
|
className="nav-scroll"
|
2025-04-27 09:25:48 -03:00
|
|
|
>
|
2025-06-21 14:30:11 -03:00
|
|
|
<div className="nav-items">
|
|
|
|
{examples.map((example, index) => {
|
|
|
|
const active = isActive(example.href);
|
|
|
|
return (
|
|
|
|
<button
|
|
|
|
key={example.href}
|
|
|
|
ref={el => navItemsRefs.current[index] = el}
|
|
|
|
onClick={() => router.push(example.href)}
|
|
|
|
className={`nav-item ${active ? 'active' : ''}`}
|
|
|
|
>
|
|
|
|
{example.name}
|
|
|
|
<div className="neon-glow"></div>
|
|
|
|
</button>
|
|
|
|
);
|
|
|
|
})}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<button className="scroll-btn scroll-right" onClick={scrollRight} aria-label="Scroll right">
|
|
|
|
›
|
|
|
|
</button>
|
|
|
|
</div>
|
2025-04-27 09:25:48 -03:00
|
|
|
</div>
|
2025-04-02 20:42:47 -03:00
|
|
|
</div>
|
2025-06-21 14:30:11 -03:00
|
|
|
|
|
|
|
<div className="nav-spacer"></div>
|
|
|
|
|
|
|
|
<style jsx>{`
|
|
|
|
.nav-container {
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
z-index: 50;
|
|
|
|
background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
|
|
|
|
border-bottom: 1px solid #333;
|
|
|
|
height: 40px;
|
|
|
|
box-shadow: 0 2px 20px rgba(0, 255, 255, 0.1);
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-inner {
|
|
|
|
max-width: 100%;
|
|
|
|
margin: 0 auto;
|
|
|
|
padding: 0 16px;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-content {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
height: 100%;
|
|
|
|
gap: 8px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.logo-container {
|
|
|
|
flex-shrink: 0;
|
|
|
|
padding: 4px;
|
|
|
|
border-radius: 6px;
|
|
|
|
background: rgba(0, 255, 255, 0.1);
|
|
|
|
box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
|
|
|
|
}
|
|
|
|
|
|
|
|
.logo {
|
|
|
|
height: 20px;
|
|
|
|
width: auto;
|
|
|
|
filter: drop-shadow(0 0 5px rgba(0, 255, 255, 0.5));
|
|
|
|
}
|
|
|
|
|
|
|
|
.scroll-btn {
|
|
|
|
display: none;
|
|
|
|
background: rgba(0, 255, 255, 0.2);
|
|
|
|
border: 1px solid rgba(0, 255, 255, 0.3);
|
|
|
|
color: #00ffff;
|
|
|
|
width: 32px;
|
|
|
|
height: 32px;
|
|
|
|
border-radius: 50%;
|
|
|
|
cursor: pointer;
|
|
|
|
font-size: 18px;
|
|
|
|
font-weight: bold;
|
|
|
|
transition: all 0.3s ease;
|
|
|
|
flex-shrink: 0;
|
|
|
|
z-index: 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
.scroll-btn:hover {
|
|
|
|
background: rgba(0, 255, 255, 0.3);
|
|
|
|
box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
|
|
|
|
transform: scale(1.1);
|
|
|
|
}
|
|
|
|
|
|
|
|
.scroll-btn:active {
|
|
|
|
transform: scale(0.95);
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-scroll {
|
|
|
|
flex: 1;
|
|
|
|
overflow-x: auto;
|
|
|
|
overflow-y: hidden;
|
|
|
|
height: 100%;
|
|
|
|
-ms-overflow-style: none;
|
|
|
|
scrollbar-width: none;
|
|
|
|
scroll-behavior: smooth;
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-scroll::-webkit-scrollbar {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-items {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
height: 100%;
|
|
|
|
white-space: nowrap;
|
|
|
|
gap: 3px;
|
|
|
|
padding: 0 8px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-item {
|
|
|
|
position: relative;
|
|
|
|
background: rgba(255, 255, 255, 0.05);
|
|
|
|
border: 1px solid rgba(0, 255, 255, 0.2);
|
|
|
|
color: #e0e0e0;
|
|
|
|
font-size: 13px;
|
|
|
|
font-weight: 500;
|
|
|
|
padding: 6px 14px;
|
|
|
|
cursor: pointer;
|
|
|
|
border-radius: 6px;
|
|
|
|
height: 32px;
|
|
|
|
display: inline-flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
text-decoration: none;
|
|
|
|
white-space: nowrap;
|
|
|
|
transition: all 0.3s ease;
|
|
|
|
backdrop-filter: blur(10px);
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-item::before {
|
|
|
|
content: '';
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: -100%;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.2), transparent);
|
|
|
|
transition: left 0.5s;
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-item:hover::before {
|
|
|
|
left: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-item:hover {
|
|
|
|
background: rgba(0, 255, 255, 0.1);
|
|
|
|
border-color: rgba(0, 255, 255, 0.4);
|
|
|
|
color: #00ffff;
|
|
|
|
box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
|
|
|
|
text-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-item.active {
|
|
|
|
background: linear-gradient(135deg, rgba(0, 255, 255, 0.2), rgba(0, 200, 255, 0.3));
|
|
|
|
border-color: #00ffff;
|
|
|
|
color: #ffffff;
|
|
|
|
box-shadow:
|
|
|
|
0 0 20px rgba(0, 255, 255, 0.4),
|
|
|
|
inset 0 0 10px rgba(0, 255, 255, 0.1);
|
|
|
|
text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-item.active:hover {
|
|
|
|
background: linear-gradient(135deg, rgba(0, 255, 255, 0.3), rgba(0, 200, 255, 0.4));
|
|
|
|
box-shadow:
|
|
|
|
0 0 25px rgba(0, 255, 255, 0.6),
|
|
|
|
inset 0 0 15px rgba(0, 255, 255, 0.2);
|
|
|
|
}
|
|
|
|
|
|
|
|
.neon-glow {
|
|
|
|
position: absolute;
|
|
|
|
top: -2px;
|
|
|
|
left: -2px;
|
|
|
|
right: -2px;
|
|
|
|
bottom: -2px;
|
|
|
|
background: linear-gradient(45deg, transparent, rgba(0, 255, 255, 0.3), transparent);
|
|
|
|
border-radius: 8px;
|
|
|
|
opacity: 0;
|
|
|
|
transition: opacity 0.3s ease;
|
|
|
|
z-index: -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-item:hover .neon-glow,
|
|
|
|
.nav-item.active .neon-glow {
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-spacer {
|
|
|
|
height: 40px;
|
|
|
|
}
|
|
|
|
|
|
|
|
@media (max-width: 768px) {
|
|
|
|
.nav-container {
|
|
|
|
height: 36px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-spacer {
|
|
|
|
height: 36px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-inner {
|
|
|
|
padding: 0 8px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-content {
|
|
|
|
gap: 6px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.scroll-btn {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
width: 28px;
|
|
|
|
height: 28px;
|
|
|
|
font-size: 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.logo {
|
|
|
|
height: 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-item {
|
|
|
|
font-size: 12px;
|
|
|
|
padding: 4px 12px;
|
|
|
|
height: 28px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@media (max-width: 480px) {
|
|
|
|
.nav-container {
|
|
|
|
height: 32px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-spacer {
|
|
|
|
height: 32px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-inner {
|
|
|
|
padding: 0 6px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-content {
|
|
|
|
gap: 4px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.scroll-btn {
|
|
|
|
width: 24px;
|
|
|
|
height: 24px;
|
|
|
|
font-size: 14px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.logo {
|
|
|
|
height: 14px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-item {
|
|
|
|
font-size: 11px;
|
|
|
|
padding: 3px 10px;
|
|
|
|
height: 24px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Touch-friendly scrolling for mobile */
|
|
|
|
@media (hover: none) and (pointer: coarse) {
|
|
|
|
.nav-scroll {
|
|
|
|
-webkit-overflow-scrolling: touch;
|
|
|
|
scroll-snap-type: x mandatory;
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-item {
|
|
|
|
scroll-snap-align: start;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`}</style>
|
|
|
|
</>
|
2025-04-02 20:42:47 -03:00
|
|
|
);
|
|
|
|
}
|