"use client" import { useEffect, useState, useTransition } from 'react' import { AiTubeLogo } from "./logo" import { useStore } from "@/app/state/useStore" import { cn } from "@/lib/utils/cn" import { getTags } from '@/app/api/actions/ai-tube-hf/getTags' import Link from 'next/link' import { Input } from '@/components/ui/input' import { Button } from '@/components/ui/button' import { SearchInput } from '../search-input' import { LatentSearchInput } from '../latent-search-input' import { pathway } from '@/lib/fonts' export function TopHeader() { const [_pending, startTransition] = useTransition() const view = useStore(s => s.view) const setView = useStore(s => s.setView) const displayMode = useStore(s => s.displayMode) const setDisplayMode = useStore(s => s.setDisplayMode) const headerMode = useStore(s => s.headerMode) const setHeaderMode = useStore(s => s.setHeaderMode) const setMenuMode = useStore(s => s.setMenuMode) const currentTag = useStore(s => s.currentTag) const setCurrentTag = useStore(s => s.setCurrentTag) const currentTags = useStore(s => s.currentTags) const setCurrentTags = useStore(s => s.setCurrentTags) const setSearchAutocompleteQuery = useStore(s => s.setSearchAutocompleteQuery) const searchAutocompleteResults = useStore(s => s.searchAutocompleteResults) const setSearchQuery = useStore(s => s.setSearchQuery) const [searchDraft, setSearchDraft] = useState("") useEffect(() => { const searchQuery = searchDraft.trim().toLowerCase() setSearchQuery(searchQuery) }, [searchDraft]) const isNormalSize = headerMode === "normal" useEffect(() => { if (view === "public_media_embed") { setHeaderMode("hidden") } else if (view === "public_media" || view === "public_channel" || view === "public_music_videos") { setHeaderMode("compact") setMenuMode("slider_hidden") } else { setHeaderMode("normal") setMenuMode("normal_icon") } }, [view]) useEffect(() => { startTransition(async () => { const tags = await getTags() setCurrentTags(tags) }) }, []) if (headerMode === "hidden") { return null } return (
{ setView(view === "public_music_videos" ? "public_music_videos" : "home") }} */ >
{view === "public_music_videos" ? "AiTube Music" : "AiTube"}
{view === "public_latent_search" || view === "public_latent_media" || view === "public_latent_media_embed" ? : }
  {/* reserved for future use */}
{ isNormalSize && view !== "public_music_videos" ?
{currentTags.slice(0, 9).map(tag => (
{ setCurrentTag(currentTag === tag ? undefined : tag) }} > {tag}
))}
: null}
) }