PageSourceSearch

https://www.bagchee.com/static/js/6040.8d84439e.chunk.js

js bagchee.com collected 2026-10-02 11:18:02 UTC 4,973 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[6040],{6040(e,t,a){a.r(t),a.d(t,{default:()=>h});var r=a(5043),s=a(9722),o=a(5692),l=a(9463),c=a(8326),i=a(7874),n=a(579);const d=()=>(0,n.jsxs)("div",{className:"flex flex-col items-center animate-pulse",children:[(0,n.jsx)("div",{className:"w-28 h-28 md:w-32 md:h-32 lg:w-40 lg:h-40 rounded-full bg-gray-200 border-4 border-cream-200 shadow-sm"}),(0,n.jsx)("div",{className:"h-4 bg-gray-200 rounded w-24 mt-4"})]}),m=()=>{const[e,t]=(0,r.useState)([]),[a,m]=(0,r.useState)(!0),[h,x]=(0,r.useState)(1),[u,p]=(0,r.useState)(1),g=(0,r.useCallback)(e=>{var t;const a=e.image||e.categoryiconname;if(!a)return"https://placehold.co/300x300?text=No+Img";const r=(null===(t="https://www.bagchee.com/api")?void 0:t.replace("/api",""))||"http://localhost:3001";return a.startsWith("http")?a:"".concat(r).concat(a.startsWith("/")?"":"/").concat(a)},[]),b=(0,r.useCallback)(async function(){(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&m(!0);try{const e="https://www.bagchee.com/api",a=await s.A.get("".concat(e,"/category/fetch?page=").concat(h,"&limit=").concat(6));if(a.data.status){const e=Array.isArray(a.data.data)?a.data.data:[a.data.data];t(e);const r=a.data.total||0;p(Math.ceil(r/6))}}catch(e){console.error("Error fetching Categories:",e)}finally{m(!1)}},[h,6]);(0,r.useEffect)(()=>{b(!0);const e=setInterval(()=>{b(!1)},3e4),t=()=>b(!1);return window.addEventListener("focus",t),()=>{clearInterval(e),window.removeEventListener("focus",t)}},[b]);const f=(0,r.useCallback)(()=>{h<u&&x(e=>e+1)},[h,u]),y=(0,r.useCallback)(()=>{h>1&&x(e=>e-1)},[h]);return a||0!==e.length?(0,n.jsx)("section",{className:"py-10 md:py-16 bg-cream-50 border-b border-cream-200 font-body overflow-hidden",children:(0,n.jsxs)("div",{className:"w-full px-4 md:px-4 group/section",children:[(0,n.jsxs)("div",{className:"flex flex-col md:flex-row justify-between items-center md:items-end mb-8 md:mb-10 text-center md:text-left transition-all duration-500",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-secondary text-[10px] md:text-xs tracking-[0.2em] uppercase mb-1 block font-montserrat font-bold",children:"Collections"}),(0,n.jsx)("h2",{className:"text-2xl md:text-3xl font-display text-text-main tracking-tight uppercase",children:"Shop by Category"})]}),(0,n.jsxs)(i.N_,{to:"/allcategories",className:"hidden md:flex items-center gap-2 text-sm text-text-muted hover:text-primary transition-colors font-montserrat font-semibold",children:["View All Categories ",(0,n.jsx)(o.A,{size:16})]})]}),(0,n.jsxs)("div",{className:"relative px-2 md:px-4",children:[(0,n.jsx)("button",{onClick:y,disabled:1===h,className:"absolute top-1/2 -left-2 md:-left-4 -translate-y-1/2 w-8 h-8 md:w-10 md:h-10 bg-cream-100 border border-cream-200 rounded-full flex items-center justify-center text-text-muted shadow-lg z-10 transition-all duration-300 ".concat(1===h?"opacity-30 cursor-not-allowed scale-90":"hover:text-primary hover:border-primary hover:scale-110 active:scale-95"),"aria-label":"Previous categories",children:(0,n.jsx)(l.A,{size:20})}),(0,n.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-6 md:gap-8 min-h-[180px] md:min-h-[240px] transition-opacity duration-300 ".concat(a?"opacity-50":"opacity-100"),children:a?Array(6).fill(0).map((e,t)=>(0,n.jsx)(d,{},t)):e.map(e=>(0,n.jsx)("div",{className:"group cursor-pointer flex flex-col items-center text-center",children:(0,n.jsxs)(i.N_,{to:"/books/".concat(e.slug),className:"contents",children:[(0,n.jsxs)("div",{className:"relative w-28 h-28 md:w-32 md:h-32 lg:w-40 lg:h-40 rounded-full overflow-hidden border-4 border-cream-200 shadow-sm group-hover:border-secondary group-hover:shadow-2xl transition-all duration-500 transform group-hover:scale-105",style:{willChange:"transform, border-color"},children:[(0,n.jsx)("img",{src:g(e),alt:e.title||e.categorytitle,loading:"lazy",decoding:"async",className:"w-full h-full object-cover",onError:e=>{e.target.src="https://placehold.co/300x300?text=Error"}}),(0,n.jsx)("div",{className:"absolute inset-0 bg-secondary/10 opacity-0 group-hover:opacity-100 transition-opacity duration-300"})]}),(0,n.jsx)("h3",{className:"mt-3 md:mt-4 text-sm md:text-base font-bold text-text-main group-hover:text-primary transition-colors font-display tracking-wide uppercase",children:e.title||e.categorytitle})]})},e.id||e._id))}),(0,n.jsx)("button",{onClick:f,disabled:h>=u,className:"absolute top-1/2 -right-2 md:-right-4 -translate-y-1/2 w-8 h-8 md:w-10 md:h-10 bg-cream-100 border border-cream-200 rounded-full flex items-center justify-center text-text-muted shadow-lg z-10 transition-all duration-300 ".concat(h>
1=u?"opacity-30 cursor-not-allowed scale-90":"hover:text-primary hover:border-primary hover:scale-110 active:scale-95"),"aria-label":"Next categories",children:(0,n.jsx)(c.A,{size:20})})]})]})}):null},h=(0,r.memo)(m)}}]);
2//# sourceMappingURL=6040.8d84439e.chunk.js.map

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.