PageSourceSearch

https://bidor.ai/_next/static/chunks/pages/admin/blog/new-5a7dbde414bc45c4.js

js bidor.ai collected 2026-10-05 14:36:34 UTC 14,939 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3299],{6805:function(e,r,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/blog/new",function(){return a(1838)}])},1838:function(e,r,a){"use strict";a.r(r),a.d(r,{default:function(){return w}});var t=a(5893),s=a(7294),l=a(9008),d=a.n(l),n=a(1664),o=a.n(n),i=a(1163),c=a(2761),g=a(2606),x=a(9819),b=a(3603),m=a(8760),u=a(3283),h=a(2190),y=a(1603),p=a(3284),k=a(2553);let f=()=>{let e=Object.keys(localStorage).filter(e=>e.includes("idToken"));return e.length>0?localStorage.getItem(e[0]):null},j=[{id:"workflow-tips",label:"Workflow Tips"},{id:"best-practices",label:"Best Practices"},{id:"case-studies",label:"Case Studies"},{id:"product-updates",label:"Product Updates"},{id:"tutorials",label:"Tutorials"},{id:"industry-insights",label:"Industry Insights"}];function w(){let e=(0,i.useRouter)(),r=(0,s.useRef)(null),[a,l]=(0,s.useState)({subject:"",body:"",excerpt:"",category:"workflow-tips",tags:"",metaTitle:"",metaDescription:"",background:{type:"color",value:"#1e40af"},includedInRssFeed:!0}),[n,w]=(0,s.useState)(null),[N,v]=(0,s.useState)(null),[C,S]=(0,s.useState)(!1),[D,T]=(0,s.useState)(!1),[E,Z]=(0,s.use
1State)(null),[_,I]=(0,s.useState)(!1),[B,F]=(0,s.useState)(!1),O=e=>{let{name:r,value:a,type:t,checked:s}=e.target;l(e=>({...e,[r]:"checkbox"===t?s:a}))},P=(e,r)=>{l(a=>({...a,background:{type:e,value:r}}))},L=async e=>{var r;e.preventDefault(),I(!1);let a=null===(r=e.dataTransfer.files)||void 0===r?void 0:r[0];if(!a||!a.type.startsWith("image/")){alert("Please drop an image file");return}await R(a)},R=async e=>{F(!0);try{let t=f(),s=new FormData;s.append("image",e);let d=await fetch("/api/v1/blog/admin/upload-image",{method:"POST",headers:{Authorization:"Bearer ".concat(t)},body:s});if(!d.ok)throw Error("Failed to upload image");let n=(await d.json()).data.image.url,o=r.current;if(o){let e=o.selectionStart,r=o.selectionEnd,t=a.body,s=t.substring(0,e),d=t.substring(r),i="\n![Image](".concat(n,")\n");l(e=>({...e,body:s+i+d})),setTimeout(()=>{o.focus(),o.selectionStart=o.selectionEnd=e+i.length},0)}}catch(e){console.error("Error uploading image:",e),alert("Failed to upload image")}finally{F(!1)}},z=async e=>{var r;let a=null===(r=e.target.files)||void 0===r?void 0:r[0];a&&await R(a)},A=async r=>{if(!a.subject.trim()){Z("Subject is required");return}if(!a.body.trim()||a.body.length<50){Z("Body must be at least 50 characters");return}"published"===r?T(!0):S(!0),Z(null);try{let t=f();if(!t){e.push("/login");return}let s={...a,tags:a.tags.split(",").map(e=>e.trim().toLowerCase()).filter(Boolean),status:r},l=await fetch("/api/v1/blog/admin/posts",{method:"POST",headers:{Authorization:"Bearer ".concat(t),"Content-Type":"application/json"},body:JSON.stringify(s)});if(!l.ok){let e=await l.json();throw Error(e.error||"Failed to create post")}let d=(await l.json()).data.post._id;if(n){let e=new FormData;e.append("image",n),await fetch("/api/v1/blog/admin/posts/".concat(d,"/featured-image"),{method:"POST",headers:{Authorization:"Bearer ".concat(t)},body:e})}e.push("/admin/blog")}catch(e){console.error("Error creating post:",e),Z(e.message)}finally{S(!1),T(!1)}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(d(),{children:[(0,t.jsx)("title",{children:"Create New Post - Blog Admin"}),(0,t.jsx)("meta",{name:"robots",content:"noindex, nofollow"})]}),(0,t.jsx)("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900",children:(0,t.jsxs)("div",{className:"max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-8",children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(o(),{href:"/admin/blog",className:"mr-4 p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200",children:(0,t.jsx)(c.Z,{className:"w-5 h-5"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Create New Post"}),(0,t.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Write a new blog post for BIDOR"})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsxs)("button",{onClick:()=>A("draft"),disabled:C||D,className:"inline-flex items-center px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800 disabled:opacity-50",children:[C?(0,t.jsx)(g.Z,{className:"w-4 h-4 mr-2 animate-spin"}):(0,t.jsx)(x.Z,{className:"w-4 h-4 mr-2"}),"Save Draft"]}),(0,t.jsxs)("button",{onClick:()=>A("published"),disabled:C||D,className:"inline-flex items-center px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50",children:[D?(0,t.jsx)(g.Z,{className:"w-4 h-4 mr-2 animate-spin"}):(0,t.jsx)(b.Z,{className:"w-4 h-4 mr-2"}),"Publish"]})]})]}),E&&(0,t.jsx)("div",{className:"mb-6 p-4 bg-red-50 dark:bg-red-900/50 border border-red-200 dark:border-red-800 rounded-lg text-red-700 dark:text-red-200",children:E}),(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[(0,t.jsxs)("div",{className:"lg:col-span-2 space-y-6",children:[(0,t.jsxs)("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-6",children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Subject *"}),(0,t.jsx)("input",{type:"text",name:"subject",value:a.subject,onChange:O,placeholder:"Enter blog post title...",className:"w-full px-4 py-3 text-xl border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent",maxLength:200}),(0,t.jsxs)("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:[a.subject.length,"/200 characters"]})]}),(0,t.jsxs)("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-6",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Body * (Markdown supp
1orted)"}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsxs)("label",{className:"cursor-pointer inline-flex items-center px-3 py-1 bg-gray-100 dark:bg-gray-700 rounded text-sm text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-600",children:[(0,t.jsx)(m.Z,{className:"w-4 h-4 mr-1"}),"Add Image",(0,t.jsx)("input",{type:"file",accept:"image/*",onChange:z,className:"hidden"})]})})]}),(0,t.jsxs)("div",{className:"relative ".concat(_?"ring-2 ring-blue-500 ring-offset-2":""),onDragOver:e=>{e.preventDefault(),I(!0)},onDragLeave:e=>{e.preventDefault(),I(!1)},onDrop:L,children:[_&&(0,t.jsx)("div",{className:"absolute inset-0 bg-blue-50 dark:bg-blue-900/50 rounded-lg flex items-center justify-center z-10",children:(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)(u.Z,{className:"w-12 h-12 text-blue-500 mx-auto mb-2"}),(0,t.jsx)("p",{className:"text-blue-600 dark:text-blue-400 font-medium",children:"Drop image here"})]})}),B&&(0,t.jsx)("div",{className:"absolute inset-0 bg-white/80 dark:bg-gray-800/80 rounded-lg flex items-center justify-center z-10",children:(0,t.jsx)(g.Z,{className:"w-8 h-8 animate-spin text-blue-600"})}),(0,t.jsx)("textarea",{ref:r,name:"body",value:a.body,onChange:O,placeholder:"Write your blog post content here...  Markdown is supported: # Heading 1 ## Heading 2 **bold** and *italic* - bullet points 1. numbered lists [links](https://example.com) ![images](url)  Drag and drop images anywhere in this editor!",className:"w-full px-4 py-3 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent font-mono text-sm resize-none",rows:20})]}),(0,t.jsxs)("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:[a.body.length," characters (minimum 50)"]})]}),(0,t.jsxs)("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-6",children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Excerpt (optional)"}),(0,t.jsx)("textarea",{name:"excerpt",value:a.excerpt,onChange:O,placeholder:"Brief summary for previews and search results...",className:"w-full px-4 py-3 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none",rows:3,maxLength:500}),(0,t.jsxs)("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:[a.excerpt.length,"/500 characters - Auto-generated if left empty"]})]})]}),(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-6",children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:"Featured Image"}),N?(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("img",{src:N,alt:"Featured",className:"w-full h-40 object-cover rounded-lg"}),(0,t.jsx)("button",{onClick:()=>{w(null),v(null)},className:"absolute top-2 right-2 p-1 bg-red-500 text-white rounded-full hover:bg-red-600",children:(0,t.jsx)(h.Z,{className:"w-4 h-4"})})]}):(0,t.jsxs)("label",{className:"block w-full h-40 border-2 border-dashed border-gray-300 dark:border-gray-600 rounded-lg cursor-pointer hover:border-blue-500 transition-colors",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center h-full",children:[(0,t.jsx)(m.Z,{className:"w-8 h-8 text-gray-400 mb-2"}),(0,t.jsx)("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Click to upload"})]}),(0,t.jsx)("input",{type:"file",accept:"image/*",onChange:e=>{var r;let a=null===(r=e.target.files)||void 0===r?void 0:r[0];a&&(w(a),v(URL.createObjectURL(a)))},className:"hidden"})]})]}),(0,t.jsxs)("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-6",children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Category"}),(0,t.jsx)("select",{name:"category",value:a.category,onChange:O,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500",children:j.map(e=>(0,t.jsx)("option",{value:e.id,children:e.label},e.id))})]}),(0,t.jsxs)("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-6",children:[(0,t.jsxs)("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[(0,t.jsx)(y.Z,{className:"w-4 h-4 inline mr-1"}),"Tags"]}),(0,t.jsx)("input",{type:"text",name:"tags",value:a.tags,onChange:O,placeholder:"automation, workflow, productivity",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500"}),(0,t.jsx)("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"Comma-separated"})]}),(0,t.jsxs)("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-6",children:[(0,t.jsxs)("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:[(0,t.jsx)(p.Z,{className:"w-4 h-4 inline mr-1"}
1),"Background"]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("div",{className:"flex gap-2",children:["color","gradient"].map(e=>(0,t.jsx)("button",{onClick:()=>P(e,"color"===e?"#1e40af":"linear-gradient(135deg, #667eea 0%, #764ba2 100%)"),className:"flex-1 px-3 py-2 text-sm rounded-lg border ".concat(a.background.type===e?"border-blue-500 bg-blue-50 dark:bg-blue-900/50 text-blue-700 dark:text-blue-200":"border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-400"),children:e.charAt(0).toUpperCase()+e.slice(1)},e))}),"color"===a.background.type&&(0,t.jsx)("input",{type:"color",value:a.background.value,onChange:e=>P("color",e.target.value),className:"w-full h-10 rounded cursor-pointer"}),"gradient"===a.background.type&&(0,t.jsx)("input",{type:"text",value:a.background.value,onChange:e=>P("gradient",e.target.value),placeholder:"linear-gradient(...)",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 text-sm"}),(0,t.jsx)("div",{className:"h-16 rounded-lg",style:{background:(a.background.type,a.background.value)}})]})]}),(0,t.jsxs)("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-6",children:[(0,t.jsxs)("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:[(0,t.jsx)(k.Z,{className:"w-4 h-4 inline mr-1"}),"SEO"]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("input",{type:"text",name:"metaTitle",value:a.metaTitle,onChange:O,placeholder:"Meta title (optional)",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 text-sm",maxLength:70}),(0,t.jsxs)("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:[a.metaTitle.length,"/70"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("textarea",{name:"metaDescription",value:a.metaDescription,onChange:O,placeholder:"Meta description (optional)",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 text-sm resize-none",rows:2,maxLength:160}),(0,t.jsxs)("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:[a.metaDescription.length,"/160"]})]})]})]}),(0,t.jsxs)("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-6",children:[(0,t.jsxs)("label",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)("input",{type:"checkbox",name:"includedInRssFeed",checked:a.includedInRssFeed,onChange:O,className:"w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500"}),(0,t.jsx)("span",{className:"ml-2 text-sm text-gray-700 dark:text-gray-300",children:"Include in RSS feed"})]}),(0,t.jsx)("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"Enable for N8N LinkedIn automation"})]})]})]}),(0,t.jsxs)("div",{className:"mt-8 text-center text-sm text-gray-500 dark:text-gray-400",children:["All posts will be signed with: ",(0,t.jsx)("strong",{children:"bidor.ai"})]})]})})]})}}},function(e){e.O(0,[9351,1309,2888,179],function(){return e(e.s=6805)}),_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.