PageSourceSearch

https://psychicguide.net/assets/BrowseReadingsPage-wiAXPXoE.js

js psychicguide.net collected 2026-10-09 22:03:39 UTC 8,399 bytes, 1 lines download raw bytes

1import{n as O,d as X,r as _,j as e,N as Z,l as $,f as F,B as ee,x as ae,F as re,s as p}from"./index-CdlRzbIO.js";import{u as E}from"./useQuery-BBcsTIIU.js";import{S as v}from"./skeleton-CbzUyPBA.js";import{S as M,a as R,b as q,c as B,d as n}from"./select-Bn2PV-d6.js";import{S as T}from"./shopping-bag-D-fhUuGo.js";import{F as se}from"./filter-BoVYfbi7.js";import{A as te}from"./award-BtT9casY.js";import{T as ie}from"./trending-up-CE5PUVoR.js";import"./index-BdQq_4o_.js";import"./index-ClrCEPLH.js";import"./chevron-down-CJ0_mUBc.js";import"./chevron-up-QfggDjgX.js";const A={bookings:3,reviews:2.5,rating:2,clicks:1,recency:.5},je=()=>{const{categorySlug:f}=O(),[P]=X(),w=P.get("category"),[y,z]=_.useState("algorithm"),[m,g]=_.useState("all");_.useEffect(()=>{(async()=>{if(!f&&w){g(w);return}if(!f||f==="all"){g("all");return}const{data:i,error:l}=await p.from("categories").select("title_en").eq("slug",f).maybeSingle();if(l){console.error("Failed to resolve category slug:",l),g("all");return}g((i==null?void 0:i.title_en)??"all")})()},[f,w]);const{data:L}=E({queryKey:["algorithm-weights"],queryFn:async()=>{const{data:a,error:i}=await p.from("platform_settings").select("value").eq("key","algorithm_weights").single();return i||!a?A:a.value}}),j=L||A,{data:c,isLoading:V,refetch:H}=E({queryKey:["all-services-browse",j],queryFn:async()=>{const{data:a,error:i}=await p.from("services").select("id, title, description, price, category, image_urls, rating_average, total_bookings, reader_id, created_at").eq("is_active",!0).eq("approval_status","approved").order("rating_average",{ascending:!1,nullsFirst:!1}).limit(500);if(i)throw i;const l=[...new Set(a.map(s=>s.reader_id))],{data:o,error:d}=await p.from("reader_profiles").select("user_id, rating_average").in("user_id",l);if(d)throw d;const{data:u,error:r}=await p.from("public_profiles").select("user_id, display_name, avatar_url").in("user_id",l);if(r)throw r;const{data:t}=await p.from("reviews").select("reader_id").in("reader_id",l).eq("is_visible",!0),h=new Map;t==null||t.forEach(s=>{s.reader_id&&h.set(s.reader_id,(h.get(s.reader_id)||0)+1)});const N=new Map;return a.forEach(s=>{N.set(s.reader_id,(N.get(s.reader_id)||0)+1)}),a.map(s=>{const S=o==null?void 0:o.find(k=>k.user_id===s.reader_id),x=u==null?void 0:u.find(k=>k.user_id===s.reader_id),D=h.get(s.reader_id)||0,G=N.get(s.reader_id)||1,C=Math.floor(D/G),K=s.total_bookings||0,U=s.rating_average||0,W=Math.min(K/100,1),Q=Math.min(C/50,1),Y=U/5,J=W*j.bookings+Q*j.reviews+Y*j.rating;return{id:s.id,title:s.title,description:s.description,price:s.price,category:s.category,image_urls:s.image_urls,rating_average:s.rating_average,total_bookings:s.total_bookings,reader_id:s.reader_id,reader_name:(x==null?void 0:x.display_name)||null,reader_avatar:x==null?void 0:x.avatar_url,reader_rating:(S==null?void 0:S.rating_average)||0,review_count:C,click_count:0,created_at:s.created_at,popularity_score:J}})}}),I=_.useMemo(()=>c?[...new Set(c.map(i=>i.category))].sort():[],[c]),b=_.useMemo(()=>{if(!c)return[];let a=m==="all"?c:c.filter(i=>i.category===m);switch(y){case"algorithm":const i=[...a].sort((r,t)=>t.popularity_score-r.popularity_score),l=[];let o=[],d=-1;i.forEach(r=>{const t=r.popularity_score;d!==-1&&Math.abs(t-d)/Math.max(d,.1)<.1?o.push(r):(o.length>0&&l.push(o),o=[r]),d=t}),o.length>0&&l.push(o);const u=[];return l.forEach(r=>{for(let t=r.length-1;t>0;t--){const h=Math.floor(Math.random()*(t+1));[r[t],r[h]]=[r[h],r[t]]}u.push(...r)}),u;case"best-selling":return[...a].sort((r,t)=>(t.total_bookings||0)-(r.total_bookings||0));case"most-reviewed":return[...a].sort((r,t)=>(t.review_count||0)-(r.review_count||0));case"top-rated":return[...a].sort((r,t)=>(t.rating_average||0)-(r.rating_average||0));case"price-low":return[...a].sort((r,t)=>r.price-t.price);case"price-high":return[...a].sort((r,t)=>t.price-r.price);default:return a}},[c,y,m]);return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(Z,{}),e.jsxs("main",{className:"pt-20",children:[e.jsxs("section",{className:"relative py-16 bg-gradient-to-br from-primary/10 via-background to-accent/10 overflow-hidden",children:[e.jsxs("div",{className:"absolute inset-0",children:[e.jsx("div",{className:"absolute top-10 left-10 w-32 h-32 bg-primary/10 rounded-full blur-3xl"}),e.jsx("div",{className:"absolute bottom-10 right-10 w-40 h-40 bg-accent/10 rounded-full blur-3xl"})]}),e.jsx("div",{className:"container mx-auto px-4 relative z-10",children:e.jsxs("div",{className:"text-center max-w-3xl mx-auto",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-primary/10 text-primary text-sm font-medium mb-6",children:[e.jsx($,{className:"w-4 h-4"}),"Discover Your Path"]}),e.jsx("h1",{className:"font-serif text-4xl md:text-5xl font-bold text-foreground mb-4",children:"Browse All Readings"}),e.jsx("p",{className:"text-lg text-muted-foreground",children:"Explore our curated collection of psychic readings from top-rated readers. Find the perfect guidance for your spiritual journey."})]})})]}),e.jsx("section",{className:"py-6 border-b bg-background/80 backdrop-blur-sm sticky top-16 md:top-20 z-40",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(T,{className:"w-4 h-4"}),e.jsxs("span",{children:[b.length," readings available"]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{className:"w-4 h-4 text-muted-foreground"}),e.jsxs(M,{value:m,onValueChange:g,children:[e.jsx(R,{className:"w-[160px]",children:e.jsx(q,{placeholder:"Category"})}),e.jsxs(B,{children:[e.jsx(n,{value:"all",children:"All Categories"}),I.map(a=>e.jsx(n,{value:a,children:a},a))]})]})]}),e.jsxs(M,{value:y,onValueChange:z,children:[e.jsx(R,{className:"w-[180px]",children:e.jsx(q,{placeholder:"Sort by"})}),e.jsxs(B,{children:[e.jsx(n,{value:"algorithm",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(te,{className:"w-4 h-4"}),"Recommended"]})}),e.jsx(n,{value:"best-selling",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(ie,{className:"w-4 h-4"}),"Best Selling"]})}),e.jsx(n,{value:"most-reviewed",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(F,{className:"w-4 h-4"}),"Most Reviewed"]})}),e.jsx(n,{value:"top-rated",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(F,{className:"w-4 h-4"}),"Top Rated"]})}),e.jsx(n,{value:"price-low",children:"Price: Low to High"}),e.jsx(n,{value:"price-high",children:"Price: High to Low"})]})]})]})]})})}),e.jsx("section",{className:"py-12",children:e.jsx("div",{className:"container mx-auto px-4",children:V?e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-3 sm:gap-4",children:Array.from({length:12}).map((a,i)=>e.jsxs("div",{className:"card-mystical overflow-hidden",children:[e.jsx(v,{className:"aspect-square w-full"}),e.jsxs("div",{className:"p-2 sm:p-3 space-y-2",children:[e.jsx(v,{className:"h-3 w-3/4"}),e.jsx(v,{className:"h-3 w-1/2"}),e.jsx(v,{className:"h-6 w-full"})]})]},i))}):b.length===0?e.jsxs("div",{className:"text-center py-20",children:[e.jsx("div",{className:"w-24 h-24 mx-auto mb-6 rounded-full bg-muted flex items-center justify-center",children:e.jsx(T,{className:"w-12 h-12 text-muted-foreground"})}),e.jsx("h2",{className:"font-serif text-2xl font-bold text-foreground mb-2",children:"No Readings Found"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:m!=="all"?"No readings available in this category. Try a different filter.":"No readings are available at the moment. Check back soon!"}),m!=="all"&&e.jsx(ee,{variant:"outline",onClick:()=>g("all"),children:"View All Categories"})]}):e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-3 sm:gap-4",children:b.map(a=>e.jsx(ae,{id:a.id,title:a.title,price:a.price,image_urls:a.image_urls,rating_average:a.rating_average,total_bookings:a.total_bookings,reader_name:a.reader_name||void 0,reader_id:a.reader_id,onFavoriteChange:()=>H()},a.id))})})})]}),e.jsx(re,{})]})};export{je 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.