PageSourceSearch

https://escortadvisor-b4fe68rl.manus.space/assets/DashboardStories-D9_rcPLn.js

js escortadvisor-b4fe68rl.manus.space collected 2026-10-03 05:02:42 UTC 8,988 bytes, 1 lines download raw bytes

1import{f as G,r as l,t as n,q as d,j as e,N as S,F as C,az as Q,aU as J,X as O,ax as W,B as X,Y as A,a8 as k,am as M}from"./index-cscxoOf9.js";import{U as Y}from"./upload-DGDK-lZy.js";import{I as T}from"./image-L1fPJnCE.js";import{V as _}from"./video-DWi6Vwbm.js";function B(s){const a=new Date(s).getTime()-Date.now();if(a<=0)return"Scaduta";const o=Math.floor(a/36e5),c=Math.floor(a%36e5/6e4);return o>0?`${o}h ${c}m`:`${c}m`}function te(){const{user:s,isAuthenticated:a}=G(),[o,c]=l.useState(""),[m,x]=l.useState(null),[b,P]=l.useState("image"),[z,U]=l.useState("image/jpeg"),[u,h]=l.useState(null),[N,j]=l.useState(!1),v=l.useRef(null),r=n.useUtils(),{data:p,isLoading:F}=n.stories.getMine.useQuery(void 0,{enabled:a}),{data:f}=n.stories.getAll.useQuery(void 0,{enabled:a&&(s?.role==="admin"||s?.role==="superadmin")}),D=n.stories.create.useMutation({onSuccess:()=>{d.success("Story pubblicata! Sarà visibile per 24 ore."),x(null),h(null),c(""),r.stories.getMine.invalidate(),r.stories.getActive.invalidate()},onError:t=>d.error(t.message||"Errore durante il caricamento")}),L=n.stories.delete.useMutation({onSuccess:()=>{d.success("Story eliminata"),r.stories.getMine.invalidate(),r.stories.getActive.invalidate()}}),R=n.stories.adminDelete.useMutation({onSuccess:()=>{d.success("Story eliminata dall'admin"),r.stories.getAll.invalidate(),r.stories.getActive.invalidate()}}),E=t=>{const i=t.target.files?.[0];if(!i)return;if(i.size>20*1024*1024){d.error("File troppo grande (max 20MB)");return}const $=i.type.startsWith("video/");P($?"video":"image"),U(i.type);const w=new FileReader;w.onload=q=>{const y=q.target?.result,I=y.split(",")[1];h(I),x(y)},w.readAsDataURL(i)},V=async()=>{if(u){j(!0);try{await D.mutateAsync({mediaBase64:u,mediaType:b,mimeType:z,caption:o.trim()||void 0})}finally{j(!1)}}},g=s?.role==="escort"||s?.role==="admin"||s?.role==="superadmin";return a?e.jsxs("div",{className:"min-h-screen bg-[#0a0a14] pb-nav",children:[e.jsx(S,{}),e.jsxs("div",{className:"container py-24 max-w-4xl",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"font-['Nunito'] font-bold text-3xl text-white mb-2",children:"Le mie Stories"}),e.jsx("p",{className:"text-white/50 font-['Nunito']",children:"Pubblica foto e video visibili per 24 ore nella homepage"})]}),!g&&e.jsxs("div",{className:"flex items-start gap-3 bg-[#C28B2C]/10 border border-[#C28B2C]/20 rounded-2xl p-4 mb-8",children:[e.jsx(Q,{className:"w-5 h-5 text-[#C28B2C] mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[#C28B2C] font-['Nunito'] font-semibold text-sm",children:"Accesso riservato"}),e.jsx("p",{className:"text-[#C28B2C]/70 font-['Nunito'] text-sm mt-1",children:"Solo le inserzioniste registrate e gli amministratori possono pubblicare stories. Registra il tuo profilo escort per accedere a questa funzione."})]})]}),g&&e.jsxs("div",{className:"bg-[#111118] border border-white/10 rounded-3xl p-6 mb-8",children:[e.jsxs("h2",{className:"font-['Nunito'] font-semibold text-white mb-4 flex items-center gap-2",children:[e.jsx(J,{className:"w-4 h-4 text-[#07793e]"}),"Nuova Story"]}),m?e.jsxs("div",{className:"relative rounded-2xl overflow-hidden mb-4 max-h-80",children:[b==="video"?e.jsx("video",{src:m,className:"w-full max-h-80 object-contain bg-black",controls:!0}):e.jsx("img",{src:m,alt:"Preview",className:"w-full max-h-80 object-contain bg-black",loading:"lazy",decoding:"async"}),e.jsx("button",{className:"absolute top-2 right-2 w-8 h-8 rounded-full bg-black/60 flex items-center justify-center text-white hover:bg-black/80",onClick:()=>{x(null),h(null)},children:e.jsx(O,{className:"w-4 h-4"})})]}):e.jsxs("button",{className:"w-full h-48 border-2 border-dashed border-white/20 hover:border-[#07793e]/50 rounded-2xl flex flex-col items-center justify-center gap-3 transition-colors group",onClick:()=>v.current?.click(),children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-[#0f1117]/5 group-hover:bg-[#07793e]/10 flex items-center justify-center transition-colors",children:e.jsx(Y,{className:"w-6 h-6 text-white/30 group-hover:text-[#07793e] transition-colors"})}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-white/60 font-['Nunito'] font-semibold text-sm",children:"Carica foto o video"}),e.jsx("p",{className:"text-white/30 font-['Nunito'] text-xs mt-1",children:"JPG, PNG, MP4, MOV · max 20MB"})]}),e.jsxs("div",{className:"flex gap-3 text-white/20",children:[e.jsx(T,{className:"w-4 h-4"}),e.jsx(_,{className:"w-4 h-4"})]})]}),e.jsx("input",{ref:v,type:"file",accept:"image/*,video/*",className:"hidden",onChange:E}),e.jsxs("div",{className:"mt-4",children:[e.jsx(W,{placeholder:"Aggiungi una didascali
1a (opzionale)...",value:o,onChange:t=>c(t.target.value),maxLength:300,className:"bg-[#0f1117]/5 border-white/10 text-white placeholder:text-white/30 font-['Nunito'] resize-none",rows:2}),e.jsxs("p",{className:"text-xs text-white/30 text-right mt-1 font-['Nunito']",children:[o.length,"/300"]})]}),e.jsx(X,{className:"mt-4 w-full bg-gradient-to-r from-[#07793e] to-[#246068] hover:from-[#A84A80] hover:to-[#2F7F88] text-white font-['Nunito'] font-bold h-12 rounded-xl",disabled:!u||N,onClick:V,children:N?"Caricamento...":"Pubblica Story (24h)"})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-['Nunito'] font-semibold text-white mb-4",children:s?.role==="admin"||s?.role==="superadmin"?"Tutte le Stories":"Le tue Stories"}),F?e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:[...Array(3)].map((t,i)=>e.jsx("div",{className:"aspect-[9/16] bg-[#0f1117]/5 rounded-2xl animate-pulse"},i))}):e.jsx(e.Fragment,{children:(s?.role==="admin"||s?.role==="superadmin")&&f&&f.length>0?e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:f.map(t=>e.jsxs("div",{className:"relative rounded-2xl overflow-hidden bg-[#111118] border border-white/10 group",children:[e.jsx("div",{className:"aspect-[9/16]",children:t.mediaType==="video"?e.jsx("video",{src:t.mediaUrl,className:"w-full h-full object-cover"}):e.jsx("img",{src:t.mediaUrl,alt:t.caption?t.caption:`Story di ${t.authorName}`,className:"w-full h-full object-cover",loading:"lazy",decoding:"async"})}),e.jsxs("div",{className:"absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/80 to-transparent p-3",children:[e.jsx("p",{className:"text-white text-xs font-['Nunito'] font-semibold",children:t.authorName}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(A,{className:"w-3 h-3 text-white/50"}),e.jsx("span",{className:"text-white/50 text-xs font-['Nunito']",children:B(t.expiresAt)}),e.jsx(k,{className:"w-3 h-3 text-white/50 ml-1"}),e.jsx("span",{className:"text-white/50 text-xs font-['Nunito']",children:t.viewCount??0})]})]}),e.jsx("button",{className:"absolute top-2 right-2 w-7 h-7 rounded-full bg-black/60 flex items-center justify-center text-white opacity-0 group-hover:opacity-100 transition-opacity hover:bg-red-500/80",onClick:()=>R.mutate({id:t.id}),children:e.jsx(M,{className:"w-3.5 h-3.5"})})]},t.id))}):p&&p.length>0?e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:p.map(t=>e.jsxs("div",{className:"relative rounded-2xl overflow-hidden bg-[#111118] border border-white/10 group",children:[e.jsx("div",{className:"aspect-[9/16]",children:t.mediaType==="video"?e.jsx("video",{src:t.mediaUrl,className:"w-full h-full object-cover"}):e.jsx("img",{src:t.mediaUrl,alt:t.caption?t.caption:"Story fotografica",className:"w-full h-full object-cover",loading:"lazy",decoding:"async"})}),e.jsxs("div",{className:"absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/80 to-transparent p-3",children:[t.caption&&e.jsx("p",{className:"text-white text-xs font-['Nunito'] mb-1 line-clamp-2",children:t.caption}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(A,{className:"w-3 h-3 text-white/50"}),e.jsx("span",{className:"text-white/50 text-xs font-['Nunito']",children:B(t.expiresAt)}),e.jsx(k,{className:"w-3 h-3 text-white/50 ml-1"}),e.jsx("span",{className:"text-white/50 text-xs font-['Nunito']",children:t.viewCount??0})]})]}),e.jsx("button",{className:"absolute top-2 right-2 w-7 h-7 rounded-full bg-black/60 flex items-center justify-center text-white opacity-0 group-hover:opacity-100 transition-opacity hover:bg-red-500/80",onClick:()=>L.mutate({id:t.id}),children:e.jsx(M,{className:"w-3.5 h-3.5"})})]},t.id))}):e.jsxs("div",{className:"text-center py-16 text-white/30 font-['Nunito']",children:[e.jsx(T,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{children:"Nessuna story pubblicata"}),g&&e.jsx("p",{className:"text-sm mt-1",children:"Carica la tua prima story sopra"})]})})]})]}),e.jsx(C,{})]}):e.jsxs("div",{className:"min-h-screen bg-[#0a0a14] pb-nav pt-[94px]",children:[e.jsx(S,{}),e.jsx("div",{className:"container py-32 text-center",children:e.jsx("p",{className:"text-white/60 font-['Nunito']",children:"Devi essere loggata per accedere a questa sezione."})}),e.jsx(C,{})]})}
1export{te 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.