import { useAuth } from "@/hooks/use-auth"; import { useQuery } from "@tanstack/react-query"; import { Link, useLocation } from "wouter"; import { LogIn, LogOut, Telescope, CreditCard, HelpCircle } from "lucide-react"; export function Header() { const { user, isLoading, isAuthenticated } = useAuth(); const [location] = useLocation(); const { data: creditsData } = useQuery<{ credits: number; freeUsesRemaining: number; totalAnalyses: number; }>({ queryKey: ["/api/credits"], enabled: isAuthenticated, }); const navItems = [ { path: "/pricing", label: "Pricing", icon: CreditCard }, { path: "/help", label: "Help", icon: HelpCircle }, ]; return (
v1.1
{navItems.map((item) => ( {item.label} ))}
{isAuthenticated && creditsData && (
{creditsData.totalAnalyses} scans
)} {isLoading ? null : isAuthenticated ? (
{user?.profileImageUrl && ( )} {user?.firstName || user?.email || "User"}
) : ( Sign in )}
); }