import{j as r,e as p,b as j,r as l,t as i,R as c,C as w,d as g}from"./index-9600e7d5.js";import{h}from"./handleErrorMessage-588dcd74.js";import{I}from"./index.es-b07989b8.js";import{s as b}from"./setWebPageTitle-364a3db0.js";import{L as x}from"./index-707c4d2f.js";function N({image:e,title:o}){return console.log("src: ",e),r.jsxs("div",{children:[r.jsx("h3",{className:"text-limit-1-line-left ",children:o}),r.jsx("div",{className:"news-card-container mt-10",children:r.jsx("img",{src:e,alt:o,onError:t=>{t.target.onerror===null&&(t.target.src=p)}})})]})}function P(){j();const[e,o]=l.useState([]),[t,d]=l.useState(null);b(i("award"));async function f(a,n){try{const s=await g.get("award",{params:{limit:a,page:n,status:!0}});s&&(o(s.data.data),d(s.data.meta.pagination))}catch(s){h(s)}}async function m(a,n){try{const s=await g.get("award",{params:{limit:a,page:n,status:!0}});s&&(o([...e,...s.data.data]),d(s.data.meta.pagination))}catch(s){h(s)}}return l.useEffect(()=>{f(10,1),window.scrollTo(0,0)},[]),r.jsx(c,{className:"w-100",children:r.jsx(w,{span:24,align:"middle",children:r.jsxs("div",{className:"layout-max-width",children:[r.jsx(c,{className:"w-100",children:r.jsx("h1",{className:"t-primary",children:"ពានរង្វាន់កិត្តិយស"})}),r.jsx(I,{dataLength:e.length,next:()=>m(10,(t==null?void 0:t.current)+1),hasMore:e.length<(t==null?void 0:t.total),loader:r.jsx(c,{justify:"center",children:i("loading-info")}),children:r.jsx(x,{className:"book-list",grid:{xs:1,sm:1,md:2,lg:2,xl:2,xxl:2},dataSource:e,renderItem:a=>{var n,s,u;return r.jsx(x.Item,{className:"pl-20 pr-20 pb-40",children:r.jsx(N,{image:(a==null?void 0:a.backgroundImageId)===null?p:((n=a==null?void 0:a.backgroundImageId)==null?void 0:n.pictureStatus)===!0?`https://spm-production.s3.ap-southeast-1.amazonaws.com/${(s=a==null?void 0:a.backgroundImageId)==null?void 0:s.thumnail}`:(u=a==null?void 0:a.backgroundImageId)==null?void 0:u.picture,title:a==null?void 0:a.title})})}})})]})})})}export{P as default};