116 lines
25 KiB
JavaScript
116 lines
25 KiB
JavaScript
import{r as c,j as r,h as B,u as D}from"./chunk-UIGDSWPH-BhuNDbxn.js";import{N as O,O as z,u as R,P as G,R as q}from"./main-af3pcbZa.js";import{S as U}from"./box-jJ_LUJjA.js";import{S as H}from"./check-circle--AtVWUy0.js";import{S as Z}from"./info-error-ByXER0wM.js";import{S as M}from"./file-CeG1FbGg.js";import{S as E}from"./angle-left-CYBnq6Pg.js";const K=e=>c.createElement("svg",{className:"size-6",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},c.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 2C8.41421 2 8.75 2.33579 8.75 2.75V3.75H15.25V2.75C15.25 2.33579 15.5858 2 16 2C16.4142 2 16.75 2.33579 16.75 2.75V3.75H18.5C19.7426 3.75 20.75 4.75736 20.75 6V9V19C20.75 20.2426 19.7426 21.25 18.5 21.25H5.5C4.25736 21.25 3.25 20.2426 3.25 19V9V6C3.25 4.75736 4.25736 3.75 5.5 3.75H7.25V2.75C7.25 2.33579 7.58579 2 8 2ZM8 5.25H5.5C5.08579 5.25 4.75 5.58579 4.75 6V8.25H19.25V6C19.25 5.58579 18.9142 5.25 18.5 5.25H16H8ZM19.25 9.75H4.75V19C4.75 19.4142 5.08579 19.75 5.5 19.75H18.5C18.9142 19.75 19.25 19.4142 19.25 19V9.75Z",fill:"currentColor"})),W={generated:"bg-emerald-100 text-emerald-700 dark:bg-emerald-500/20 dark:text-emerald-200",pending:"bg-amber-100 text-amber-700 dark:bg-amber-500/20 dark:text-amber-200",queued:"bg-amber-100 text-amber-700 dark:bg-amber-500/20 dark:text-amber-200",failed:"bg-rose-100 text-rose-700 dark:bg-rose-500/20 dark:text-rose-200",error:"bg-rose-100 text-rose-700 dark:bg-rose-500/20 dark:text-rose-200"},N=e=>e.map(a=>a.nodeType===Node.ELEMENT_NODE?a.outerHTML:a.nodeType===Node.TEXT_NODE?a.textContent??"":"").join(""),L=(e,a)=>e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||`section-${a+1}`,Y=e=>{if(!e)return{introHtml:"",sections:[]};let a=null;if(typeof window<"u"&&typeof window.DOMParser<"u"?a=new window.DOMParser:typeof DOMParser<"u"&&(a=new DOMParser),!a)return{introHtml:e,sections:[]};try{const t=a.parseFromString(e,"text/html").body,o=[],m=[];let i=null;return Array.from(t.childNodes).forEach(n=>{var g;if(n.nodeType===Node.ELEMENT_NODE){const x=n;if(x.tagName==="H2"){i&&m.push({id:L(i.heading,m.length),heading:i.heading||`Section ${m.length+1}`,headingLevel:i.level,bodyHtml:N(i.nodes).trim()}),i={heading:((g=x.textContent)==null?void 0:g.trim())||"",level:2,nodes:[]};return}}i?i.nodes.push(n):o.push(n)}),i&&m.push({id:L(i.heading,m.length),heading:i.heading||`Section ${m.length+1}`,headingLevel:i.level,bodyHtml:N(i.nodes).trim()}),{introHtml:N(o).trim(),sections:m}}catch{return{introHtml:e,sections:[]}}},J=e=>{if(!e||typeof e!="object")return null;const a=new WeakSet,s=t=>{if(!t||typeof t!="object"||a.has(t))return null;if(a.add(t),Array.isArray(t)){for(const n of t){const g=s(n);if(g)return g}return null}const o=t,m=typeof o.featured_prompt=="string",i=Array.isArray(o.in_article_prompts);if(m||i)return{featured_prompt:m?o.featured_prompt:void 0,in_article_prompts:i?o.in_article_prompts.filter(n=>typeof n=="string"):void 0};for(const n of Object.keys(o)){const g=s(o[n]);if(g)return g}return null};return s(e)},V=e=>{if(e){if(e.image_url)return e.image_url;if(e.image_path)return`/api/v1/writer/images/${e.id}/file/`}},$=({status:e,className:a=""})=>{if(!e)return null;const s=e.toLowerCase(),t=W[s]||"bg-slate-100 text-slate-700 dark:bg-slate-700/70 dark:text-slate-200";return r.jsx("span",{className:`inline-flex items-center gap-1 rounded-full px-3 py-1 text-xs font-semibold uppercase tracking-wide ${t} ${a}`,children:e})},F=({prompt:e,label:a,minHeight:s=220})=>r.jsx("div",{className:"flex w-full items-center justify-center rounded-3xl bg-gradient-to-br from-slate-100 via-slate-50 to-white p-8 text-center dark:from-gray-800 dark:via-gray-900 dark:to-gray-950",style:{minHeight:s},children:r.jsxs("div",{className:"max-w-xl space-y-3",children:[a&&r.jsx("p",{className:"text-[0.7rem] font-semibold uppercase tracking-[0.3em] text-slate-500 dark:text-slate-400",children:a}),r.jsx("p",{className:"text-sm font-medium leading-relaxed text-slate-600 dark:text-slate-300 whitespace-pre-wrap",children:e||"Image prompt available, awaiting generation."})]})}),X=({image:e,loading:a})=>{const s=V(e);return!a&&!e&&!s?null:r.jsxs("div",{className:"overflow-hidden rounded-3xl border border-slate-200/80 bg-white/80 shadow-lg shadow-slate-200/40 backdrop-blur-sm dark:border-gray-800/70 dark:bg-gray-900/70 dark:shadow-black/10",children:[r.jsxs("div",{className:"flex items-center justify-between px-8 pt-8",children:[r.jsx("div",{className:"text-xs font-semibold uppercase tracking-[0.35em] text-slate-500 dark:text-slate-400",children:"Featured Visual"}),r.jsx($,{status:e==null?void 0:e.status})]}),r.jsxs("div",{className:"relative mt-6",children:[a&&!s?r.jsx("div",{className:"h-[420px] animate-pulse bg-slate-200/70 dark:bg-gray-800/60"}):s?r.jsx("img",{src:s,alt:e!=null&&e.prompt?`Featured visual: ${e.prompt}`:"Featured visual",className:"h-full w-full object-cover",loading:"lazy"}):r.jsx(F,{prompt:e==null?void 0:e.prompt,minHeight:420,label:"Featured Image Prompt"}),(e==null?void 0:e.prompt)&&s&&r.jsx("div",{className:"absolute bottom-5 left-5 rounded-full bg-white/80 px-4 py-2 text-xs font-medium text-slate-600 backdrop-blur-sm dark:bg-gray-950/70 dark:text-slate-300",children:"Prompt aligned to hero section"})]}),(e==null?void 0:e.prompt)&&r.jsx("div",{className:"border-t border-slate-200/70 bg-white/70 px-8 py-6 text-sm leading-relaxed text-slate-600 backdrop-blur-sm dark:border-gray-800/60 dark:bg-gray-900/70 dark:text-slate-300",children:e.prompt})]})},Q=({image:e,loading:a,heading:s})=>{if(!e&&!a)return null;const t=V(e);return r.jsxs("figure",{className:"overflow-hidden rounded-3xl border border-slate-200/70 bg-slate-50/70 shadow-inner shadow-slate-200/70 dark:border-gray-800/60 dark:bg-gray-900/40 dark:shadow-black/30",children:[r.jsxs("div",{className:"relative",children:[a&&!e?r.jsx("div",{className:"h-[260px] animate-pulse bg-slate-200/60 dark:bg-gray-800/60"}):t?r.jsx("img",{src:t,alt:e!=null&&e.prompt?`${s} visual: ${e.prompt}`:`${s} visual`,className:"w-full object-cover",loading:"lazy"}):r.jsx(F,{prompt:e==null?void 0:e.prompt,minHeight:260,label:"In-Article Prompt"}),r.jsx("div",{className:"absolute right-4 top-4",children:r.jsx($,{status:e==null?void 0:e.status})})]}),(e==null?void 0:e.prompt)&&r.jsxs("figcaption",{className:"space-y-3 px-6 py-5 text-sm leading-relaxed text-slate-600 dark:text-slate-300",children:[r.jsx("p",{className:"font-semibold uppercase tracking-[0.25em] text-slate-400 dark:text-slate-500",children:"Visual Direction"}),r.jsx("p",{className:"font-medium whitespace-pre-wrap",children:e.prompt})]})]})},ee=({html:e})=>r.jsxs("section",{className:"overflow-hidden rounded-3xl border border-slate-200/80 bg-gradient-to-br from-white via-slate-50 to-white p-8 shadow-sm shadow-slate-200/60 dark:border-gray-800/70 dark:from-gray-900 dark:via-gray-950 dark:to-gray-900 dark:shadow-black/20",children:[r.jsx("div",{className:"text-xs font-semibold uppercase tracking-[0.35em] text-slate-500 dark:text-slate-400",children:"Opening Narrative"}),r.jsx("div",{className:"content-html prose prose-lg mt-6 max-w-none text-gray-800 dark:prose-invert",children:r.jsx("div",{dangerouslySetInnerHTML:{__html:e}})})]}),re=({section:e,image:a,loading:s,index:t})=>{const o=!!a,m=e.heading||`Section ${t+1}`;return r.jsx("section",{id:e.id,className:"group/section scroll-mt-24",children:r.jsx("div",{className:"overflow-hidden rounded-3xl border border-slate-200/80 bg-white/90 shadow-lg shadow-slate-200/50 backdrop-blur-sm transition-transform duration-300 group-hover/section:-translate-y-1 dark:border-gray-800/70 dark:bg-gray-900/70 dark:shadow-black/20",children:r.jsxs("div",{className:"flex flex-col gap-6 p-8 sm:p-10",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("span",{className:"inline-flex h-10 w-10 items-center justify-center rounded-full bg-brand-500/10 text-sm font-semibold text-brand-600 dark:bg-brand-500/20 dark:text-brand-300",children:t+1}),r.jsxs("div",{className:"flex flex-col",children:[r.jsx("span",{className:"text-[0.7rem] font-semibold uppercase tracking-[0.35em] text-slate-400 dark:text-slate-500",children:"Section Spotlight"}),r.jsx("h2",{className:"text-2xl font-bold text-slate-900 dark:text-white sm:text-3xl",children:m})]})]}),r.jsxs("div",{className:o?"grid gap-10 lg:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]":"",children:[r.jsx("div",{className:"content-html prose prose-lg max-w-none text-gray-800 dark:prose-invert ",children:r.jsx("div",{dangerouslySetInnerHTML:{__html:e.bodyHtml}})}),o&&r.jsx("div",{className:"flex flex-col gap-4",children:r.jsx(Q,{image:a,loading:s,heading:m})})]})]})})})},ae=({introHtml:e,sections:a,sectionImages:s,imagesLoading:t,rawHtml:o})=>!(a.length>0)&&!e&&o?r.jsx("div",{className:"overflow-hidden rounded-3xl border border-slate-200/80 bg-white/90 p-8 shadow-lg shadow-slate-200/50 dark:border-gray-800/70 dark:bg-gray-900/70 dark:shadow-black/20",children:r.jsx("div",{className:"content-html prose prose-lg max-w-none text-gray-800 dark:prose-invert",children:r.jsx("div",{dangerouslySetInnerHTML:{__html:o}})})}):r.jsxs("div",{className:"space-y-12",children:[e&&r.jsx(ee,{html:e}),a.map((i,n)=>r.jsx(re,{section:i,image:s[n]??null,loading:t,index:n},i.id||`section-${n}`))]});function se({content:e,loading:a,onBack:s}){var C;const[t,o]=c.useState([]),[m,i]=c.useState(!1),[n,g]=c.useState(null),x=c.useMemo(()=>J(e==null?void 0:e.metadata),[e==null?void 0:e.metadata]);c.useEffect(()=>{let d=!0;return e!=null&&e.id?(i(!0),O({content_id:e.id,ordering:"position",page_size:50}).then(l=>{d&&(o(((l==null?void 0:l.results)??[]).filter(Boolean)),g(null))}).catch(l=>{d&&(g((l==null?void 0:l.message)||"Unable to load images for this content."),o([]))}).finally(()=>{d&&i(!1)}),()=>{d=!1}):(o([]),g(null),i(!1),()=>{d=!1})},[e==null?void 0:e.id]);const u=c.useMemo(()=>t.length?[...t].sort((d,l)=>{const f=d.position??0,y=l.position??0;return d.image_type===l.image_type?f-y:d.image_type==="featured"?-1:l.image_type==="featured"?1:f-y}):[],[t]),k=c.useMemo(()=>u.find(d=>d.image_type==="featured")??null,[u]),v=c.useMemo(()=>u.filter(d=>d.image_type==="in_article"),[u]),w=c.useMemo(()=>k||(x!=null&&x.featured_prompt?{id:-1,task_id:(e==null?void 0:e.task_id)??null,task_title:(e==null?void 0:e.task_title)??null,content_id:(e==null?void 0:e.id)??null,content_title:(e==null?void 0:e.title)??(e==null?void 0:e.meta_title)??null,image_type:"featured",image_url:void 0,image_path:void 0,prompt:x.featured_prompt,status:"pending",position:0,created_at:"",updated_at:"",account_id:void 0}:null),[k,x,e==null?void 0:e.task_id,e==null?void 0:e.task_title,e==null?void 0:e.id,e==null?void 0:e.title,e==null?void 0:e.meta_title]),P=c.useMemo(()=>{const d=[...v].sort((p,h)=>(p.position??0)-(h.position??0)),l=(x==null?void 0:x.in_article_prompts)??[];if(!l.length)return d;const f=new Map;d.forEach((p,h)=>{const b=p.position??h+1;f.set(b,p)});const y=new Set,I=l.map((p,h)=>{const b=h+1,j=f.get(b);return y.add(b),j?{...j,prompt:j.prompt||p}:{id:-1*(h+1),task_id:(e==null?void 0:e.task_id)??null,task_title:(e==null?void 0:e.task_title)??null,content_id:(e==null?void 0:e.id)??null,content_title:(e==null?void 0:e.title)??(e==null?void 0:e.meta_title)??null,image_type:"in_article",image_url:void 0,image_path:void 0,prompt:p,status:"pending",position:b,created_at:"",updated_at:"",account_id:void 0}});return d.forEach((p,h)=>{const b=p.position??h+1;y.has(b)||I.push(p)}),I.sort((p,h)=>(p.position??0)-(h.position??0))},[v,x,e==null?void 0:e.task_id,e==null?void 0:e.task_title,e==null?void 0:e.id,e==null?void 0:e.title,e==null?void 0:e.meta_title]),_=c.useMemo(()=>Y((e==null?void 0:e.html_content)??""),[e==null?void 0:e.html_content]),T=m||!!w;if(a)return r.jsx("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 py-8",children:r.jsx("div",{className:"max-w-[1200px] mx-auto px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"animate-pulse",children:[r.jsx("div",{className:"h-8 bg-gray-200 dark:bg-gray-700 rounded w-1/4 mb-6"}),r.jsx("div",{className:"h-12 bg-gray-200 dark:bg-gray-700 rounded w-3/4 mb-4"}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded"}),r.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-5/6"})]})]})})});if(!e)return r.jsx("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 py-8",children:r.jsx("div",{className:"max-w-[1200px] mx-auto px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-2xl shadow-sm border border-gray-200 dark:border-gray-700 p-8 text-center",children:[r.jsx(Z,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),r.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-white mb-2",children:"Content Not Found"}),r.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:"The content you're looking for doesn't exist or has been deleted."}),s&&r.jsxs("button",{onClick:s,className:"inline-flex items-center gap-2 px-4 py-2 bg-brand-500 text-white rounded-lg hover:bg-brand-600 transition-colors",children:[r.jsx(E,{className:"w-4 h-4"}),"Back to Content List"]})]})})});const S=d=>{try{return new Date(d).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return d}},A=d=>{const l=d.toLowerCase();return l==="generated"||l==="published"||l==="complete"?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":l==="pending"||l==="draft"?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400":l==="failed"||l==="error"?"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400":"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"};return r.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 py-8",children:[r.jsxs("div",{className:"max-w-[1200px] mx-auto px-4 sm:px-6 lg:px-8",children:[s&&r.jsxs("button",{onClick:s,className:"mb-6 inline-flex items-center gap-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",children:[r.jsx(E,{className:"w-5 h-5"}),r.jsx("span",{className:"font-medium",children:"Back to Content"})]}),r.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-2xl shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:[r.jsx("div",{className:"bg-gradient-to-r from-brand-500 to-brand-600 px-8 py-6 text-white",children:r.jsx("div",{className:"flex items-start justify-between gap-4",children:r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[r.jsx(M,{className:"w-6 h-6"}),r.jsx("span",{className:`px-3 py-1 rounded-full text-sm font-medium ${A(e.status)}`,children:e.status})]}),r.jsx("h1",{className:"text-3xl font-bold mb-2",children:e.meta_title||e.title||`Content #${e.id}`}),e.meta_description&&r.jsx("p",{className:"text-brand-50 text-lg leading-relaxed",children:e.meta_description})]})})}),r.jsxs("div",{className:"px-8 py-6 border-b border-gray-200 dark:border-gray-700",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-sm font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wide",children:"Basic Information"}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(K,{className:"w-5 h-5 text-gray-400 mt-0.5 flex-shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Generated"}),r.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:S(e.generated_at)})]})]}),e.updated_at&&e.updated_at!==e.generated_at&&r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(z,{className:"w-5 h-5 text-gray-400 mt-0.5 flex-shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Last Updated"}),r.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:S(e.updated_at)})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(M,{className:"w-5 h-5 text-gray-400 mt-0.5 flex-shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Word Count"}),r.jsxs("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:[((C=e.word_count)==null?void 0:C.toLocaleString())||"N/A"," words"]})]})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-sm font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wide",children:"Related Information"}),r.jsxs("div",{className:"space-y-3",children:[e.task_title&&r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Task"}),r.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:e.task_title}),r.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:["ID: ",e.task_id]})]}),e.sector_name&&r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Sector"}),r.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:e.sector_name})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-sm font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wide",children:"SEO & Tags"}),r.jsxs("div",{className:"space-y-3",children:[e.primary_keyword&&r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Primary Keyword"}),r.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:e.primary_keyword})]}),e.secondary_keywords&&e.secondary_keywords.length>0&&r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:"Secondary Keywords"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:e.secondary_keywords.map((d,l)=>r.jsx("span",{className:"px-2 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded text-xs",children:d},l))})]})]})]})]}),e.tags&&e.tags.length>0||e.categories&&e.categories.length>0?r.jsx("div",{className:"mt-6 pt-6 border-t border-gray-200 dark:border-gray-700",children:r.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.tags&&e.tags.length>0&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(U,{className:"w-4 h-4 text-gray-400"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:e.tags.map((d,l)=>r.jsx("span",{className:"px-3 py-1 bg-brand-50 dark:bg-brand-900/20 text-brand-700 dark:text-brand-300 rounded-full text-xs font-medium",children:d},l))})]}),e.categories&&e.categories.length>0&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Categories:"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:e.categories.map((d,l)=>r.jsx("span",{className:"px-3 py-1 bg-purple-50 dark:bg-purple-900/20 text-purple-700 dark:text-purple-300 rounded-full text-xs font-medium",children:d},l))})]})]})}):null]}),(e.has_image_prompts||e.has_generated_images)&&r.jsx("div",{className:"px-8 py-4 bg-gray-50 dark:bg-gray-900/50 border-b border-gray-200 dark:border-gray-700",children:r.jsxs("div",{className:"flex items-center gap-4",children:[e.has_image_prompts&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(H,{className:"w-5 h-5 text-green-500"}),r.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Image Prompts Generated"})]}),e.has_generated_images&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(H,{className:"w-5 h-5 text-green-500"}),r.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Images Generated"})]})]})}),T&&r.jsx("div",{className:"px-8 pt-8",children:r.jsx(X,{image:w,loading:m})}),n&&r.jsx("div",{className:"px-8 pt-4",children:r.jsx("div",{className:"rounded-2xl border border-rose-200 bg-rose-50/80 px-4 py-3 text-sm font-medium text-rose-700 dark:border-rose-900/40 dark:bg-rose-950/30 dark:text-rose-300",children:n})}),r.jsx("div",{className:"px-8 pb-10 pt-10",children:r.jsx(ae,{introHtml:_.introHtml,sections:_.sections,sectionImages:P,imagesLoading:m,rawHtml:e.html_content})}),e.metadata&&Object.keys(e.metadata).length>0&&r.jsx("div",{className:"px-8 py-6 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900/50",children:r.jsxs("details",{className:"group",children:[r.jsx("summary",{className:"cursor-pointer text-sm font-semibold text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white",children:"View Full Metadata"}),r.jsx("div",{className:"mt-4 p-4 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:r.jsx("pre",{className:"text-xs text-gray-600 dark:text-gray-400 overflow-x-auto",children:JSON.stringify(e.metadata,null,2)})})]})})]})]}),r.jsx("style",{children:`
|
|
.content-html {
|
|
line-height: 1.85;
|
|
font-size: 1.05rem;
|
|
}
|
|
.content-html h2,
|
|
.content-html h3,
|
|
.content-html h4,
|
|
.content-html h5,
|
|
.content-html h6 {
|
|
margin-top: 2.5rem;
|
|
margin-bottom: 1.25rem;
|
|
font-weight: 600;
|
|
letter-spacing: -0.01em;
|
|
color: inherit;
|
|
}
|
|
.content-html h3 { font-size: 1.6rem; }
|
|
.content-html h4 { font-size: 1.35rem; }
|
|
.content-html h5 { font-size: 1.15rem; }
|
|
.content-html p {
|
|
margin-bottom: 1.3rem;
|
|
}
|
|
.content-html ul,
|
|
.content-html ol {
|
|
margin-bottom: 1.5rem;
|
|
padding-left: 1.75rem;
|
|
}
|
|
.content-html li {
|
|
margin-bottom: 0.6rem;
|
|
}
|
|
.content-html blockquote {
|
|
margin: 2rem 0;
|
|
padding: 1.25rem 1.5rem;
|
|
border-left: 4px solid rgba(59, 130, 246, 0.25);
|
|
background: rgba(59, 130, 246, 0.08);
|
|
border-radius: 1rem;
|
|
font-style: italic;
|
|
}
|
|
.content-html table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
margin: 2rem 0;
|
|
border-radius: 1rem;
|
|
overflow: hidden;
|
|
}
|
|
.content-html table th,
|
|
.content-html table td {
|
|
border: 1px solid #e5e7eb;
|
|
padding: 0.875rem 1rem;
|
|
text-align: left;
|
|
}
|
|
.content-html table th {
|
|
background: #f9fafb;
|
|
font-weight: 600;
|
|
}
|
|
.content-html img {
|
|
max-width: 100%;
|
|
height: auto;
|
|
border-radius: 1.25rem;
|
|
margin: 1.75rem auto;
|
|
display: block;
|
|
box-shadow: 0 20px 45px -25px rgba(15, 23, 42, 0.35);
|
|
}
|
|
.content-html a {
|
|
color: #2563eb;
|
|
text-decoration: none;
|
|
border-bottom: 1px solid rgba(37, 99, 235, 0.3);
|
|
transition: color 0.2s ease, border-bottom-color 0.2s ease;
|
|
}
|
|
.content-html a:hover {
|
|
color: #1d4ed8;
|
|
border-bottom-color: rgba(37, 99, 235, 0.6);
|
|
}
|
|
.content-html code {
|
|
background: rgba(15, 23, 42, 0.06);
|
|
padding: 0.2rem 0.45rem;
|
|
border-radius: 0.4rem;
|
|
font-size: 0.9rem;
|
|
}
|
|
.content-html pre {
|
|
background: rgba(15, 23, 42, 0.08);
|
|
padding: 1.25rem;
|
|
border-radius: 1.25rem;
|
|
overflow-x: auto;
|
|
margin: 2rem 0;
|
|
}
|
|
.content-html hr {
|
|
border: none;
|
|
border-top: 1px solid rgba(148, 163, 184, 0.4);
|
|
margin: 3rem 0;
|
|
}
|
|
.dark .content-html blockquote {
|
|
border-left-color: rgba(96, 165, 250, 0.45);
|
|
background: rgba(30, 41, 59, 0.65);
|
|
}
|
|
.dark .content-html table th,
|
|
.dark .content-html table td {
|
|
border-color: rgba(148, 163, 184, 0.25);
|
|
}
|
|
.dark .content-html table th {
|
|
background: rgba(30, 41, 59, 0.65);
|
|
}
|
|
.dark .content-html a {
|
|
color: #93c5fd;
|
|
border-bottom-color: rgba(147, 197, 253, 0.4);
|
|
}
|
|
.dark .content-html a:hover {
|
|
color: #bfdbfe;
|
|
border-bottom-color: rgba(191, 219, 254, 0.6);
|
|
}
|
|
.dark .content-html code,
|
|
.dark .content-html pre {
|
|
background: rgba(15, 23, 42, 0.7);
|
|
}
|
|
`})]})}function xe(){const{id:e}=B(),a=D(),s=R(),[t,o]=c.useState(null),[m,i]=c.useState(!0);c.useEffect(()=>{(async()=>{if(!e){s.error("Content ID is required"),a("/writer/content");return}const x=parseInt(e,10);if(isNaN(x)||x<=0){s.error("Invalid content ID"),a("/writer/content");return}i(!0);try{const u=await q(x);o(u)}catch(u){console.error("Error loading content:",u),s.error(`Failed to load content: ${u.message||"Unknown error"}`),o(null)}finally{i(!1)}})()},[e,a,s]);const n=()=>{a("/writer/content")};return r.jsxs(r.Fragment,{children:[r.jsx(G,{title:t?`${t.meta_title||t.title||`Content #${t.id}`} - IGNY8`:"Content View - IGNY8",description:(t==null?void 0:t.meta_description)||"View content details and metadata"}),r.jsx(se,{content:t,loading:m,onBack:n})]})}export{xe as default};
|