PageSourceSearch

https://gearment.com/assets/(_lang).catalog.category.(_categorySlug)._index-DtSaUX-4.js

js gearment.com collected 2026-10-02 06:19:16 UTC 10,541 bytes, 1 lines download raw bytes

1import{j as e,r as v}from"./jsx-runtime-DpCiThIL.js";import{c as I}from"./redirect-pod-CPiuXaqq.js";import{C as W}from"./card-CNmBTvhU.js";import{X as B}from"./x-CxAgPE7S.js";import{a as k,e as $,b as E,u as X,L as G}from"./components-Cp8-GPLf.js";import{u as J,S as Y}from"./use-debounce-WqgwITsr.js";import{A as L,a as Z,b as ee,c as te}from"./accordion-CEjESAFv.js";import{u as se}from"./useWindowSize-CBVn3Gxe.js";import{F as re}from"./faq-section-rIy4wG68.js";import{g as _}from"./translation-T2G4EOHB.js";import{H as ae}from"./highlight-section-DsFe4Ps1.js";import{B as ne}from"./breadcrumb-C-O-DzOv.js";import{S as U}from"./search-oiadI-iQ.js";import{H as oe}from"./h2-C_6IntN6.js";import{P as ie}from"./pagination-wVjwokI1.js";import{S as le}from"./subscribe-bZWiKR7D.js";import{C as ce}from"./category-banner-Ck93Pqhj.js";import{u as de}from"./useTranslation-E6oPREaK.js";import"./button-link-DV62eoCr.js";import"./money-CV0vW8Ss.js";import"./product_pb-DCkIF74K.js";import"./join-us-D8hVCV1H.js";import"./home-CMV6bGrq.js";import"./arrowNext-DqX5w5IS.js";import"./autoplay-DZJHSqDg.js";import"./create-element-if-not-defined-DVHJdWeY.js";import"./context-CRgp19_B.js";function me({options:s,types:r,setSelectedOptions:t}){var b;const[o,m]=k(),u=o.get("category"),n=r.find(l=>l.id.toString()===u),p=o.get("options")?(b=o.get("options"))==null?void 0:b.split(","):[],g=s.filter(l=>l.values.some(x=>p==null?void 0:p.includes(x.code))).map(l=>({...l,values:l.values.filter(x=>p==null?void 0:p.includes(x.code))})),h=()=>{const l=new URLSearchParams;m(l,{preventScrollReset:!0})},a=l=>{const x=new URLSearchParams,f=o.get("category");f&&x.set("category",f);const w=(p||[]).filter(N=>!l.includes(N));t(w),x.set("options",w.join(",")),m(x,{preventScrollReset:!0})},d=()=>{const l=new URLSearchParams;m(l,{preventScrollReset:!0}),t([])},i=()=>n&&e.jsxs("div",{className:"border rounded-md border-stroke bg-gray-200 py-[5px] px-[14px] flex items-center justify-center text-primary-text text-base",children:[e.jsxs("span",{children:["Type:",n.name]}),e.jsx("div",{onClick:h,children:e.jsx(B,{className:"ml-2 text-primary-text w-3 h-3"})})]}),S=()=>g.map((l,x)=>e.jsxs("div",{className:"border rounded-md border-stroke bg-gray-200 py-[5px] px-[14px] flex items-center justify-center text-primary-text text-base",children:[e.jsxs("span",{children:[l.name,": ",l.values.map(f=>f.name).join(", ")]}),e.jsx("div",{onClick:()=>a(l.values.map(f=>f.code)),children:e.jsx(B,{className:"ml-2 text-primary-text w-3 h-3"})})]},`${l.name}-${x}`)),y=()=>(g.length!==0||!!n)&&e.jsx("div",{onClick:d,className:"text-primary text-base cursor-pointer h-9 flex items-center",children:"Clear all filters"});return e.jsx(e.Fragment,{children:n&&e.jsxs("div",{className:"flex justify-start mb-8 gap-3",children:[i(),S(),y()]})})}function pe({categories:s}){const{categorySlug:r}=$(),[t]=k(),o=E(),m=t.get("options"),u=t.get("category"),[n,p]=v.useState(null),{width:g}=se(),h=xe(s),a=ue(s),d=i=>{const S={pathname:`/catalog/category/${i.slug}`,search:m?`?options=${m}`:void 0};o(S)};return v.useEffect(()=>{g>768?p(!1):p(!0)},[g]),e.jsx("div",{className:"border border-stroke rounded-lg bg-white p-4",children:n?e.jsx(L,{type:"single",collapsible:!0,children:h.map(i=>e.jsx(O,{category:i,childCategories:a[i.id.toString()],onClickCategory:d,categorySlug:r,selectedCategory:u},Number(i.id)))}):e.jsx(L,{type:"multiple",defaultValue:s.map(i=>i.id.toString()),children:h.map(i=>e.jsx(O,{category:i,childCategories:a[i.id.toString()],onClickCategory:d,categorySlug:r,selectedCategory:u},Number(i.id)))})})}function xe(s){var r;return(r=s.filter(t=>t.parentId.toString()==="0"))==null?void 0:r.sort((t,o)=>Number(t.displayOrder)-Number(o.displayOrder))}function ue(s){return s.filter(r=>r.parentId.toString()!=="0").reduce((r,t)=>(r[t.parentId.toString()]=r[t.parentId.toString()]||[],r[t.parentId.toString()].push(t),r),{})}function O({category:s,childCategories:r,onClickCategory:t,categorySlug:o,selectedCategory:m}){var u;return e.jsx(e.Fragment,{children:e.jsxs(Z,{className:"AccordionItem",value:s.id.toString(),children:[e.jsx(ee,{className:"text-lg py-3 px-4 text-left",children:e.jsx("span",{className:"text-primary-text",children:s.name})}),e.jsx(te,{children:(u=r==null?void 0:r.sort((n,p)=>Number(n.displayOrder)-Number(p.displayOrder)))==null?void 0:u.map(n=>e.jsx("div",{onClick:()=>t(n),className:I("flex items-center space-x-4 pl-9 pr-8 py-[10px] cursor-pointer",{"bg-[#3758F9] bg-opacity-5 text-white border-r-[3px] border-primary":o===n.slug.toString()}),children:e.jsx("div",{className:I("text-secondary-text font-medium",{"!text-primary":m===n.id.toString()}),children:n.name})},Number(n.id)))})]})})}function ge({category:s,options:r,search:t,setSearch:o,debounceSearch:m,isBanner:u=!0,onPressSearch:n,placeholder:p="Search products"}){const[g,h]=k();v.useEffect(()=>{const d=new URLSearchParams;t&&d.set("search",m),r&&d.set("options",r),h(d,{preventScrollReset:!0})},[m]);const a=d=>{d.key==="Enter"&&n&&n(t)};return e.jsxs("div",{className:"mb-8",children:[e.jsxs("div",{className:"mb-8 flex flex-col md:flex-row md:items-center justify-between",children:[e.jsx("h1",{className:"text-[40px] font-semibold text-primary-text",children:s==null?void 0:s.name}),e.jsxs("div",{className:"relative overflow-hidden bg-white rounded-md w-full max-w-[400px] flex items-center max-md:mt-4",children:[e.jsx("div",{className:"border border-stroke flex-grow flex items-center py-3 px-5 rounded-md",children:e.jsx("input",{value:t,onChange:d=>o(d.target.value),onKeyDown:a,type:"text",className:"bg-transparent w-full h-6 text-base outline-none pr-10",placeholder:p})}),e.jsx("button",{className:"bg-primary absolute top-0 right-0 w-[50px] h-[50px] flex items-center justify-center",onClick:()=>n&&n(t),children:e.jsx(U,{className:"text-white w-4 h-4 cursor-pointer"})})]})]}),e.jsx("div",{className:"text-base font-normal text-secondary-text mb-10",children:s==null?void 0:s.description}),u&&e.jsx("div",{className:"mb-[40px]",children:e.jsx(ce,{productBanners:s.banners})})]})}const he=9,Qe=({data:s})=>{const{categoryId:r,categories:t}=s,o=t.find(m=>m.id.toString()===r);return o?[{title:o.name},{name:"description",content:o.description}]:[{title:"Catalog"},{name:"description",content:"Catalog"}]};function qe(){var F,R,T,A;const{t:s}=de(),{categorySlug:r}=$(),t=X(),[o,m]=v.useState("Type"),u=t.options.data,n=t.productResponse,p=n.total,g=Math.ceil(p/he),h=n.page,a=(F=t==null?void 0:t.categories)==null?void 0:F.find(c=>c.slug.toString()===r),d=(a==null?void 0:a.parentId.toString())!=="0",i=(R=t==null?void 0:t.categories)==null?void 0:R.find(c=>c.id.toString()===(a==null?void 0:a.parentId.toString())),S=t.categories.filter(c=>c.parentId.toString()===(a==null?void 0:a.id.toString()))||[],{Catalog_FAQ_Section:y,Catalog_CTA_Section:b}=t.result,l=y.faqs.map(c=>c.FAQ_id),[x,f]=k(),w=x.get("search")||"",N=x.get("options"),D=x.get("options")?(T=x.get("options")||"")==null?void 0:T.split(","):[],[H,P]=v.useState(D),[C,M]=v.useState(w),z=J(C,500),Q=E(),q=c=>{const j=new URLSearchParams;C&&j.set("search",C),N&&j.set("options",N),j.set("page",(c+1).toString()),f(j,{preventScrollReset:!0,replace:!0,relative:"path"})},K=()=>d?[{name:"Catalog",url:"/catalog"},{name:i==null?void 0:i.name,url:`/catalog/category/${i==null?void 0:i.slug}`},{name:a==null?void 0:a.name}]:[{name:"Catalog",url:"/catalog"},{name:a==null?void 0:a.name}],V=c=>{Q({pathname:"/catalog/result-search",search:c?`?search=${c}`:""},{replace:!0,relative:"path"})};return e.jsxs("div",{children:[e.jsxs("div",{className:"pb-[60px] lg:pb-[120px] pt-[100px]",children:[e.jsx(ne,{links:K()}),e.jsxs("div",{className:"container mx-auto",children:[e.jsx(ge,{c
1ategory:a,options:N,search:C,setSearch:M,debounceSearch:z,isBanner:!1,onPressSearch:V,placeholder:d?"Search products":"Press Enter to search for products"}),d&&e.jsxs(e.Fragment,{children:[e.jsx(me,{setSelectedOptions:P,options:u,types:t.categories}),e.jsxs("div",{className:"flex flex-col md:flex-row gap-[30px]",children:[e.jsxs("div",{className:"md:w-[300px] w-full",children:[e.jsxs("div",{className:"rounded-md flex items-center mb-3",children:[e.jsx("button",{className:I("flex-1 flex items-center justify-center py-3 border border-stroke rounded-l-md border-r-0",{"bg-primary text-white !border-primary":o==="Type"}),onClick:()=>m("Type"),children:"Type"}),e.jsx("button",{className:I("flex-1 flex items-center justify-center py-3 border border-stroke rounded-r-md",{"bg-primary text-white !border-primary":o==="Option"}),onClick:()=>m("Option"),children:"Style"})]}),o==="Type"?e.jsx(pe,{categories:t.categories}):e.jsx(Y,{selectedOptions:H,setSelectedOptions:P,options:u})]}),e.jsxs("div",{className:"flex-1",children:[t.products.length===0&&e.jsxs("div",{className:"flex w-full pt-40 flex-col items-center justify-center",children:[e.jsx(U,{className:"text-[#6B7280] w-16 h-16 mb-10"}),e.jsx(oe,{className:"text-center",children:s("not_found_catalog_title")}),e.jsx("div",{className:"text-secondary-text text-sm font-medium mt-4",children:s("not_found_catalog_description")})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-[30px]",children:(A=t==null?void 0:t.products)==null?void 0:A.map((c,j)=>e.jsx(W,{product:c},j))}),g>1&&e.jsx("div",{className:"mt-20",children:e.jsx(ie,{totalPage:g,pageIndex:Number(h),onChangePage:q})})]})]})]}),!d&&e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-[30px]",children:S.map(c=>e.jsx(G,{to:`/catalog/category/${c.slug}`,className:"flex flex-col space-y-4 ",children:e.jsxs("div",{className:"flex z-0 items-start justify-between relative space-x-4 pl-8 rounded-2xl h-[240px]  border border-stroke bg-[#F5F5F5] hover:shadow-2",children:[e.jsx("div",{className:"z-10 text-primary-text mt-7 text-[28px] md:text-3xl font-semibold",children:c.name}),e.jsx("div",{className:"absolute right-0 top-0 bottom-0",children:e.jsx("img",{src:c.avatarUrl,alt:"category avatar",className:"h-[240px] object-cover"})})]})},c.id.toString()))})]})]}),e.jsxs("div",{className:"bg-gray-100",children:[e.jsx("div",{className:"pt-[60px] lg:pt-[90px] pb-[30px] lg:pb-[60px]",children:e.jsx(re,{section_title:_(y.translations,"section_title"),faqs:l})}),e.jsx("div",{className:"pb-[60px] lg:pb-[90px]",children:e.jsx(ae,{section_title:_(b.translations,"section_title"),primary_button_label:_(b.translations,"button_label"),primary_button_link:_(b.translations,"button_link")})})]}),e.jsx(le,{page:"catalog_list"})]})}export{qe as default,Qe as meta};

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.