2 lines
10 KiB
JavaScript
2 lines
10 KiB
JavaScript
|
|
import{a as c,j as e}from"./vendor-react-YMhRUmcb.js";import{c as w,u as S}from"./vendor-router-DX94Iu-2.js";import{a as k,C as o,E as C,L as _}from"./index-D2uzyr9g.js";import{u as E}from"./useDebounce-zqwECu1l.js";import{S as T,X as P,a6 as u,aS as R,U as b}from"./vendor-icons-DINCNwpk.js";import{T as q,a as A,b as m,c as x}from"./Tabs-C8UCeQNW.js";import{A as f}from"./avatar-DwZKme3D.js";import{f as D}from"./vendor-utils-4BWoYre8.js";import"./vendor-fFnFILYR.js";import"./vendor-tanstack-CoFNL2zy.js";const L={search:async s=>(await k.get("/search",{params:{q:s}})).data};function $(){const[s,a]=w(),r=s.get("q")??"",[t,i]=c.useState(r),l=E(t,500),[n,h]=c.useState(null),[v,p]=c.useState(!1),[j,g]=c.useState(null);c.useEffect(()=>{i(r)},[r]),c.useEffect(()=>{(async()=>{if(!l.trim()){h(null);return}p(!0),g(null);try{const d=await L.search(l);h(d)}catch(d){g(d instanceof Error?d:new Error("Search signal interrupted."))}finally{p(!1)}})(),l!==r&&(l?a({q:l},{replace:!0}):a({},{replace:!0}))},[l,a,r]);const N=()=>{i(""),a({}),h(null)},y=!!n&&(n.tracks.length>0||n.artists.length>0||n.playlists.length>0);return{query:t,setQuery:i,results:n,isLoading:v,error:j,clearSearch:N,hasResults:y}}function Q({query:s,onQueryChange:a,onClear:r}){return e.jsxs("div",{className:"mb-12 text-center max-w-3xl mx-auto",children:[e.jsxs("h1",{className:"text-4xl md:text-5xl font-display font-bold mb-6 text-white tracking-tight",children:["Explore the"," ",e.jsx("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-cyan-400 to-magenta-500",children:"Nebula"})]}),e.jsxs("div",{className:"relative group",children:[e.jsx("div",{className:"absolute -inset-1 bg-gradient-to-r from-cyan-500 to-magenta-500 rounded-2xl blur opacity-20 group-hover:opacity-40 transition duration-500"}),e.jsxs("div",{className:"relative flex items-center bg-black/50 backdrop-blur-xl border border-white/10 rounded-2xl overflow-hidden shadow-2xl",children:[e.jsx(T,{className:"w-5 h-5 ml-4 text-muted-foreground flex-shrink-0"}),e.jsx("input",{value:s,onChange:t=>a(t.target.value),placeholder:"Search for tracks, artists, signals...",className:"w-full bg-transparent border-none py-4 px-4 text-lg text-white placeholder:text-muted-foreground focus:outline-none focus:ring-0 font-sans",autoFocus:!0,"aria-label":"Search"}),s&&e.jsx("button",{type:"button",onClick:r,className:"p-2 mr-2 hover:bg-white/10 rounded-full transition-colors text-muted-foreground hover:text-white","aria-label":"Clear search",children:e.jsx(P,{className:"w-5 h-5"})})]})]})]})}function F(){return e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 opacity-80",children:[e.jsxs(o,{variant:"glass",className:"p-6 text-center hover:bg-white/5 transition-colors cursor-pointer group hover:-translate-y-1",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-cyan-500/10 flex items-center justify-center mx-auto mb-4 group-hover:bg-cyan-500/20 transition-colors",children:e.jsx(u,{className:"w-6 h-6 text-cyan-500"})}),e.jsx("h3",{className:"font-bold text-lg mb-1",children:"New Releases"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Fresh signals from the void"})]}),e.jsxs(o,{variant:"glass",className:"p-6 text-center hover:bg-white/5 transition-colors cursor-pointer group hover:-translate-y-1",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-magenta-500/10 flex items-center justify-center mx-auto mb-4 group-hover:bg-magenta-500/20 transition-colors",children:e.jsx(R,{className:"w-6 h-6 text-magenta-500"})}),e.jsx("h3",{className:"font-bold text-lg mb-1",children:"Curated Mixes"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Hand-picked by the algorithm"})]}),e.jsxs(o,{variant:"glass",className:"p-6 text-center hover:bg-white/5 transition-colors cursor-pointer group hover:-translate-y-1",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-lime-500/10 flex items-center justify-center mx-auto mb-4 group-hover:bg-lime-500/20 transition-colors",children:e.jsx(b,{className:"w-6 h-6 text-lime-500"})}),e.jsx("h3",{className:"font-bold text-lg
|