1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5764],{3200:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/[slug]/drafts/devto",function(){return s(9954)}])},7092:function(e,t,s){"use strict";s.d(t,{l:function(){return AdminLayout}});var n=s(7708),a=s(2705),o=s.n(a),r=s(549),d=s.n(r),i=s(8574);let l=[{href:"dashboard",label:"Dashboard"},{href:"topics",label:"Topic Radar"},{href:"posts",label:"All Posts"},{href:"drafts/linkedin",label:"LinkedIn"},{href:"drafts/instagram",label:"Instagram"},{href:"drafts/devto",label:"dev.to"},{href:"drafts/blogsite",label:"Blogsite"},{href:"connections",label:"Connections"},{href:"history",label:"History"}];function AdminLayout(e){let{gate:t,title:s,children:a}=e,r=(0,i.useRouter)();async function logout(){await fetch("/api/admin/logout",{method:"POST"}),r.push("/".concat(t,"/login"))}return(0,n.jsxs)("div",{className:"min-h-screen bg-stone-50 dark:bg-stone-950",children:[(0,n.jsxs)(o(),{children:[(0,n.jsxs)("title",{children:[s," â Admin"]}),(0,n.jsx)("meta",{name:"robots",content:"noindex, nofollow"})]}),(0,n.jsxs)("div",{className:"flex min-h-screen",children:[(0,n.jsxs)("aside",{className:"w-56 shrink-0 border-r border-stone-200 bg-white px-4 py-6 dark:border-stone-800 dark:bg-stone-900",children:[(0,n.jsx)("p",{className:"mb-6 px-2 text-xs font-bold uppercase tracking-widest text-indigo-600 dark:text-indigo-400",children:"Admin"}),(0,n.jsx)("nav",{className:"flex flex-col gap-1",children:l.map(e=>{let s=r.asPath==="/".concat(t,"/").concat(e.href);return(0,n.jsx)(d(),{href:"/".concat(t,"/").concat(e.href),className:"rounded-md px-2 py-1.5 text-sm font-medium transition-colors ".concat(s?"bg-indigo-50 text-indigo-700 dark:bg-indigo-950 dark:text-indigo-300":"text-stone-600 hover:bg-stone-100 dark:text-stone-400 dark:hover:bg-stone-800"),children:e.label},e.href)})}),(0,n.jsx)("button",{onClick:logout,className:"mt-8 w-full rounded-md px-2 py-1.5 text-left text-sm font-medium text-stone-500 hover:bg-stone-100 dark:text-stone-500 dark:hover:bg-stone-800",children:"Log out"})]}),(0,n.jsxs)("main",{className:"flex-1 px-8 py-8",children:[(0,n.jsx)("h1",{className:"mb-6 text-2xl font-bold text-stone-900 dark:text-stone-50",children:s}),a]})]})]})}},9954:function(e,t,s){"use strict";s.r(t),s.d(t,{__N_SSP:function(){return r},default:function(){return DevToDrafts}});var n=s(7708),a=s(9700),o=s(7092);function DraftCard(e){var t;let{draft:s,onChange:o}=e,[r,d]=(0,a.useState)(""),[i,l]=(0,a.useState)(!1),[c,m]=(0,a.useState)(!1),[u,h]=(0,a.useState)(null!==(t=s.blogsiteSlug)&&void 0!==t?t:""),[x,b]=(0,a.useState)(!1),[f,p]=(0,a.useState)(null),g="ready"===s.status||"scheduled"===s.status||"publish_failed"===s.status;async function saveBlogsiteSlug(){if(u.trim()){b(!0),p(null);try{let t=await fetch("/api/admin/devto/set-blogsite-slug",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:s.filename,blogsiteSlug:u.trim()})}),n=await t.json();if(n.ok)o();else{var e;p(null!==(e=n.error)&&void 0!==e?e:"Unknown error")}}finally{b(!1)}}}async function preview(){m(!0);try{let t=await fetch("/api/admin/devto/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:s.filename})}),n=await t.json();if(n.ok&&n.url)window.open(n.url,"_blank");else{var e;alert("Preview failed: ".concat(null!==(e=n.error)&&void 0!==e?e:"unknown error"))}}finally{m(!1)}}async function publishNow(){l(!0);try{await fetch("/api/admin/devto/publish-now",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:s.filename})}),o()}finally{l(!1)}}async function schedule(){if(r){l(!0);try{await fetch("/api/admin/devto/schedule",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:s.filename,scheduledFor:new Date(r).getTime()})}),o()}finally{l(!1)}}}return(0,n.jsxs)("div",{className:"rounded-lg border border-stone-200 bg-white p-5 dark:border-stone-800 dark:bg-stone-900",children:[(0,n.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,n.jsx)("h3",{className:"font-semibold text-stone-900 dark:text-stone-50",children:s.title}),(0,n.jsx)("span",{className:"rounded-full px-2.5 py-0.5 text-xs font-medium ".concat(function(e){switch(e){case"published":return"bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-400";case"scheduled":return"bg-amber-100 text-amber-700 dark:bg-amber-950 dar
1k:text-amber-400";case"publishing":return"bg-indigo-100 text-indigo-700 dark:bg-indigo-950 dark:text-indigo-400";case"publish_failed":return"bg-red-100 text-red-700 dark:bg-red-950 dark:text-red-400";default:return"bg-stone-100 text-stone-600 dark:bg-stone-800 dark:text-stone-400"}}(s.status)),children:s.status.replace(/_/g," ")})]}),(0,n.jsx)("p",{className:"mb-2 text-xs text-stone-400",children:s.filename}),s.description&&(0,n.jsx)("p",{className:"mb-3 text-sm text-stone-600 dark:text-stone-300",children:s.description}),s.tags.length>0&&(0,n.jsx)("div",{className:"mb-3 flex flex-wrap gap-1.5",children:s.tags.map(e=>(0,n.jsxs)("span",{className:"rounded-full bg-stone-100 px-2 py-0.5 text-xs text-stone-500 dark:bg-stone-800 dark:text-stone-400",children:["#",e]},e))}),(0,n.jsxs)("div",{className:"mb-3",children:[(0,n.jsx)("label",{className:"mb-1 block text-xs font-medium text-stone-500 dark:text-stone-400",children:"Linked blogsite slug (for automatic canonical-URL resolution)"}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("input",{type:"text",value:u,onChange:e=>h(e.target.value),placeholder:"e.g. dhi-chat-streaming-rag",className:"rounded-md border border-stone-300 px-2 py-1.5 text-sm dark:border-stone-700 dark:bg-stone-800 dark:text-stone-100"}),(0,n.jsx)("button",{onClick:saveBlogsiteSlug,disabled:x||!u.trim()||u.trim()===s.blogsiteSlug,className:"rounded-md border border-stone-300 px-3 py-1.5 text-sm font-medium hover:bg-stone-50 disabled:opacity-60 dark:border-stone-700 dark:hover:bg-stone-800",children:x?"Savingâ¦":"Save link"})]}),(0,n.jsxs)("p",{className:"mt-1 text-xs text-stone-400",children:["Commits a one-line frontmatter update to this file on ",(0,n.jsx)("code",{children:"main"}),". Whichever platform actually goes live first automatically becomes canonical for the other â no manual URL pasting needed once this is set. Pasting the full blogsite URL instead of just the slug is fine â it's normalized automatically."]}),f&&(0,n.jsx)("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400",children:f})]}),s.error&&(0,n.jsx)("p",{className:"mb-3 text-sm text-red-600 dark:text-red-400",children:s.error}),s.devToUrl&&(0,n.jsx)("p",{className:"mb-3 text-sm",children:(0,n.jsx)("a",{href:s.devToUrl,target:"_blank",rel:"noreferrer",className:"font-medium text-indigo-600 underline dark:text-indigo-400",children:s.devToUrl})}),s.scheduledFor&&"scheduled"===s.status&&(0,n.jsxs)("p",{className:"mb-3 text-xs text-stone-400",children:["Scheduled for ",new Date(s.scheduledFor).toLocaleString()]}),"published"!==s.status&&(0,n.jsx)("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:(0,n.jsx)("button",{onClick:preview,disabled:c,className:"rounded-md border border-stone-300 px-3 py-1.5 text-sm font-medium hover:bg-stone-50 disabled:opacity-60 dark:border-stone-700 dark:hover:bg-stone-800",children:c?"Opening previewâ¦":"Preview on dev.to â"})}),g&&(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("button",{onClick:publishNow,disabled:i,className:"rounded-md bg-indigo-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-indigo-700 disabled:opacity-60",children:"Publish now"}),(0,n.jsx)("input",{type:"datetime-local",value:r,onChange:e=>d(e.target.value),className:"rounded-md border border-stone-300 px-2 py-1.5 text-sm dark:border-stone-700 dark:bg-stone-800 dark:text-stone-100"}),(0,n.jsx)("button",{onClick:schedule,disabled:i||!r,className:"rounded-md border border-stone-300 px-3 py-1.5 text-sm font-medium hover:bg-stone-50 disabled:opacity-60 dark:border-stone-700 dark:hover:bg-stone-800",children:"Schedule"})]})]})}var r=!0;function DevToDrafts(e){let{gate:t}=e,[s,r]=(0,a.useState)([]);function load(){fetch("/api/admin/devto/drafts").then(e=>e.json()).then(e=>{var t;return r(null!==(t=e.drafts)&&void 0!==t?t:[])}).catch(()=>{})}return(0,a.useEffect)(load,[]),(0,n.jsxs)(o.l,{gate:t,title:"dev.to Drafts",children:[(0,n.jsxs)("p",{className:"mb-4 text-sm text-stone-500 dark:text-stone-400",children:["Content here comes from ",(0,n.jsx)("code",{children:"dev-to-blogs/*.md"}),", which you write by hand â this page only tracks and publishes it. Publishing to your own blogsite is never done from here; that still only happens when you commit a post file and push."]}),(0,n.jsxs)("div",{className:"flex flex-col gap-4",children:[0===s.length&&(0,n.jsx)("p",{className:"text-sm text-stone-400",children:"No dev.to blog files found."}),s.map(e=>(0,n.jsx)(DraftCard,{draft:e,onChange:load},e.filename))]})]})}},8574:function(e,t,s){e.exports=s(5550)}},function(e){e.O(0,[9985,9774,2888,179],function(){return e(e.s=3200)}),_N_E=e.O()}]);
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.