feat: remove Tools dropdown and redirect inference requests to local Golang backend on http://0.0.0.0:7777

This commit is contained in:
2026-11-11 17:08:24 +05:30
parent 23f737f7cb
commit 8f4e7913fb
3 changed files with 23 additions and 130 deletions
-124
View File
@@ -15,8 +15,6 @@ import {
Scissors,
Palette,
Wand2,
ChevronDown,
ChevronRight,
Home
} from 'lucide-react';
import { SiteConfig, CategoryItem, resolveLocalised } from '@/types';
@@ -44,22 +42,8 @@ const ICON_MAP: Record<string, React.ComponentType<{ className?: string }>> = {
export function Navbar({ config, currentLocale, categories = [], totalToolsCount }: NavbarProps) {
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
const [scrolled, setScrolled] = useState(false);
const [toolsDropdownOpen, setToolsDropdownOpen] = useState(false);
const toolsTimeoutRef = useRef<NodeJS.Timeout | null>(null);
const pathname = usePathname();
const handleToolsMouseEnter = () => {
if (toolsTimeoutRef.current) clearTimeout(toolsTimeoutRef.current);
setToolsDropdownOpen(true);
};
const handleToolsMouseLeave = () => {
if (toolsTimeoutRef.current) clearTimeout(toolsTimeoutRef.current);
toolsTimeoutRef.current = setTimeout(() => {
setToolsDropdownOpen(false);
}, 180);
};
// Detect scroll to slightly elevate glass opacity
useEffect(() => {
const handleScroll = () => {
@@ -100,7 +84,6 @@ export function Navbar({ config, currentLocale, categories = [], totalToolsCount
href: item.href,
label: resolveLocalised(item.label, currentLocale),
badge: item.badge,
hasDropdown: item.hasDropdown ?? (item.href === '/tools'),
exact: item.href === '/',
}));
@@ -111,9 +94,6 @@ export function Navbar({ config, currentLocale, categories = [], totalToolsCount
const ctaLabel = resolveLocalised(config.nav?.cta?.label, currentLocale) || 'Try tools for free';
const ctaHref = config.nav?.cta?.href || '/tools';
const viewAllText = config.nav?.toolsDropdown?.viewAllText
? resolveLocalised(config.nav.toolsDropdown.viewAllText, currentLocale)
: `Explore all ${totalToolsCount || ''} studio tools`;
const dropdownTagline = config.nav?.toolsDropdown?.tagline
? resolveLocalised(config.nav.toolsDropdown.tagline, currentLocale)
: 'Instant client GPU trial · Zero retention';
@@ -140,84 +120,6 @@ export function Navbar({ config, currentLocale, categories = [], totalToolsCount
{navLinks.map((link) => {
const active = isLinkActive(link.href, link.exact);
if (link.hasDropdown) {
return (
<div
key={link.href}
className="relative"
onMouseEnter={handleToolsMouseEnter}
onMouseLeave={handleToolsMouseLeave}
>
<Link
href={link.href}
className={`relative px-3.5 py-1.5 rounded-full text-xs sm:text-sm font-body motion-safe:transition-[color,background-color,box-shadow] duration-150 flex items-center gap-1.5 ${
active
? 'bg-paper-hi text-ink font-medium shadow-xs border border-rule/80'
: 'text-ink-2 hover:text-ink hover:bg-paper-hi/60'
}`}
>
<span>{link.label}</span>
<ChevronDown className={`w-3 h-3 text-muted transition-transform duration-200 ${
toolsDropdownOpen ? 'rotate-180 text-accent' : ''
}`} />
</Link>
{/* Tools Dropdown Menu - Sleek, Clean & Professional (Text Only, No Icons) */}
{toolsDropdownOpen && (
<div
className="absolute top-full left-1/2 -translate-x-1/2 pt-2.5 w-[280px] z-50 animate-in fade-in zoom-in-95 duration-150"
>
<div className="p-2 rounded-2xl bg-paper-hi border border-rule shadow-xl space-y-1">
{/* Dynamic Categories List from JSON (Clean Typography, No Icons) */}
<div className="space-y-0.5">
{categories.map((cat) => {
const catName = resolveLocalised(cat.name, currentLocale);
const catDesc = resolveLocalised(cat.description, currentLocale);
const catHref = `/tools#category-${cat.id}`;
return (
<Link
key={cat.id}
href={catHref}
onClick={() => {
setToolsDropdownOpen(false);
if (typeof window !== 'undefined' && window.location.pathname.startsWith('/tools')) {
window.location.hash = `category-${cat.id}`;
}
}}
className="group/item block px-3.5 py-2.5 rounded-xl hover:bg-paper-2 transition-all duration-150"
>
<span className="font-sans font-semibold text-xs text-ink group-hover/item:text-accent transition-colors block">
{catName}
</span>
{catDesc && (
<p className="text-[11px] text-muted font-sans line-clamp-1 mt-0.5 group-hover/item:text-slate-600 transition-colors">
{catDesc}
</p>
)}
</Link>
);
})}
</div>
{/* Clean Minimal Footer */}
<div className="pt-2 mt-1 border-t border-rule/70 px-3.5 py-1">
<Link
href={link.href}
onClick={() => setToolsDropdownOpen(false)}
className="text-xs font-sans font-semibold text-accent hover:text-accent-hi inline-flex items-center justify-between w-full transition-colors py-1"
>
<span>{viewAllText}</span>
<ArrowRight className="w-3.5 h-3.5" />
</Link>
</div>
</div>
</div>
)}
</div>
);
}
return (
<Link
key={link.href}
@@ -300,32 +202,6 @@ export function Navbar({ config, currentLocale, categories = [], totalToolsCount
</span>
)}
</Link>
{/* Sub-categories under Tools on mobile drawer (Clean Text Only, No Icons) */}
{link.href === '/tools' && categories.length > 0 && (
<div className="pl-3 pr-1 py-1 grid grid-cols-2 gap-1.5">
{categories.map((cat) => {
const catName = resolveLocalised(cat.name, currentLocale);
const catHref = `/tools#category-${cat.id}`;
return (
<Link
key={cat.id}
href={catHref}
onClick={() => {
setMobileMenuOpen(false);
if (typeof window !== 'undefined' && window.location.pathname.startsWith('/tools')) {
window.location.hash = `category-${cat.id}`;
}
}}
className="p-2.5 rounded-xl text-xs text-ink hover:text-accent hover:bg-paper-2 bg-paper-hi/60 border border-rule font-sans font-medium transition-colors text-center"
>
<span className="truncate">{catName}</span>
</Link>
);
})}
</div>
)}
</div>
);
})}