PageSourceSearch

https://promakod.uz/assets/AdminLayout-B8wCK4zC.js

js promakod.uz collected 2026-10-02 02:11:07 UTC 8,122 bytes, 1 lines download raw bytes

1import{r as n,j as e,f as $,u as G,L as b,O as H}from"./vendor-react-CnqPvWtE.js";import{C as U,Q as V,B as h,E as Y,T as K,U as W,V as J,J as P,W as Q,m as j,s as c,K as X,X as Z,Y as ee,Z as ae,$ as se}from"./index-4OJGohLf.js";import{L as S}from"./label-C0kCN5aw.js";import{af as re,ad as N,y as ne,ag as te,ah as ie,h as le,ai as oe,aj as de,B as ce,ak as he,al as me,am as ue,p as pe,n as xe,an as ge,G as fe,w as be,x as je,q as we}from"./vendor-icons-CD64bo--.js";import"./vendor-radix-DmpERO9M.js";import"./vendor-supabase-DwTFzKkW.js";import"./vendor-query-BHo95kTe.js";const ve=()=>{const[o,r]=n.useState(!1),[t,d]=n.useState(""),[m,u]=n.useState(""),[p,x]=n.useState(!1),g=async()=>{if(t.length<6){j.error("Parol kamida 6 ta belgidan iborat bo'lishi kerak");return}if(t!==m){j.error("Parollar mos kelmaydi");return}x(!0);try{const{error:s}=await c.auth.updateUser({password:t});if(s)throw s;j.success("Parol muvaffaqiyatli o'zgartirildi!"),r(!1),d(""),u("")}catch(s){j.error(s.message||"Parolni o'zgartirishda xatolik")}finally{x(!1)}};return e.jsxs(U,{open:o,onOpenChange:r,children:[e.jsx(V,{asChild:!0,children:e.jsxs(h,{variant:"ghost",size:"sm",className:"w-full justify-start gap-3 px-3 h-12 font-normal",children:[e.jsx(re,{className:"w-[18px] h-[18px]"}),"Parolni o'zgartirish"]})}),e.jsxs(Y,{className:"sm:max-w-[425px]",children:[e.jsxs(K,{children:[e.jsx(W,{children:"Parolni o'zgartirish"}),e.jsx(J,{children:"Yangi parolni kiriting"})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(S,{htmlFor:"new-password",children:"Yangi parol"}),e.jsx(P,{id:"new-password",type:"password",value:t,onChange:s=>d(s.target.value),placeholder:"Yangi parolni kiriting"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(S,{htmlFor:"confirm-password",children:"Parolni tasdiqlang"}),e.jsx(P,{id:"confirm-password",type:"password",value:m,onChange:s=>u(s.target.value),placeholder:"Parolni qayta kiriting"})]})]}),e.jsxs(Q,{children:[e.jsx(h,{variant:"outline",onClick:()=>r(!1),children:"Bekor qilish"}),e.jsx(h,{onClick:g,disabled:p,children:p?"O'zgartirilmoqda...":"O'zgartirish"})]})]})]})},D="partner-requests:changed",Ne=6e4,L="ai-finder:changed",Le=()=>{const o=$(),r=G(),{user:t,isAdmin:d,adminResolved:m,loading:u,signOut:p}=X(),[x,g]=n.useState(!1),s=!u&&m,w=s&&!!t&&d;n.useEffect(()=>{s&&!w&&o("/admin/login",{state:{from:r.pathname+r.search}})},[s,w,o,r.pathname,r.search]),n.useEffect(()=>{g(!1)},[r.pathname]);const[f,A]=n.useState(0),[T,q]=n.useState(0),y=s&&d?t?.id??null:null;n.useEffect(()=>{if(!y)return;let a=!1;const i=async()=>{const{count:M,error:F}=await c.from("partner_requests").select("id",{count:"exact",head:!0}).eq("status","new");!a&&!F&&A(M??0);const E=await c.from("promo_candidates").select("id",{count:"exact",head:!0}).eq("status","pending");!a&&!E.error&&q(E.count??0)};let v;const l=()=>{clearTimeout(v),v=setTimeout(i,500)};i();const I=setInterval(()=>{document.visibilityState==="visible"&&i()},Ne),C=()=>{document.visibilityState==="visible"&&l()};document.addEventListener("visibilitychange",C),window.addEventListener(D,l),window.addEventListener(L,l);const R=c.channel(`admin-partner-badge-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`).on("postgres_changes",{event:"*",schema:"public",table:"partner_requests"},l).subscribe();return()=>{a=!0,clearTimeout(v),clearInterval(I),document.removeEventListener("visibilitychange",C),window.removeEventListener(D,l),window.removeEventListener(L,l),c.removeChannel(R)}},[y]);const B=async()=>{await p(),o("/")};if(!s)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:e.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent rounded-full"})});if(!w)return null;const O=[{path:"/admin",label:"Dashboard",icon:te},{path:"/admin/banners",label:"Bannerlar",icon:ie},{path:"/admin/brands",label:"Brendlar",icon:le},{path:"/admin/categories",label:"Kategoriyalar",icon:oe},{path:"/admin/promo-codes",label:"Promokodlar",icon:de},{path:"/admin/ai-finder",label:"AI topuvchi",icon:ce,badge:T},{path:"/admin/users",label:"Foydalanuvchilar",icon:he},{path:"/admin/partner-requests",label:"Hamkorlik",icon:me,badge:f},{path:"/admin/blog",label:"Blog",icon:ue},{path:"/admin/daromad",label:"Daromad",icon:pe},{path:"/admin/notifications",label:"Bildirishnomalar",icon:xe},{path:"/admin/app-stats",label:"Ilova statistikasi",icon:ge},{path:"/admin/gift-cards",label:"Gift kartalar",icon:fe},{path:"/admin/settings",label:"Sozlamalar",icon:be}],z=a=>a==="/admin"?r.pathname==="/admin":r.pathname.startsWith(a),_=a=>{const i=z(a.path);return e.jsxs(b,{to:a.path,className:`flex items-center gap-3 px-3 py-3.5 rounded-lg text-sm transition-colors ${i?"bg-primary text-primary-foreground font-medium":"text-muted-foreground hover:bg-secondary hover:text-foreground"}`,children:[e.jsx(a.icon,{className:"w-[18px] h-[18px] flex-shrink-0"}),e.jsx("span",{className:"truncate",children:a.label}),a.badge?e.jsxs("span",{className:`ml-auto min-w-[20px] h-5 px-1.5 rounded-full text-[11px] font-semibold leading-5 text-center tabular-nums flex-shrink-0 ${i?"bg-primary-foreground text-primary":"bg-primary text-primary-foreground"}`,children:[e.jsx("span",{"aria-hidden":"true",children:a.badge>99?"99+":a.badge}),e.jsxs("span",{className:"sr-only",children:[a.badge," ta yangi"]})]}):null,i&&e.jsx(we,{className:`w-4 h-4 flex-shrink-0 ${a.badge?"":"ml-auto"}`})]},a.path)},k=()=>e.jsxs(e.Fragment,{children:[e.jsx("nav",{className:"flex-1 p-3 space-y-0.5 overflow-y-auto",children:O.map(_)}),e.jsxs("div",{className:"mt-auto p-3 space-y-0.5",children:[e.jsx(ve,{}),e.jsxs(h,{variant:"ghost",size:"sm",className:"w-full justify-start gap-3 px-3 font-normal",onClick:B,children:[e.jsx(je,{className:"w-[18px] h-[18px]"}),"Chiqish"]})]})]});return e.jsxs("div",{className:"admin-shell min-h-screen bg-background flex",children:[e.jsxs("aside",{className:"hidden md:flex w-64 bg-transparent flex-col h-screen sticky top-0",children:[e.jsx("div",{className:"px-5 pt-6 pb-4",children:e.jsxs(b,{to:"/",className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl gradient-hero flex items-center justify-center shadow-glow",children:e.jsx(N,{className:"w-5 h-5 text-primary-foreground"})}),e.jsx("span",{className:"text-xl font-bold text-foreground",children:"Admin"})]})}),e.jsx(k,{})]}),e.jsx("div",{className:"md:hidden fixed top-0 left-0 right-0 z-50 bg-card border-b border-border",children:e.jsxs("div",{className:"flex h-16 items-center justify-between px-4",children:[e.jsxs(b,{to:"/",className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg gradient-hero flex items-center justify-center shadow-glow",children:e.jsx(N,{className:"w-4 h-4 text-primary-foreground"})}),e.jsx("span",{className:"text-lg font-bold text-foreground",children:"Admin"})]}),e.jsxs(Z,{open:x,onOpenChange:g,children:[e.jsx(ee,{asChild:!0,children:e.jsxs(h,{variant:"ghost",size:"icon",className:"relative","aria-label":f>0?`Menyu — ${f} ta yangi hamkorlik arizasi`:"Menyu",children:[e.jsx(ne,{className:"w-5 h-5"}),f>0&&e.jsx("span",{className:"absolute top-1.5 right-1.5 w-2 h-2 rounded-full bg-primary"})]})}),e.jsxs(ae,{side:"left",className:"w-72 p-0",children:[e.jsx("div",{className:"p-6 border-b border-border",children:e.jsxs(b,{to:"/",className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl gradient-hero flex items-center justify-center shadow-glow",children:e.jsx(N,{className:"w-5 h-5 text-primary-foreground"})}),e.jsx("span",{className:"text-xl font-bold text-foreground",children:"Admin"})]})}),e.jsx(k,{})]})]})]})}),e.jsx("main",{className:"flex-1 min-w-0 pt-[65px] md:pt-0",children:e.jsx(se,{children:e.jsx(n.Suspense,{fallback:e.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:e.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-primary border-t-transparent roun
1ded-full"})}),children:e.jsx(H,{})})},r.pathname)})]})};export{Le 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.