1import{f as R,ab as S,r as m,t as h,q as u,j as e,N as k,L as j,_ as A,w as g,ai as L,B as x,F as D,x as E,Y as y,k as M,M as C,X as I,aD as P,am as $}from"./index-cscxoOf9.js";import{B as z}from"./badge-Dj3athcC.js";import{C as T}from"./circle-x-DHp6YeSD.js";import{R as F}from"./refresh-cw-D0KbhpJJ.js";import{S as U}from"./send-DI6AmIeV.js";function q({value:t,onChange:a}){const[c,o]=m.useState(0);return e.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(r=>e.jsx("button",{type:"button",onMouseEnter:()=>o(r),onMouseLeave:()=>o(0),onClick:()=>a(r),className:"focus:outline-none",children:e.jsx(g,{className:`w-6 h-6 transition-colors ${r<=(c||t)?"text-[#C28B2C] fill-[#C28B2C]":"text-white/20 hover:text-[#C28B2C]/50"}`})},r))})}function O({rating:t}){return e.jsx("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(a=>e.jsx(g,{className:`w-3.5 h-3.5 ${a<=t?"text-[#C28B2C] fill-[#C28B2C]":"text-white/20"}`},a))})}const X={pending:{label:"In attesa",icon:y,badge:"bg-[#C28B2C]/20 text-[#C28B2C] border-[#C28B2C]/30",border:"border-[#C28B2C]/15",description:"La tua recensione è in attesa di verifica da parte del nostro team."},approved:{label:"Approvata",icon:E,badge:"bg-[#3D8B5A]/20 text-[#6DBF8A] border-green-500/30",border:"border-[#3D8B5A]/10",description:"La tua recensione è visibile sul profilo."},rejected:{label:"Rifiutata",icon:T,badge:"bg-red-500/20 text-red-400 border-red-500/30",border:"border-red-500/20",description:"La tua recensione non è stata approvata. Puoi modificarla e reinviarla."}};
1function _({review:t,onDelete:a,onUpdated:c}){const[o,r]=m.useState(!1),[f,p]=m.useState(t.rating),[n,i]=m.useState(t.text??""),b=h.useUtils(),s=h.reviews.update.useMutation({onSuccess:()=>{u.success("Recensione reinviata! Sarà visibile dopo la moderazione.",{duration:5e3}),r(!1),b.reviews.getMyReviews.invalidate(),c()},onError:N=>u.error(N.message)}),l=t.status??"pending",d=X[l],v=d.icon,w=l==="rejected",B=()=>{if(n.trim().length<10){u.error("La recensione deve essere di almeno 10 caratteri");return}s.mutate({reviewId:t.id,rating:f,text:n})};return e.jsxs("div",{className:`bg-[#111118] border rounded-2xl p-5 transition-all ${d.border}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[t.escortProfileId?e.jsxs(j,{href:M({id:t.escortProfileId}),className:"inline-flex items-center gap-1.5 text-sm font-['Nunito'] font-bold text-white hover:text-[#07793e] transition-colors mb-1",children:[e.jsx(C,{className:"w-3.5 h-3.5 text-[#07793e] shrink-0"}),t.escortDisplayName||`Profilo #${t.escortProfileId}`,t.escortCity&&e.jsxs("span",{className:"text-white/40 font-normal font-['Nunito']",children:["· ",t.escortCity]})]}):t.mockEscortId?e.jsxs("div",{className:"inline-flex items-center gap-1.5 text-sm font-['Nunito'] font-semibold text-white/60 mb-1",children:[e.jsx(C,{className:"w-3.5 h-3.5 text-white/30 shrink-0"}),t.mockEscortId]}):e.jsx("div",{className:"text-sm text-white/40 font-['Nunito'] mb-1",children:"Escort non specificata"}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-white/30 font-['Nunito']",children:[e.jsx(y,{className:"w-3 h-3"}),new Date(t.createdAt).toLocaleDateString("it-IT",{day:"2-digit",month:"long",year:"numeric"}),t.updatedAt&&t.updatedAt!==t.createdAt&&e.jsxs("span",{className:"text-white/20",children:["· modificata ",new Date(t.updatedAt).toLocaleDateString("it-IT")]})]})]}),e.jsxs(z,{className:`text-[10px] px-2.5 py-1 border font-['Nunito'] font-bold shrink-0 ${d.badge}`,children:[e.jsx(v,{className:"w-3 h-3 mr-1"}),d.label.toUpperCase()]})]}),e.jsxs("div",{className:`flex items-start gap-2 rounded-xl px-3 py-2 mb-3 text-xs font-['Nunito'] ${l==="rejected"?"bg-red-500/8 text-red-400/80":l==="pending"?"bg-[#C28B2C]/8 text-[#C28B2C]/70":"bg-[#3D8B5A]/8 text-[#6DBF8A]/70"}`,children:[e.jsx(v,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),e.jsx("span",{children:d.description})]}),!o&&e.jsxs(e.Fragment,{children:[e.jsx(O,{rating:t.rating}),e.jsx("p",{className:"text-sm text-white/60 font-['Nunito'] leading-relaxed mt-2",children:t.text})]}),o&&w&&e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-white/40 font-['Nunito'] mb-2",children:"Modifica la valutazione:"}),e.jsx(q,{value:f,onChange:p})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-white/40 font-['Nunito'] mb-2",children:"Modifica il testo:"}),e.jsx("textarea",{value:n,onChange:N=>i(N.target.value),rows:4,className:"w-full bg-white/5 border border-white/10 rounded-xl p-4 text-white/80 placeholder:text-white/30 font-['Nunito'] text-sm resize-none focus:outline-none focus:border-[#07793e]/50",placeholder:"Riscrivi la tua recensione (min. 10 caratteri)..."}),e.jsxs("p",{className:"text-xs text-white/30 font-['Nunito'] mt-1",children:[n.length,"/2000 caratteri"]})]}),e.jsxs("div",{className:"flex items-center gap-2 bg-[#C28B2C]/8 border border-[#C28B2C]/15 rounded-xl px-3 py-2 text-xs text-[#C28B2C]/70 font-['Nunito']",children:[e.jsx("span",{className:"shrink-0",children:"â¹ï¸"}),e.jsx("span",{children:"La recensione modificata tornerà in attesa di moderazione prima di essere pubblicata."})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(x,{onClick:B,disabled:s.isPending||n.trim().length<10,className:"bg-gradient-to-r from-[#07793e] to-[#246068] text-white border-0 font-['Nunito'] font-bold rounded-xl text-sm h-9 px-4",children:[s.isPending?e.jsx(F,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):e.jsx(U,{className:"w-3.5 h-3.5 mr-1.5"}),"Reinvia per moderazione"]}),e.jsxs(x,{onClick:()=>{r(!1),p(t.rating),i(t.text??"")},variant:"ghost",className:"text-white/40 hover:text-white/70 font-['Nunito'] font-semibold text-sm h-9 px-3",children:[e.jsx(I,{className:"w-3.5 h-3.5 mr-1"}),"Annulla"]})]})]}),!o&&e.jsxs("div",{className:"flex gap-2 mt-4 pt-3 border-t border-white/5",children:[w&&e.jsxs(x,{onClick:()=>r(!0),size:"sm",className:"h-8 px-3 bg-[#07793e]/15 hover:bg-[#07793e]/25 text-[#07793e] border border-[#07793e]/20 rounded-lg font-['Nunito'] font-semibold text-xs",children:[e.jsx(P,{className:"w-3.5 h-3.5 mr-1.5"}),"Modifica e reinvia"]}),e.jsxs(x,{onClick:()=>
1{confirm("Eliminare definitivamente questa recensione?")&&a(t.id)},variant:"ghost",size:"sm",className:"h-8 px-3 text-red-400/50 hover:text-red-400 hover:bg-red-500/10 rounded-lg font-['Nunito'] font-semibold text-xs ml-auto",children:[e.jsx($,{className:"w-3.5 h-3.5 mr-1"}),"Elimina"]})]})]})}function J(){const{loading:t}=R({redirectOnUnauthenticated:!0,redirectPath:S("/le-mie-recensioni")}),[a,c]=m.useState("all"),o=h.useUtils(),{data:r=[],isLoading:f}=h.reviews.getMyReviews.useQuery(),p=h.reviews.delete.useMutation({onSuccess:()=>{u.success("Recensione eliminata"),o.reviews.getMyReviews.invalidate()},onError:s=>u.error(s.message)}),n=r,i={all:n.length,pending:n.filter(s=>s.status==="pending").length,approved:n.filter(s=>s.status==="approved").length,rejected:n.filter(s=>s.status==="rejected").length},b=a==="all"?n:n.filter(s=>s.status===a);return t?e.jsx("div",{className:"min-h-screen bg-[#0a0a14] flex items-center justify-center pb-nav",children:e.jsx("div",{className:"w-10 h-10 border-2 border-[#07793e]/30 border-t-[#07793e] rounded-full animate-spin"})}):e.jsxs("div",{className:"min-h-screen bg-[#0a0a14] flex flex-col pt-[94px]",children:[e.jsx(k,{}),e.jsxs("main",{className:"flex-1 container py-10 max-w-3xl mx-auto",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[e.jsxs(j,{href:"/dashboard",className:"flex items-center gap-1.5 text-sm text-white/40 hover:text-white/70 font-['Nunito'] transition-colors",children:[e.jsx(A,{className:"w-4 h-4"}),"Dashboard"]}),e.jsx("span",{className:"text-white/20",children:"/"}),e.jsx("span",{className:"text-sm text-white/60 font-['Nunito']",children:"Le mie recensioni"})]}),e.jsxs("div",{className:"mb-8",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#07793e]/15 flex items-center justify-center",children:e.jsx(g,{className:"w-5 h-5 text-[#07793e]"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"font-['Nunito'] font-extrabold text-2xl text-white",children:"Le mie recensioni"}),e.jsx("p",{className:"text-sm text-white/40 font-['Nunito']",children:i.all===0?"Non hai ancora scritto recensioni":`${i.all} recension${i.all===1?"e":"i"} totali`})]})]}),i.rejected>0&&e.jsxs("div",{className:"flex items-start gap-3 bg-red-500/10 border border-red-500/20 rounded-2xl px-5 py-3 mt-4",children:[e.jsx(L,{className:"w-5 h-5 text-red-400 shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm font-['Nunito'] font-bold text-red-300",children:[i.rejected," recension",i.rejected===1?"e rifiutata":"i rifiutate"]}),e.jsx("p",{className:"text-xs text-red-400/60 font-['Nunito'] mt-0.5",children:"Puoi modificarle e reinviarle per una nuova valutazione da parte del team."})]})]})]}),i.all>0&&e.jsx("div",{className:"flex gap-1 bg-[#111118] border border-white/8 rounded-2xl p-1 mb-6 overflow-x-auto",children:[{key:"all",label:"Tutte",count:i.all},{key:"pending",label:"In attesa",count:i.pending},{key:"approved",label:"Approvate",count:i.approved},{key:"rejected",label:"Rifiutate",count:i.rejected}].map(({key:s,label:l,count:d})=>e.jsxs("button",{onClick:()=>c(s),className:`flex items-center gap-2 px-4 py-2.5 rounded-xl font-['Nunito'] font-semibold text-sm transition-all whitespace-nowrap flex-1 justify-center 2 ${a===s?"bg-gradient-to-r from-[#07793e] to-[#246068] text-white shadow-lg":"text-white/40 hover:text-white/70"}`,children:[l,d>0&&e.jsx("span",{className:`min-w-[20px] h-5 px-1.5 rounded-full text-[10px] font-bold flex items-center justify-center 3 ${a===s?"bg-[#0f1117]/20 text-white":s==="rejected"?"bg-red-500/20 text-red-400":s==="pending"?"bg-[#C28B2C]/20 text-[#C28B2C]":"bg-[#0f1117]/10 text-white/50"}`,children:d})]},s))}),f?e.jsx("div",{className:"flex justify-center py-16",children:e.jsx("div",{className:"w-10 h-10 border-2 border-[#07793e]/30 border-t-[#07793e] rounded-full animate-spin"})}):b.length===0?e.jsxs("div",{className:"text-center py-16",children:[e.jsx(g,{className:"w-16 h-16 text-white/8 mx-auto mb-4"}),a==="all"?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"font-['Nunito'] font-bold text-white/40 text-lg mb-2",children:"Non hai ancora scritto recensioni"}),e.jsx("p",{className:"text-sm text-white/30 font-['Nunito'] mb-6",children:"Visita il profilo di un'escort e condividi la tua esperienza."}),e.jsx(j,{href:"/escort/roma",children:e.jsx(x,{className:"bg-gradient-to-r from-[#07793e] to-[#246068] text-white border-0 font-['Nunito'] font-bold rounded-xl",children:"Sfoglia i profili"})})]}):e.jsxs("p",{className:"font-['Nunito'] font-bold text-white/40 text-lg",children:["Nessuna recensione ",a==="pending"?"in attesa":a==="approved"?"approvata":"rifiutata"]})]}):e.jsx("div",{className:"space-y-4",children:b.map(s=>e.jsx(_,{review:s,onDelete:l=>p.mutate({reviewId:l}),onUpdated:()=>o.reviews.getMyReviews.invalidate()},s.id))})]}),e.jsx(D,{})]})}
3export{J 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.