PageSourceSearch

https://xelia.ai/dashboard/assets/ContentPreviewPage-B-3Wa376.js

js xelia.ai collected 2026-10-05 13:42:27 UTC 10,047 bytes, 2 lines download raw bytes

1import{b as w,r as n,c as C,d as M,j as e,S as z,a as b}from"./index-CoO66CQf.js";const B={hot_take:"#8B5CF6",stat:"#34C759",quote:"#007AFF",comparison:"#FF9500",diagram:"#0A0A0A"},f={hot_take:"Opinión",stat:"Dato",quote:"Quote",comparison:"Comparación",diagram:"Pasos"},S={"xelia-social":"XELIA social","linkedin-personal":"LinkedIn personal",blog:"Blog",instagram:"Instagram",tiktok:"TikTok"},W={draft:"#6B7280",approved:"#34C759",rejected:"#FF3B30",superseded:"#9CA3AF"},D={draft:"Borrador",approved:"Aprobado",rejected:"Rechazado",superseded:"Sustituido"};function I(t){try{return new Date(t).toLocaleDateString("es-MX",{day:"2-digit",month:"short",hour:"2-digit",minute:"2-digit"})}catch{return t}}function T(t){return t==null?"—":`${Math.round(t*100)}%`}function H(){var A;const t=w(),[a,o]=n.useState(""),[i,s]=n.useState(""),[p,v]=n.useState(""),[l,E]=n.useState(30),[d,L]=n.useState(null),h=C({queryKey:["content-drafts",a,i,p,l],queryFn:()=>b.content.listDrafts({surface:a||void 0,template:i||void 0,status:p||void 0,days:l,limit:100}),staleTime:6e4}),u=n.useMemo(()=>{var r;return((r=h.data)==null?void 0:r.data)??[]},[h.data]),g=n.useMemo(()=>u.find(r=>r.id===d)??null,[u,d]),F=C({queryKey:["content-draft-preview",d],queryFn:()=>b.content.previewDraft(d),enabled:!!d,staleTime:5*6e4,retry:!1}),m=M({mutationFn:({id:r,status:x})=>b.content.updateDraft(r,x),onSuccess:()=>{t.invalidateQueries({queryKey:["content-drafts"]})}});return e.jsxs("div",{className:"page active",style:{padding:"32px",maxWidth:"1440px",margin:"0 auto"},children:[e.jsxs("header",{style:{marginBottom:"24px"},children:[e.jsx("h1",{style:{fontSize:"32px",fontWeight:700,marginBottom:"8px"},children:"Preview de contenido"}),e.jsx("p",{style:{fontSize:"14px",color:"var(--text-secondary)"},children:"Revisa los drafts producidos por la cadena editorial Stage 1-4. Aprueba o rechaza antes de publicar."})]}),e.jsxs("div",{style:{display:"flex",gap:"16px",marginBottom:"24px",padding:"16px",backgroundColor:"var(--bg-elevated, #FFFFFF)",border:"1px solid var(--border-light, #F0F0F0)",borderRadius:"12px",flexWrap:"wrap",alignItems:"center"},children:[e.jsx(j,{label:"Superficie",value:a,onChange:r=>o(r),options:[{value:"",label:"Todas"},...Object.entries(S).map(([r,x])=>({value:r,label:x}))]}),e.jsx(j,{label:"Template",value:i,onChange:r=>s(r),options:[{value:"",label:"Todos"},...Object.entries(f).map(([r,x])=>({value:r,label:x}))]}),e.jsx(j,{label:"Estado",value:p,onChange:r=>v(r),options:[{value:"",label:"Todos"},{value:"draft",label:"Borrador"},{value:"approved",label:"Aprobado"},{value:"rejected",label:"Rechazado"},{value:"superseded",label:"Sustituido"}]}),e.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px",fontSize:"12px"},children:[e.jsx("span",{style:{color:"var(--text-tertiary, #9CA3AF)",textTransform:"uppercase",letterSpacing:"0.5px"},children:"Últimos"}),e.jsxs("select",{value:l,onChange:r=>E(Number(r.target.value)),style:_,children:[e.jsx("option",{value:7,children:"7 días"}),e.jsx("option",{value:30,children:"30 días"}),e.jsx("option",{value:90,children:"90 días"})]})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1.5fr",gap:"24px"},children:[e.jsx("section",{style:{backgroundColor:"var(--bg-elevated, #FFFFFF)",border:"1px solid var(--border-light, #F0F0F0)",borderRadius:"12px",overflow:"hidden",maxHeight:"calc(100vh - 280px)",overflowY:"auto"},children:h.isLoading?e.jsx("div",{style:{padding:"24px"},children:e.jsx(z,{lines:6})}):u.length===0?e.jsx("div",{style:{padding:"40px 24px",textAlign:"center",color:"var(--text-tertiary, #9CA3AF)"},children:"No hay drafts en este rango."}):e.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:u.map(r=>e.jsx(P,{draft:r,selected:r.id===d,onClick:()=>L(r.id)},r.id))})}),e.jsx("section",{style:{backgroundColor:"var(--bg-elevated, #FFFFFF)",border:"1px solid var(--border-light, #F0F0F0)",borderRadius:"12px",padding:"24px",minHeight:"480px"},children:g?e.jsx(q,{draft:g,previewLoading:F.isLoading,previewError:F.error,previewData:((A=F.data)==null?void 0:A.data)??null,updating:m.isPending,onApprove:()=>m.mutate({id:g.id,status:"approved"}),onReject:()=>m.mutate({id:g.id,status:"rejected"})}):e.jsx("div",{style:{padding:"40px",textAlign:"center",color:"var(--text-tertiary, #9CA3AF)"},children:"Selecciona un draft para previsualizar."})})]})]})}const _={fontSize:"14px",padding:"8px 12px",borderRadius:"8px",border:"1px solid var(--border-medium, #E0E0E0)",backgroundColor:"var(--bg-primary, #FFFFFF)",color:"var(--text-primary, #111827)",minWidth:"140px",cursor:"pointer"};function j(t){return e.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px",fontSize:"12px"},children:[e.jsx("span",{style:{color:"var(--text-tertiary, #9CA3AF)",textTransform:"uppercase",letterSpacing:"0.5px"},children:t.label}),e.jsx("select",{value:t.value,onChange:a=>t.onChange(a.target.value),style:_,children:t.options.map(a=>e.jsx("option",{value:a.value,children:a.label},a.value))})]})}function P({draft:t,selected:a,onClick:o}){const i=t.template?B[t.template]:"#9CA3AF",s=W[t.status]??"#9CA3AF";return e.jsxs("li",{onClick:o,style:{padding:"16px 20px",borderBottom:"1px solid var(--border-light, #F0F0F0)",cursor:"pointer",backgroundColor:a?"var(--bg-hover, #F3F4F6)":"transparent",transition:"0.15s cubic-bezier(0.4, 0, 0.2, 1)"},children:[e.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center",marginBottom:"8px"},children:[t.template&&e.jsx("span",{style:y(i),children:f[t.template]}),e.jsx("span",{style:{fontSize:"11px",fontWeight:600,color:s,textTransform:"uppercase",letterSpacing:"0.5px"},children:D[t.status]??t.status}),t.sensitivity_flag&&e.jsx("span",{style:y("#FF3B30"),title:"Sensibilidad alta",children:"SENS"})]}),e.jsx("div",{style:{fontSize:"14px",fontWeight:600,color:"var(--text-primary, #111827)",marginBottom:"4px"},children:t.title||(t.body.length>80?t.body.slice(0,80)+"…":t.body)}),e.jsxs("div",{style:{fontSize:"12px",color:"var(--text-tertiary, #9CA3AF)"},children:[t.surface?S[t.surface]:"sin surface"," · ",I(t.created_at)]})]})}function q({draft:t,previewLoading:a,previewError:o,previewData:i,updating:s,onApprove:p,onReject:v}){const l=t.status==="approved"||t.status==="rejected";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[e.jsxs("header",{children:[e.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"8px"},children:[t.template&&e.jsx("span",{style:y(B[t.template]),children:f[t.template]}),t.surface&&e.jsx("span",{style:y("#0A0A0A",!0),children:S[t.surface]})]}),e.jsx("h2",{style:{fontSize:"20px",fontWeight:700,margin:0,color:"var(--text-primary, #111827)"},children:t.title||"Sin título"})]}),e.jsx("div",{style:{backgroundColor:"var(--bg-secondary, #F9FAFB)",borderRadius:"12px",padding:"16px",display:"flex",justifyContent:"center",alignItems:"center",minHeight:"280px"},children:a?e.jsx("div",{style:{width:"100%"},children:e.jsx(z,{lines:4})}):o?e.jsxs("div",{style:{color:"var(--danger, #FF3B30)",fontSize:"13px",textAlign:"center"},children:["Error renderizando preview.",e.jsx("br",{}),e.jsx("span",{style:{color:"var(--text-tertiary)"},children:"¿Modal renderer configurado? Ver apps/content-engine/modal/README.md"})]}):i?e.jsx("img",{src:i.image_data_uri,alt:t.title||"preview",style:{maxWidth:"100%",maxHeight:"420px",borderRadius:"8px"}}):null}),i&&e.jsxs("div",{style:{fontSize:"11px",color:"var(--text-tertiary, #9CA3AF)",textAlign:"center"},children:[i.width,"×",i.height," · render ",i.render_ms,"ms · latency ",i.latency_ms,"ms"]}),e.jsxs("div",{children:[e.jsx("h3",{style:R,children:"Texto"}),e.jsx("pre",{style:{fontFamily:"var(--font-primary)",fontSize:"14px",lineHeight:1.6,whiteSpace:"pre-wrap",color:"var(--text-primary)",backgroundColor:"var(--bg-secondary, #F9FAFB)",padding:"16px",borderRadius:"8px",margin:0,border:"1px solid var(--border-light, #F0F0F0)"},children:t.body})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"12px"},children:[e.jsx(c,{label:"Voice score",value:T(t.voice_doctrine_compliance_score),accent:"#007AFF"}),e.jsx(c,{label:"Novedad",value:T(t.novelty_score),accent:"#34C759"}),e.jsx(c,{label:"Sensibilidad",value:t.sensitivity_flag?"Alta":"OK",accent:t.
1sensitivity_flag?"#FF3B30":"#34C759"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"12px"},children:[e.jsx(c,{label:"Modelo",value:t.model_used??"—"}),e.jsx(c,{label:"Tokens in",value:String(t.input_tokens)}),e.jsx(c,{label:"Tokens out",value:String(t.output_tokens)})]}),e.jsxs("div",{style:{display:"flex",gap:"12px"},children:[e.jsx("button",{onClick:p,disabled:s||l,style:{...k,backgroundColor:"#34C759",color:"#FFFFFF",opacity:s||l?.5:1,cursor:s||l?"not-allowed":"pointer"},children:t.status==="approved"?"Aprobado ✓":"Aprobar"}),e.jsx("button",{onClick:v,disabled:s||l,style:{...k,backgroundColor:"transparent",color:"#FF3B30",border:"1px solid #FF3B30",opacity:s||l?.5:1,cursor:s||l?"not-allowed":"pointer"},children:t.status==="rejected"?"Rechazado ✗":"Rechazar"})]})]})}function y(t,a=!1){return{display:"inline-block",fontSize:"11px",fontWeight:600,padding:"4px 10px",borderRadius:"9999px",backgroundColor:a?t:`${t}1A`,color:a?"#FFFFFF":t,textTransform:"uppercase",letterSpacing:"0.5px"}}const R={fontSize:"11px",fontWeight:600,color:"var(--text-tertiary, #9CA3AF)",textTransform:"uppercase",letterSpacing:"0.5px",margin:"0 0 8px"};function c({label:t,value:a,accent:o}){return e.jsxs("div",{style:{padding:"12px",backgroundColor:"var(--bg-secondary, #F9FAFB)",borderRadius:"8px",border:"1px solid var(--border-light, #F0F0F0)"},children:[e.jsx("div",{style:R,children:t}),e.jsx("div",{style:{fontSize:"18px",fontWeight:700,color:o??"var(--text-primary, #111827)"},children:a})]})}const k={flex:1,padding:"12px 20px",fontSize:"14px",fontWeight:600,borderRadius:"8px",border:"none",transition:"0.15s cubic-bezier(0.4, 0, 0.2, 1)"};export{H as ContentPreviewPage};
2//# sourceMappingURL=ContentPreviewPage-B-3Wa376.js.map

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.