PageSourceSearch

https://novelzy.com/assets/search-B-LG1AND.js

js novelzy.com collected 2026-10-02 01:37:43 UTC 5,490 bytes, 1 lines download raw bytes

1import{u as g,j as e}from"./vendor-query-6nO0aXI-.js";import{u as S,r as s}from"./vendor-router-yscda1MA.js";import{a as h}from"./api-B7OcOsYd.js";import{M as C}from"./layout-CSgm68uq.js";import{i as k,t as L,u as A,S as P,l as _,B as F}from"./vendor-ui-CtoxC0Mt.js";import"./index-BOKZ6oQA.js";import"./vendor-react-k6yPa1qy.js";import"./languages-n-zsb-Mz.js";const M=[{value:"popular",label:"Most Popular"},{value:"rating",label:"Highest Rated"},{value:"newest",label:"Newest"},{value:"chapters",label:"Most Chapters"},{value:"words",label:"Most Words"}],O=["all","ongoing","completed","hiatus"],q=["all","en","es","fr","de","pt","zh","ja","ko","ar"];function K(){const[,p]=S(),[l,b]=s.useState(""),[o,j]=s.useState("popular"),[c,y]=s.useState("all"),[n,f]=s.useState("all"),[i,N]=s.useState(""),[d,u]=s.useState(1),[x,v]=s.useState(!1),{data:m}=g({queryKey:["categories"],queryFn:h.getCategories}),{data:t,isLoading:w}=g({queryKey:["search",l,o,c,n,i,d],queryFn:()=>h.search({q:l,sort:o,status:c,language:n,category:i,page:d}),enabled:!0});return e.jsx(C,{children:e.jsx("div",{className:"min-h-screen bg-[#0f0f1a]",children:e.jsxs("div",{className:"max-w-6xl mx-auto px-4 py-6",children:[e.jsxs("div",{className:"flex gap-3 mb-6",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(k,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Search novels, authors...",value:l,onChange:a=>{b(a.target.value),u(1)},className:"w-full pl-10 pr-4 py-3 bg-[#1a1a2e] border border-gray-700 rounded-xl text-white placeholder-gray-500 focus:outline-none focus:border-[#7c3aed]"})]}),e.jsxs("button",{onClick:()=>v(!x),className:"px-4 py-3 bg-[#1a1a2e] border border-gray-700 rounded-xl text-white flex items-center gap-2 hover:border-[#7c3aed]",children:[e.jsx(L,{className:"w-5 h-5"})," Filters ",e.jsx(A,{className:`w-4 h-4 transition-transform ${x?"rotate-180":""}`})]})]}),x&&e.jsxs("div",{className:"bg-[#1a1a2e] rounded-xl p-4 mb-6 grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-400 mb-1 block",children:"Sort By"}),e.jsx("select",{value:o,onChange:a=>j(a.target.value),className:"w-full p-2 bg-[#252540] border border-gray-700 rounded-lg text-white text-sm",children:M.map(a=>e.jsx("option",{value:a.value,children:a.label},a.value))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-400 mb-1 block",children:"Status"}),e.jsx("select",{value:c,onChange:a=>y(a.target.value),className:"w-full p-2 bg-[#252540] border border-gray-700 rounded-lg text-white text-sm capitalize",children:O.map(a=>e.jsx("option",{value:a,children:a},a))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-400 mb-1 block",children:"Language"}),e.jsx("select",{value:n,onChange:a=>f(a.target.value),className:"w-full p-2 bg-[#252540] border border-gray-700 rounded-lg text-white text-sm uppercase",children:q.map(a=>e.jsx("option",{value:a,children:a},a))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-gray-400 mb-1 block",children:"Category"}),e.jsxs("select",{value:i,onChange:a=>N(a.target.value),className:"w-full p-2 bg-[#252540] border border-gray-700 rounded-lg text-white text-sm",children:[e.jsx("option",{value:"",children:"All Categories"}),(Array.isArray(m)?m:[]).map(a=>e.jsx("option",{value:a.key,children:a.name},a.key))]})]})]}),t&&e.jsxs("p",{className:"text-gray-400 text-sm mb-4",children:[t.total||0," results found"]}),w?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx("div",{className:"animate-spin w-8 h-8 border-2 border-[#7c3aed] border-t-transparent rounded-full"})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:(t?.novels||[]).map(a=>e.jsxs("div",{onClick:()=>p(`/novel/${a.slug}`),className:"bg-[#1a1a2e] rounded-xl p-4 flex gap-4 cursor-pointer hover:bg-[#252540] transition-colors",children:[e.jsx("div",{className:"w-20 aspect-[9/16] rounded-lg bg-gradient-to-br from-purple-600 to-blue-600 flex-shrink-0 overflow-hidden",children:a.cover_url&&e.jsx("img",{src:a.c
1over_url,alt:"",className:"w-full h-full object-cover"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-white font-semibold truncate",children:a.title}),e.jsx("p",{className:"text-gray-400 text-sm",children:a.author_name}),e.jsx("p",{className:"text-gray-500 text-xs mt-1 line-clamp-2",children:a.description}),e.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-gray-400",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(P,{className:"w-3 h-3 text-yellow-400"})," ",a.rating]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(_,{className:"w-3 h-3"})," ",(a.views||0).toLocaleString()]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(F,{className:"w-3 h-3"})," ",a.total_chapters," ch"]}),e.jsx("span",{className:`px-2 py-0.5 rounded-full text-[10px] ${a.status==="completed"?"bg-green-500/20 text-green-400":"bg-blue-500/20 text-blue-400"}`,children:a.status})]})]})]},a.id))}),t&&t.totalPages>1&&e.jsx("div",{className:"flex justify-center gap-2 mt-8",children:Array.from({length:Math.min(t.totalPages,10)},(a,r)=>e.jsx("button",{onClick:()=>u(r+1),className:`w-10 h-10 rounded-lg text-sm font-medium ${d===r+1?"bg-[#7c3aed] text-white":"bg-[#1a1a2e] text-gray-400 hover:bg-[#252540]"}`,children:r+1},r))})]})})})}export{K as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.