PageSourceSearch

https://escortadvisor-b4fe68rl.manus.space/assets/AdminPushNotifications-CChEQzaI.js

js escortadvisor-b4fe68rl.manus.space collected 2026-10-03 05:02:18 UTC 6,331 bytes, 1 lines download raw bytes

1import{r as a,t as w,q as d,j as e,L as N,aL as p,as as x,ax as j,B as k,ak as y,x as O,az as S}from"./index-cscxoOf9.js";import{L as n}from"./label-B7kYnnLZ.js";import{S as L}from"./send-DI6AmIeV.js";function _(){const[s,o]=a.useState(""),[i,l]=a.useState(""),[h,m]=a.useState("/"),[u,f]=a.useState("broadcast"),[r,g]=a.useState(null),c=w.notifications.pushBroadcast.useMutation({onSuccess:t=>{g(t),d.success(`Notifica inviata a ${t.sent} dispositivi`),o(""),l("")},onError:t=>{d.error(`Errore: ${t.message}`)}}),b=()=>{if(!s.trim()||!i.trim()){d.error("Titolo e testo sono obbligatori");return}c.mutate({title:s.trim(),body:i.trim(),url:h.trim()||"/",tag:u.trim()||"broadcast"})},v=[{label:"🌟 Nuovo profilo",title:"Nuovo profilo disponibile 🌟",body:"Scopri i nuovi profili verificati su EscortAnnunci!",url:"/",tag:"new-profile"},{label:"🔥 Offerta speciale",title:"Offerta speciale 🔥",body:"Pubblica il tuo annuncio oggi con uno sconto esclusivo!",url:"/pubblica-annuncio",tag:"promo"},{label:"⭐ Nuove recensioni",title:"Nuove recensioni ⭐",body:"Leggi le ultime recensioni verificate su EscortAnnunci",url:"/escort/roma",tag:"reviews"},{label:"📢 Annuncio",title:"Novità su EscortAnnunci 📢",body:"",url:"/",tag:"announcement"}];return e.jsx("div",{className:"min-h-screen bg-[oklch(0.10_0.015_280)] text-white p-6",children:e.jsxs("div",{className:"max-w-2xl mx-auto",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[e.jsx(N,{href:"/admin",className:"text-white/40 hover:text-white/70 text-sm transition-colors",children:"← Admin"}),e.jsx("span",{className:"text-white/20",children:"/"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{className:"w-5 h-5 text-pink-400"}),e.jsx("h1",{className:"text-xl font-['Syne'] font-bold text-white",children:"Notifiche Push"})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("p",{className:"text-xs text-white/40 font-['Outfit'] mb-3 uppercase tracking-wider",children:"Messaggi predefiniti"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:v.map(t=>e.jsx("button",{onClick:()=>{o(t.title),t.body&&l(t.body),m(t.url),f(t.tag)},className:"px-3 py-1.5 bg-white/5 hover:bg-white/10 border border-white/10 hover:border-white/20 rounded-full text-xs text-white/60 hover:text-white/80 transition-all font-['Outfit']",children:t.label},t.tag))})]}),e.jsxs("div",{className:"bg-[oklch(0.14_0.015_280)] border border-white/10 rounded-2xl p-6 space-y-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{className:"text-white/70 text-sm font-['Outfit']",children:"Titolo *"}),e.jsx(x,{value:s,onChange:t=>o(t.target.value),placeholder:"Es: Nuovo profilo disponibile 🌟",maxLength:100,className:"bg-white/5 border-white/10 text-white placeholder:text-white/30 focus-visible:ring-pink-500/30 font-['Outfit']"}),e.jsxs("p",{className:"text-xs text-white/30 text-right font-['Outfit']",children:[s.length,"/100"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{className:"text-white/70 text-sm font-['Outfit']",children:"Testo *"}),e.jsx(j,{value:i,onChange:t=>l(t.target.value),placeholder:"Es: Scopri i nuovi profili verificati su EscortAnnunci!",maxLength:300,rows:3,className:"bg-white/5 border-white/10 text-white placeholder:text-white/30 focus-visible:ring-pink-500/30 font-['Outfit'] resize-none"}),e.jsxs("p",{className:"text-xs text-white/30 text-right font-['Outfit']",children:[i.length,"/300"]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{className:"text-white/70 text-sm font-['Outfit']",children:"URL di destinazione"}),e.jsx(x,{value:h,onChange:t=>m(t.target.value),placeholder:"/",className:"bg-white/5 border-white/10 text-white placeholder:text-white/30 focus-visible:ring-pink-500/30 font-['Outfit']"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{className:"text-white/70 text-sm font-['Outfit']",children:"Tag (deduplicazione)"}),e.jsx(x,{value:u,onChange:t=>f(t.target.value),placeholder:"broadcast",className:"bg-white/5 border-white/10 text-white placeholder:text-white/30 focus-visible:ring-pink-500/30 font-['Outfit']"})]})]}),(s||i)&&e.jsxs("div",{className:"bg-[oklch(0.18_0.015_280)] border border-white/10 rounded-xl p-4",children:[e.jsx("p",{className:"text-xs text-white/40 font-['Outfit'] mb-2 uppercase tracking-wider",children:"Anteprima notifica"}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-[#07793e] to-[#246068] flex items-center justify-center shrink-0",children:e.jsx(p,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-['Syne'] font-bold text-white",children:s||"(titolo)"}),e.jsx("p",{className:"text-xs text-white/60 font-['Outfit'] mt-0.5",children:i||"(testo)"})]})]})]}),e.jsx(k,{onClick:b,disabled:c.isPending||!s.trim()||!i.trim(),className:"w-full h-11 bg-gradient-to-r from-pink-500 to-violet-600 hover:from-pink-400 hover:to-violet-500 text-white border-0 font-['Syne'] font-bold rounded-xl",children:c.isPending?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(y,{className:"w-4 h-4 animate-pulse"})," Invio in corso..."]}):e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(L,{className:"w-4 h-4"})," Invia a tutti gli iscritti"]})})]}),r&&e.jsxs("div",{className:"mt-4 bg-[oklch(0.14_0.015_280)] border border-white/10 rounded-2xl p-4 flex items-center gap-4",children:[e.jsx(O,{className:"w-5 h-5 text-green-400 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-['Syne'] font-semibold text-white",children:"Notifica inviata con successo"}),e.jsxs("p",{className:"text-xs text-white/50 font-['Outfit'] mt-0.5",children:[r.sent," dispositivi raggiunti · ",r.failed," falliti"]})]})]}),e.jsxs("div",{className:"mt-6 bg-blue-500/5 border border-blue-500/20 rounded-xl p-4 flex items-start gap-3",children:[e.jsx(S,{className:"w-4 h-4 text-blue-400 shrink-0 mt-0.5"}),e.jsx("p",{className:"text-xs text-white/50 font-['Outfit'] leading-relaxed",children:"Le notifiche push vengono inviate solo agli utenti che hanno installato la PWA su Android e hanno concesso il permesso. Le subscription scadute vengono rimosse automaticamente."})]})]})})}export{_ 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.