(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4735],{7239:function(e,t,s){Promise.resolve().then(s.bind(s,1962))},1962:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return u}});var a=s(7437),r=s(2265),l=s(8706),n=s(3145);let i=(0,s(7411).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);var d=s(2007),o=s(308);let c=["#2ECC40","#E8383D","#E60000","#FF6B35","#5B5EA6","#9B59B6"];function u(){let e=(0,l.T)(),[t,s]=(0,r.useState)([]),[u,h]=(0,r.useState)(1),[x,b]=(0,r.useState)([]),[f,g]=(0,r.useState)(!0),m=(0,r.useCallback)(e=>{g(!0),fetch("/api/discount?tabId=".concat(e)).then(e=>e.json()).then(e=>{if(e.success){var a;(null===(a=e.tabs)||void 0===a?void 0:a.length)&&0===t.length&&s(e.tabs),b(Array.isArray(e.data)?e.data:[])}}).finally(()=>g(!1))},[t.length]);return(0,r.useEffect)(()=>{m(u)},[u,m]),(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)("h1",{className:"text-xl font-bold text-gray-900 dark:text-white",children:e("discount_businesses",{defaultValue:"Biznese me Ulje"})}),t.length>0&&(0,a.jsx)("div",{className:"flex gap-3 overflow-x-auto pb-2 scrollbar-hide -mx-1 px-1",children:t.map((e,t)=>{var s,r;let l=u===e.id,d=e.name||e.title||e.label||e.description||"Tab ".concat(e.id),x=e.imageUrl||e.image||e.url||e.icon||"",b=null!==(r=null!==(s=e.businessesNo)&&void 0!==s?s:e.businessesCount)&&void 0!==r?r:e.count,f=e.backgroundColorHex||c[t%c.length];return(0,a.jsxs)("button",{onClick:()=>{var t;(t=e.id)!==u&&h(t)},className:"relative flex-shrink-0 w-[120px] rounded-2xl overflow-hidden transition-all duration-200 group ".concat(l?"ring-2 ring-baboon-500 ring-offset-2 ring-offset-white dark:ring-offset-[#121212] shadow-lg scale-[1.02]":"shadow-sm hover:shadow-md hover:scale-[1.01] border border-gray-200/80 dark:border-gray-700/80"),children:[l&&(0,a.jsx)("div",{className:"absolute top-2 right-2 z-10 w-[22px] h-[22px] rounded-full bg-white shadow-md flex items-center justify-center",children:(0,a.jsx)(i,{className:"w-3.5 h-3.5 text-baboon-500",strokeWidth:3})}),(0,a.jsx)("div",{className:"w-full h-[80px] relative overflow-hidden",style:{backgroundColor:f},children:x?(0,a.jsx)(n.default,{src:(0,o.QL)(x),alt:d,fill:!0,sizes:"120px",className:"object-cover"}):(0,a.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,a.jsx)("span",{className:"text-white text-3xl font-black drop-shadow-sm",children:d[0]})})}),(0,a.jsxs)("div",{className:"bg-white dark:bg-[#1e1e1e] px-2.5 py-2.5",children:[(0,a.jsx)("p",{className:"text-[13px] font-bold text-gray-900 dark:text-white truncate leading-tight",children:d}),null!=b&&(0,a.jsxs)("p",{className:"text-[11px] text-gray-500 dark:text-gray-400 mt-0.5",children:[b," biznese"]})]})]},e.id)})}),f?(0,a.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,a.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-baboon-500 border-t-transparent"})}):0===x.length?(0,a.jsx)("div",{className:"bg-white dark:bg-[#1e1e1e] rounded-2xl border border-gray-100 dark:border-gray-800 p-12 text-center",children:(0,a.jsx)("p",{className:"text-gray-500 dark:text-gray-400 font-medium",children:e("no_discounts",{defaultValue:"Nuk ka biznese me ulje per momentin."})})}):(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:x.map(e=>(0,a.jsx)(d.Z,{restaurant:e,fullWidth:!0},e.id))})]})}}},function(e){e.O(0,[8706,3557,2972,5878,6992,4448,2971,2117,1744],function(){return e(e.s=7239)}),_N_E=e.O()}]);