PageSourceSearch

https://www.fassion.co.uk/assets/TrendingProducts-BG5O9dKu.js

js fassion.co.uk collected 2026-10-09 22:02:21 UTC 2,191 bytes, 1 lines download raw bytes

1import{u as N,a as w,b as y,r as i,j as e,B as T,i as E,s as p}from"./index-FAOCbpaf.js";import{P as C}from"./ProductCard-DBs1e9Jk.js";import{C as L}from"./chevron-left-Dr-C4TrF.js";import"./SaveToCollectionDialog-BMwDZxvD.js";import"./GuestLimitDialog-BQ3696fp.js";import"./alert-dialog-DTtxYP-8.js";import"./plus-D0sO7tVU.js";import"./heart-N7P8ZJs8.js";const R=()=>{var d;const x=N(),c=w(),r=(d=x.state)==null?void 0:d.preferences;y();const[o,h]=i.useState([]),[f,b]=i.useState(!0);return i.useEffect(()=>{(async()=>{if(r)try{const n=E(r),{data:a,error:l}=await p.from("brands").select("*").contains("archetypes",[n]).eq("gender",r.gender);if(l)throw l;const j=(a==null?void 0:a.map(s=>s.id))||[],{data:P,error:u}=await p.from("products").select("*").in("brand_id",j).eq("gender",r.gender).order("created_at",{ascending:!0}).limit(200);if(u)throw u;const m={},v=(P||[]).filter(s=>{const g=m[s.brand_id]||0;return g<2?(m[s.brand_id]=g+1,!0):!1});h(v.slice(0,30))}catch(n){console.error("Error fetching trending products:",n)}finally{b(!1)}})()},[r]),r?f?e.jsx("div",{className:"min-h-screen bg-white flex items-center justify-center",children:e.jsx("p",{children:"Loading trending products..."})}):e.jsxs("div",{className:"min-h-screen bg-white",children:[e.jsx("div",{className:"container mx-auto px-4 lg:px-8 xl:px-12 pt-4",children:e.jsxs(T,{variant:"ghost",size:"sm",onClick:()=>c(-1),children:[e.jsx(L,{className:"h-4 w-4 mr-2"}),"Back"]})}),e.jsxs("div",{className:"container mx-auto px-4 lg:px-8 xl:px-12 py-8 max-w-7xl",children:[e.jsx("h1",{className:"text-4xl md:text-5xl font-bold tracking-tight text-neutral-900 mb-5 uppercase",children:"Trending Products"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6",children:o.map(t=>{var n;return e.jsx(C,{product:{id:t.id,name:t.name,brand:"",price:t.price,image:((n=t.images)==null?void 0:n[0])||"",website:t.product_url||""},navigationState:{returnTo:"/trending-products",returnToLabel:"Trending Products",preferences:r}},t.id)})}),o.length===0&&e.jsx("p",{className:"text-center text-neutral-500 py-12",children:"No trending products found at the moment."})]})]}):(c("/"),null)};export{R 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.