1import{r as v,m as L,j as e,C as j,I as E,B as u,a1 as w,a2 as y,ai as A,aK as I,U as P,V as D,aL as q,X as B,s as k}from"./index-Cbf19BJ2.js";import{A as F}from"./AdminLayout-BO09t3h9.js";import{C as b,c as C}from"./card-DgudV2Qs.js";import{S as H}from"./search-BLo06ZQ6.js";import"./wallet-DiTxM8js.js";import"./list-D4zz6wAQ.js";import"./plus-BhsMqakM.js";import"./users-Xzu6q5UA.js";import"./zap-bic735yl.js";import"./shopping-cart-J9DiLkwU.js";import"./package-C0aFhqOE.js";import"./circle-dot-BggEKS0Q.js";import"./truck-CiBM9Qd9.js";import"./mic-B7DTX7IA.js";import"./eye-Bp1ggn78.js";import"./upload-C7UHHK-4.js";import"./code-cui-3nIF.js";import"./file-code-Dc3Knbwk.js";import"./refresh-cw-jn-MXuPZ.js";import"./shield-CfgkgLd3.js";import"./credit-card-u85TQkWj.js";import"./globe-CgQQH_HA.js";import"./ticket-G16NpKMh.js";const N=50;function me(){const[o,_]=v.useState(""),[t,m]=v.useState(1),{data:d,isLoading:z}=L({queryKey:["admin-film-tips"],queryFn:async()=>{const{data:s,error:a}=await k.from("oz1_film_tips").select("*").order("datum",{ascending:!1});if(a)throw a;const c=s||[],l=[...new Set(c.map(r=>r.user_id).filter(r=>r>0))];let n={};if(l.length>0)for(let r=0;r<l.length;r+=100){const x=l.slice(r,r+100),{data:h}=await k.from("oz1_users").select("id, nickname, email").in("id",x);(h||[]).forEach(f=>{n[f.id]={nickname:f.nickname,email:f.email}})}return c.map(r=>{var x,h;return{...r,nickname:((x=n[r.user_id])==null?void 0:x.nickname)||null,email:((h=n[r.user_id])==null?void 0:h.email)||null}})}}),p=(d||[]).filter(s=>{var c,l,n;if(!o)return!0;const a=o.toLowerCase();return((c=s.tip_obsah)==null?void 0:c.toLowerCase().includes(a))||((l=s.nickname)==null?void 0:l.toLowerCase().includes(a))||((n=s.email)==null?void 0:n.toLowerCase().includes(a))||String(s.user_id).includes(a)}),i=Math.ceil(p.length/N),g=p.slice((t-1)*N,t*N),S=s=>{const a=s.match(/https?:\/\/[^\s]+/);return a?a[0]:null};return e.jsx(F,{title:"Tipy na filmy",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(j,{variant:"secondary",className:"text-sm",children:["Celkem tipů: ",(d==null?void 0:d.length)??"â¦"]}),o&&e.jsxs(j,{variant:"outline",className:"text-sm",children:["Nalezeno: ",p.length]})]}),e.jsxs("div",{className:"relative w-full sm:w-80",children:[e.jsx(H,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(E,{placeholder:"Hledat v tipech, uživatelÃchâ¦",value:o,onChange:s=>{_(s.target.value),m(1)},className:"pl-9"})]})]}),i>1&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:["Stránka ",t," z ",i]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(u,{size:"sm",variant:"outline",disabled:t<=1,onClick:()=>m(t-1),children:[e.jsx(w,{className:"w-4 h-4 mr-1"})," PÅedchozÃ"]}),e.jsxs(u,{size:"sm",variant:"outline",disabled:t>=i,onClick:()=>m(t+1),children:["Dalšà ",e.jsx(y,{className:"w-4 h-4 ml-1"})]})]})]}),z?e.jsx("div",{className:"space-y-3",children:[...Array(10)].map((s,a)=>e.jsx(A,{className:"h-20 w-full"},a))}):g.length===0?e.jsx(b,{children:e.jsx(C,{className:"py-12 text-center text-muted-foreground",children:"Žádné tipy nebyly nalezeny."})}):e.jsx("div",{className:"space-y-2",children:g.map(s=>{const a=S(s.tip_obsah);return e.jsx(b,{className:"hover:shadow-sm transition-shadow",children:e.jsx(C,{className:"py-3 px-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-1 p-1.5 rounded bg-muted",children:e.jsx(I,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm break-all",children:s.tip_obsah}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 mt-1.5 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(P,{className:"w-3 h-3"}),s.nickname||s.email||`ID ${s.user_id}`]}),s.datum&&e.jsx("span",{children:D(new Date(s.datum),"d. M. yyyy HH:mm",{locale:B})}),a&&e.jsxs("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-blue-600 hover:underline",children:[e.jsx(q,{className:"w-3 h-3"}),"OtevÅÃt odkaz"]})]})]}),e.jsxs(j,{variant:"outline",className:"text-xs shrink-0",children:["#",s.tip_id]})]})})},s.tip_id)})}),i>1&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:["Stránka ",t," z ",i]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(u,{size:"sm",variant:"outline",disabled:t<=1,onClick:()=>m(t-1),children:[e.jsx(w,{className:"w-4 h-4 mr-1"})," PÅedchozÃ"]}),e.jsxs(u,{size:"sm",variant:"outline",disabled:t>=i,onClick:()=>m(t+1),children:["Dalšà ",e.jsx(y,{className:"w-4 h-4 ml-1"})]})]})]})]})})}export{me 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.