veza/apps/web/dist_verification/assets/SearchPage-B5C5XA5d.js

2 lines
13 KiB
JavaScript
Raw Normal View History

import{a as u,j as e,R as S}from"./vendor-react-yWUy5XPk.js";import{u as E,a as _}from"./vendor-router-BNNHboN9.js";import{g as C,C as d,E as D,i as P,S as l}from"./index-CYK_b1Uz.js";import{u as T}from"./useDebounce-B1fFOcpX.js";import{S as $,X as R,s as p,J as A,ad as j,av as I}from"./vendor-icons-DJFb1Tiw.js";import{T as K,a as L,b as x,c as h}from"./Tabs-jry2MOtG.js";import{A as v}from"./avatar-iUZRi_fz.js";import{a as Q}from"./vendor-utils-DtoSyhX2.js";import"./vendor-CveO81sn.js";import"./vendor-security-DsrNJhpn.js";import"./vendor-tanstack-kPY9uK0s.js";import"./vendor-http-Cz8wfb0q.js";import"./vendor-motion-B3XPS3Jc.js";import"./vendor-i18n-CMcqpBLz.js";const F={search:async r=>(await C.get("/search",{params:{q:r}})).data};function M(){const[r,t]=E(),n=r.get("q")??"",[o,s]=u.useState(n),a=T(o,500),[i,g]=u.useState(null),[N,f]=u.useState(!1),[y,b]=u.useState(null);u.useEffect(()=>{s(n)},[n]),u.useEffect(()=>{(async()=>{if(!a.trim()){g(null);return}f(!0),b(null);try{const m=await F.search(a);g(m)}catch(m){b(m instanceof Error?m:new Error("Search signal interrupted."))}finally{f(!1)}})(),a!==n&&(a?t({q:a},{replace:!0}):t({},{replace:!0}))},[a,t,n]);const w=()=>{s(""),t({}),g(null)},k=!!i&&(i.tracks.length>0||i.artists.length>0||i.playlists.length>0);return{query:o,setQuery:s,results:i,isLoading:N,error:y,clearSearch:w,hasResults:k}}function H({query:r,onQueryChange:t,onClear:n}){return e.jsxs("div",{className:"mb-12 text-center max-w-3xl mx-auto",children:[e.jsxs("h1",{className:"text-display md:text-5xl font-heading mb-6 text-foreground",children:["Explore the"," ",e.jsx("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-primary to-secondary",children:"Nebula"})]}),e.jsxs("div",{className:"relative group",children:[e.jsx("div",{className:"absolute -inset-1 bg-gradient-to-r from-primary to-secondary rounded-2xl blur opacity-20 group-hover:opacity-40 transition duration-[var(--sumi-duration-slow)]"}),e.jsxs("div",{className:"relative flex items-center bg-card/80 backdrop-blur-xl border border-border rounded-2xl overflow-hidden shadow-2xl",children:[e.jsx($,{className:"w-5 h-5 ml-4 text-muted-foreground flex-shrink-0"}),e.jsx("input",{value:r,onChange:o=>t(o.target.value),placeholder:"Search for tracks, artists, signals...",className:"w-full bg-transparent border-none py-4 px-4 text-lg text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-0 font-sans",autoFocus:!0,"aria-label":"Search"}),r&&e.jsx("button",{type:"button",onClick:n,className:"p-2 mr-2 hover:bg-muted/50 rounded-full transition-colors duration-[var(--duration-fast)] text-muted-foreground hover:text-foreground","aria-label":"Clear search",children:e.jsx(R,{className:"w-5 h-5"})})]})]})]})}function X(){return e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 opacity-80",children:[e.jsxs(d,{variant:"glass",className:"p-6 text-center hover:bg-white/5 transition-colors cursor-pointer group",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-4 group-hover:bg-primary/20 transition-colors",children:e.jsx(p,{className:"w-6 h-6 text-primary"})}),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(d,{variant:"glass",className:"p-6 text-center hover:bg-white/5 transition-colors cursor-pointer group",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-destructive/10 flex items-center justify-center mx-auto mb-4 group-hover:bg-destructive/20 transition-colors",children:e.jsx(A,{className:"w-6 h-6 text-destructive"})}),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(d,{variant:"glass",className:"p-6 text-center hover:bg-white/5 transition-colors cursor-pointer group",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-success/10 flex items-center justify-center mx-auto mb-4 group-