PageSourceSearch

https://mondopalermo.it/assets/AdminReels-DwSf0EEJ.js

js mondopalermo.it collected 2026-10-07 02:03:20 UTC 14,708 bytes, 11 lines download raw bytes

1import{w as U,t as c,r,$ as t,j as e,I as R,B as l,K as f,k as u,O as k,E as V,a0 as G}from"./index-BX7Bnw_R.js";import{I as S}from"./input-Bzt1jOyF.js";import{T as P}from"./textarea-C4YI8zTI.js";import{R as _}from"./refresh-cw-APm67LZp.js";import{U as q}from"./upload-D_yBivB7.js";import{E as Z}from"./eye-off-mWZqyA18.js";import{T as $}from"./trash-2-CZImLvcG.js";import"./useComposition-BNfgeBKA.js";import"./usePersistFn-BJzm3SCg.js";/**
2 * @license lucide-react v0.453.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const H=U("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
7 * @license lucide-react v0.453.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const K=U("ImageOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]]);function le(){const d=c.useUtils(),{data:o=[],isLoading:I}=c.reels.listAll.useQuery(),[i,g]=r.useState(""),[A,x]=r.useState(""),[s,m]=r.useState(""),[j,p]=r.useState(!1),[v,N]=r.useState(!1),[b,y]=r.useState(!1),C=c.reels.fetchMeta.useMutation(),z=c.reels.uploadThumbnailFromUrl.useMutation(),h=c.reels.create.useMutation({onSuccess:()=>{d.reels.listAll.invalidate(),d.reels.list.invalidate(),g(""),x(""),m(""),p(!1),t.success("Reel aggiunto! Il Reel è stato pubblicato nella home.")},onError:a=>t.error("Errore: "+a.message)}),M=c.reels.update.useMutation({onSuccess:()=>{d.reels.listAll.invalidate(),d.reels.list.invalidate()}}),E=c.reels.delete.useMutation({onSuccess:()=>{d.reels.listAll.invalidate(),d.reels.list.invalidate(),t.success("Reel eliminato")},onError:a=>t.error("Errore: "+a.message)}),T=async()=>{if(i.trim()){N(!0);try{const a=await C.mutateAsync(i.trim());a.thumbnailUrl?(m(a.thumbnailUrl),t.success("Anteprima caricata e salvata automaticamente!")):t.info("Nessuna anteprima trovata — incolla l'URL della thumbnail CDN di Instagram nel campo sotto."),a.caption&&x(a.caption)}catch{t.error("Impossibile recuperare l'anteprima — inserisci l'URL della thumbnail manualmente.")}finally{N(!1)}}},L=async()=>{if(s.trim()&&!(s.includes("amazonaws.com")||s.includes("manus"))){y(!0);try{const a=i.match(/instagram\.com\/(?:reel|p)\/([A-Za-z0-9_-]+)/),n=a?a[1]:void 0,O=await z.mutateAsync({imageUrl:s.trim(),reelShortcode:n});m(O.s3Url),t.success("Immagine salvata su S3 — l'anteprima è ora permanente!")}catch(a){t.error("Errore salvataggio: "+(a?.message??"Riprova"))}finally{y(!1)}}},F=()=>{i.trim()&&h.mutate({url:i.trim(),thumbnailUrl:s.trim()||void 0,caption:A.trim()||void 0,active:!0})},D=(a,n)=>{M.mutate({id:a,data:{active:!n}})},B=a=>{const n=a.match(/instagram\.com\/(?:reel|p)\/([A-Za-z0-9_-]+)/);return n?n[1]:null},w=s.trim()&&!s.includes("amazonaws.com")&&(s.includes("cdninstagram.com")||s.includes("fbcdn.net")||s.includes("scontent"));return e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminReels.tsx:132",className:"space-y-6",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminReels.tsx:134",className:"flex items-center justify-between",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminReels.tsx:135",children:[e.jsxs("h1",{"data-loc":"client/src/pages/admin/AdminReels.tsx:136",className:"text-2xl font-bold text-foreground flex items-center gap-2",children:[e.jsx(R,{"data-loc":"client/src/pages/admin/AdminReels.tsx:137",className:"h-6 w-6 text-pink-500"}),"Reels Instagram"]}),e.jsx("p",{"data-loc":"client/src/pages/admin/AdminReels.tsx:140",className:"text-sm text-muted-foreground mt-1",children:'Gestisci i Reels di @mondopalermo mostrati nella sezione "I Nostri Video" della home.'})]}),e.jsxs(l,{"data-loc":"client/src/pages/admin/AdminReels.tsx:144",onClick:()=>p(!0),disabled:j,children:[e.jsx(f,{"data-loc":"client/src/pages/admin/AdminReels.tsx:145",className:"h-4 w-4 mr-2"}),"Aggiungi Reel"]})]}),j&&e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminReels.tsx:152",className:"bg-card border border-border rounded-xl p-5 space-y-4",children:[e.jsx("h2",{"data-loc":"client/src/pages/admin/AdminReels.tsx:153",className:"font-semibold text-foreground",children:"Nuovo Reel Instagram"}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminReels.tsx:156",className:"space-y-1.5",children:[e.jsx("label",{"data-loc":"client/src/pages/admin/AdminReels.tsx:157",className:"text-sm font-medium text-foreground",children:"URL del Reel *"}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminReels.tsx:158",className:"flex gap-2",children:[e.jsx(S,{"data-loc":"client/src/pages/admin/AdminReels.tsx:159",placeholder:"https://www.instagram.com/reel/ABC123xyz/",value:i,onChange:a=>g(a.target.value),className:"flex-1"}),e.jsxs(l,{"data-loc":"client/src/pages/admin/AdminReels.tsx:165",variant:"outline",onClick:T,disabled:!i.trim()||v,children:[v?e.jsx(u,{"data-loc":"client/src/pages/admin/AdminReels.tsx:171",className:"h-4 w-4 animate-spin"}):e.jsx(_,{"data-loc":"client/src/pages/admin/AdminReels.tsx:173",className:"h-4 w-4"}),e.jsx("span",{"data-loc":"client/src/pages/admin/AdminReels.tsx:175",className:"ml-2 hidden sm:inline",children:"Recupera anteprima"})]})]}),e.jsx("p",{"data-loc":"client/src/pages/admin/AdminReels.tsx:178",className:"text-xs text-muted-foreground",children:'Incolla il link del Reel da Instagram, poi clicca "Recupera anteprima".'})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminReels.tsx:184",className:"flex gap-4",children:[e.jsx("div",{"data-loc":"client/src/pages/admin/AdminReels.tsx:185",className:"w-24 h-40 bg-muted rounded-lg overflow-hidden flex-shrink-0 flex items-center justify-center border border-border",children:s?e.jsx("img",{"data-loc":"client/src/pages/admin/AdminReels.tsx:187",src:s,alt:"Anteprima",className:"w-full h-full object-cover"}):e.jsx(K,{"data-loc":"client/src/pages/admin/AdminReels.tsx:189",className:"h-8 w-8 text-muted-foreground"})}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminReels.tsx:192",className:"flex-1 space-y-3",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminReels.tsx:193",className:"space-y-1.5",children:[e.jsx("label",{"data-loc":"client/src/pages/admin/AdminReels.tsx:194",className:"text-sm font-medium text-foreground",children:"URL Thumbnail"}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminReels.tsx:195",className:"flex gap-2",children:[e.jsx(S,{"data-loc":"client/src/pages/admin/AdminReels.tsx:196",placeholder:"https://scontent-iad3-1.cdninstagram.com/...",value:s,onChange:a=>m(a.target.value),className:"flex-1"}),w&&e.jsxs(l,{"data-loc":"client/src/pages/admin/AdminReels.tsx:203",variant:"outline",size:"sm",onClick:L,disabled:b,title:"Salva l'immagine su S3 per renderla permanente",className:"flex-shrink-0",children:[b?e.jsx(u,{"data-loc":"client/src/pages/admin/AdminReels.tsx:212",className:"h-4 w-4 animate-spin"}):e.jsx(q,{"data-loc":"client/src/pages/admin/AdminReels.tsx:214",className:"h-4 w-4"}),e.jsx("span",{"data-loc":"client/src/pages/admin/AdminReels.tsx:216",className:"ml-1.5 hidden sm:inline",children:"Salva su S3"})]})]}),e.jsx("p",{"data-loc":"client/src/pages/admin/AdminReels.tsx:220",className:"text-xs text-muted-foreground",children:w?'⚠️ URL CDN Instagram rilevato — clicca "Salva su S3" per renderlo permanente e visibile nella home.':s.includes("amazonaws.com")?"✅ Immagine salvata su S3 — permanente e visibile nella home.":`Se l'anteprima non viene recuperata automaticamente, incolla qui l'URL CDN di Instagram e clicca "Salva su S3".`})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminReels.tsx:228",className:"space-y-1.5",children:[e.jsx("label",{"data-loc":"client/src/pages/admin/AdminReels.tsx:229",className:"text-sm font-medium text-foreground",children:"Didascali
11a (opzionale)"}),e.jsx(P,{"data-loc":"client/src/pages/admin/AdminReels.tsx:230",placeholder:"Descrizione breve del Reel...",value:A,onChange:a=>x(a.target.value),rows:2})]})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminReels.tsx:240",className:"flex gap-2 justify-end",children:[e.jsx(l,{"data-loc":"client/src/pages/admin/AdminReels.tsx:241",variant:"outline",onClick:()=>{p(!1),g(""),x(""),m("")},children:"Annulla"}),e.jsxs(l,{"data-loc":"client/src/pages/admin/AdminReels.tsx:244",onClick:F,disabled:!i.trim()||h.isPending,children:[h.isPending?e.jsx(u,{"data-loc":"client/src/pages/admin/AdminReels.tsx:245",className:"h-4 w-4 animate-spin mr-2"}):e.jsx(f,{"data-loc":"client/src/pages/admin/AdminReels.tsx:245",className:"h-4 w-4 mr-2"}),"Aggiungi"]})]})]}),I?e.jsx("div",{"data-loc":"client/src/pages/admin/AdminReels.tsx:254",className:"flex items-center justify-center py-12",children:e.jsx(u,{"data-loc":"client/src/pages/admin/AdminReels.tsx:255",className:"h-6 w-6 animate-spin text-muted-foreground"})}):o.length===0?e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminReels.tsx:258",className:"bg-card border border-dashed border-border rounded-xl p-12 text-center",children:[e.jsx(R,{"data-loc":"client/src/pages/admin/AdminReels.tsx:259",className:"h-12 w-12 text-muted-foreground mx-auto mb-3 opacity-40"}),e.jsx("p",{"data-loc":"client/src/pages/admin/AdminReels.tsx:260",className:"text-muted-foreground font-medium",children:"Nessun Reel aggiunto"}),e.jsx("p",{"data-loc":"client/src/pages/admin/AdminReels.tsx:261",className:"text-sm text-muted-foreground mt-1",children:"Aggiungi il link di un Reel di @mondopalermo per mostrarlo nella home."}),e.jsxs(l,{"data-loc":"client/src/pages/admin/AdminReels.tsx:264",className:"mt-4",onClick:()=>p(!0),children:[e.jsx(f,{"data-loc":"client/src/pages/admin/AdminReels.tsx:265",className:"h-4 w-4 mr-2"}),"Aggiungi il primo Reel"]})]}):e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminReels.tsx:270",className:"space-y-3",children:[e.jsxs("p",{"data-loc":"client/src/pages/admin/AdminReels.tsx:271",className:"text-sm text-muted-foreground",children:[o.filter(a=>a.active).length," di ",o.length," Reels attivi nella home"]}),o.map(a=>{const n=B(a.url);return e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminReels.tsx:277",className:`bg-card border rounded-xl p-4 flex items-center gap-4 transition-opacity ${a.active?"":"opacity-50"}`,children:[e.jsx(H,{"data-loc":"client/src/pages/admin/AdminReels.tsx:281",className:"h-5 w-5 text-muted-foreground flex-shrink-0 cursor-grab"}),e.jsx("div",{"data-loc":"client/src/pages/admin/AdminReels.tsx:284",className:"w-16 h-24 bg-muted rounded-lg overflow-hidden flex-shrink-0 flex items-center justify-center border border-border/50",children:a.thumbnailUrl?e.jsx("img",{"data-loc":"client/src/pages/admin/AdminReels.tsx:286",src:a.thumbnailUrl,alt:"Reel",className:"w-full h-full object-cover"}):e.jsx(R,{"data-loc":"client/src/pages/admin/AdminReels.tsx:288",className:"h-6 w-6 text-muted-foreground"})}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminReels.tsx:293",className:"flex-1 min-w-0",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminReels.tsx:294",className:"flex items-center gap-2 mb-1",children:[e.jsx(k,{"data-loc":"client/src/pages/admin/AdminReels.tsx:295",variant:a.active?"default":"secondary",className:"text-xs",children:a.active?"Attivo":"Nascosto"}),a.thumbnailUrl&&e.jsx(k,{"data-loc":"client/src/pages/admin/AdminReels.tsx:299",variant:"outline",className:"text-xs text-green-600 border-green-300",children:"✓ Anteprima"})]}),a.caption&&e.jsx("p",{"data-loc":"client/src/pages/admin/AdminReels.tsx:305",className:"text-sm text-foreground line-clamp-2 mb-1",children:a.caption}),e.jsx("p",{"data-loc":"client/src/pages/admin/AdminReels.tsx:307",className:"text-xs text-muted-foreground truncate",children:a.url})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminReels.tsx:311",className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx(l,{"data-loc":"client/src/pages/admin/AdminReels.tsx:312",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>D(a.id,a.active),title:a.active?"Nascondi dalla home":"Mostra nella home",children:a.active?e.jsx(V,{"data-loc":"client/src/pages/admin/AdminReels.tsx:319",className:"h-4 w-4"}):e.jsx(Z,{"data-loc":"client/src/pages/admin/AdminReels.tsx:319",className:"h-4 w-4"})}),n&&e.jsx(l,{"data-loc":"client/src/pages/admin/AdminReels.tsx:322",variant:"ghost",size:"icon",className:"h-8 w-8",asChild:!0,children:e.jsx("a",{"data-loc":"client/src/pages/admin/AdminReels.tsx:323",href:a.url,target:"_blank",rel:"noopener noreferrer",title:"Apri su Instagram",children:e.jsx(G,{"data-loc":"client/src/pages/admin/AdminReels.tsx:324",className:"h-4 w-4"})})}),e.jsx(l,{"data-loc":"client/src/pages/admin/AdminReels.tsx:328",variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>E.mutate(a.id),title:"Elimina",children:e.jsx($,{"data-loc":"client/src/pages/admin/AdminReels.tsx:335",className:"h-4 w-4"})})]})]},a.id)})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminReels.tsx:345",className:"bg-muted/40 border border-border/60 rounded-xl p-4 text-sm text-muted-foreground space-y-1.5",children:[e.jsx("p",{"data-loc":"client/src/pages/admin/AdminReels.tsx:346",className:"font-semibold text-foreground",children:"Come aggiungere un Reel"}),e.jsxs("p",{"data-loc":"client/src/pages/admin/AdminReels.tsx:347",children:[e.jsx("strong",{"data-loc":"client/src/pages/admin/AdminReels.tsx:347",children:"Metodo 1 — Automatico:"}),' Incolla il link del Reel e clicca "Recupera anteprima". Il sistema scarica e salva automaticamente la thumbnail su S3.']}),e.jsxs("p",{"data-loc":"client/src/pages/admin/AdminReels.tsx:348",children:[e.jsx("strong",{"data-loc":"client/src/pages/admin/AdminReels.tsx:348",children:"Metodo 2 — Manuale:"}),` Se l'anteprima automatica non funziona, apri il Reel su Instagram, fai click destro sull'immagine → "Copia indirizzo immagine", incollalo nel campo Thumbnail e clicca "Salva su S3".`]}),e.jsx("p",{"data-loc":"client/src/pages/admin/AdminReels.tsx:349",children:"Usa l'icona occhio per mostrare/nascondere un Reel senza eliminarlo. Solo i Reels attivi appaiono nella home (max 6)."})]})]})}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.