1import{Q as U}from"./QuillEditor-CUkK7by5.js";import{I as _}from"./ImageUploadModal-BKHmxas9.js";import{S as I}from"./SubmitButton-CwcskGz4.js";import{F as V}from"./Simple-BLjuFar5.js";import{_ as E,c as a,a as t,d as u,t as p,j as n,k as d,p as M,F as f,i as T,e as g,g as x,f as h,b as y,w as R,s as b,h as B,m as F,r as c,u as D,o as i}from"./app-D-cVr9vr.js";import{b as k}from"./apiPost-C4xD0A-h.js";import"./_commonjsHelpers-BosuxZz1.js";import"./uploadPolicy-D7ZjK_Wu.js";import"./CloseModalIcon-CNsUOfZc.js";import"./getCSRF-7MinvhD0.js";const A={components:{QuillEditor:U,ImageUploadModal:_,SubmitButton:I,Footer:V},data(){return{article:null,error:"",imageError:"",confirmations:{written:!1,images:!1,accurate:!1},termsError:null,config:window.config,editorKey:0,categories:window.articleCategories||[],toolbar:[{header:[2,3,!1]},"bold","italic","underline","strike","blockquote","code-block",{list:"ordered"},{list:"bullet"},"link"],bioToolbar:["bold","italic","link"]}},computed:{...F(D),isLocal(){var s,e;return((e=(s=this.config)==null?void 0:s.global)==null?void 0:e.appEnv)==="local"},confirmed(){return Object.values(this.confirmations).every(Boolean)}},watch:{confirmed(s){s&&this.termsError&&(this.termsError=null)}},async mounted(){var e;const s=await B("/articles/mine-data",{},this.sideprojectorsStore.getToken);this.article=(e=s==null?void 0:s.body)==null?void 0:e.find(m=>m.id==this.$route.params.id),this.article||this.$router.push({name:"articles-mine"})},methods:{showCoverModal(){this.$vfm.show("image-upload-modal",{purpose:"description-image",column:"cover_image",image:this.article.cover_image,postSubmit:s=>{this.article.cover_image=s.image}})},fillDummy(){var e;const s=["<h2>Why I started charging for my side project</h2>","<p>"+"I spent two years giving the thing away and telling myself the audience would convert eventually. ".repeat(4)+"</p>","<h3>What changed</h3>","<p>"+"The first paid plan went up on a Tuesday and nobody complained, which was its own kind of answer. ".repeat(4)+"</p>","<ul><li>Pick a number and publish it.</li><li>Grandfather the people who were there early.</li><li>Say what the money pays for.</li></ul>","<p>"+"A year later the revenue is not life changing, but it covers the hosting and it changed how I treat the work. ".repeat(4)+"</p>"].join("");Object.assign(this.article,{title:"Why I started charging for my side project",category:this.categories[0],cover_image:"https://picsum.photos/seed/sideprojectors/1200/600",body:s,author_name:((e=this.sideprojectorsStore.getCurrUser)==null?void 0:e.username)||"Alex Maker",author_bio:"<p>Maker of small things. Writing about <b>pricing</b>, churn and the parts nobody posts about.</p>",company_name:"Acme Software",company_url:"https://example.com",linkedin_url:"https://linkedin.com/in/example",x_url:"https://x.com/example"}),this.confirmations={written:!0,images:!0,accurate:!0},this.termsError=null,this.error="",this.editorKey++},async save(){var e,m;const s=await k(`/articles/${this.article.id}/save`,this.article,this.sideprojectorsStore.getToken);return this.error=s.ok?"Saved.":((e=s.body)==null?void 0:e.message)||((m=s.body)==null?void 0:m.error)||"Could not save.",s.ok},async submit(){var e;if(!this.confirmed){this.termsError="Please check all three boxes before submitting.";return}if(!await this.save())return;const s=await k(`/articles/${this.article.id}/submit`,{confirmed:!0},this.sideprojectorsStore.getToken);s.ok?this.$router.push({name:"article-submitted"}):this.error=((e=s.body)==null?void 0:e.error)||"Could not submit."}}},L={key:0,class:"max-w-4xl mx-auto px-6 lg:px-8 mt-12"},W={class:"lg:flex lg:items-center lg:justify-between"},P={class:"mt-4 lg:mt-0 ml-2 lg:ml-0 flex items-center space-x-4"},q={class:"px-3 py-1 rounded-full bg-gray-200 dark:bg-gray-700 dark:text-white text-sm capitalize"},K={key:0,class:"mt-4 p-4 rounded border bg-gray-100 border-gray-300 dark:bg-gray-700 dark:border-gray-600 dark:text-white"},N={class:"mt-2 text-sm"},Q={class:"mt-4 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 p-6 rounded-lg"},z={class:"form-line"},G={class:"form-line"},O={class:"mt-2 flex items-start space-x-2"},H={key:0,class:"bg-gray-200 dark:bg-gray-700 p-2 rounded-lg"},X=["src"],Y={class:"mt-1 text-center space-x-3"},J={class:"form-line"},Z={class:"form-line"},$={class:"form-line"},ee={class:"form-line grid md:grid-cols-2 gap-3"},te={class:"form-line grid md:grid-cols-2 gap-3"},re={class:"label-line"},oe={class:"form-line flex items-start bg-gray-200 dark:bg-gray-700 p-2 rounded-lg"},se={class:"form-line flex items-start bg-gray-200 dark:bg-gray-700 p-2 rounded-lg"},ie={class:"form-line flex items-start bg-gray-200 dark:bg-gray-700 p-2 rounded-lg"},le={key:0,class:"input-error"},ae={key:1,class:"input-error text-sm"},ne={class:"button-line"},de={class:"text-center mt-4"},me={class:"mt-6"};function ue(s,e,m,pe,r,l){const v=c("QuillEditor"),w=c("router-link"),C=c("SubmitButton"),S=c("Footer"),j=c("ImageUploadModal");return i(),a(f,null,[r.article?(i(),a("div",L,[t("div",W,[e[18]||(e[18]=t("div",{class:"ml-2"},[t("div",{class:"text-lg dark:text-white"},"ð  Write your article"),t("div",{class:"mt-1 text-sm text-gray-500 dark:text-gray-400"},"Save a draft, preview it, then submit it for editorial review.")],-1)),t("div",P,[l.isLocal?(i(),a("button",{key:0,onClick:e[0]||(e[0]=(...o)=>l.fillDummy&&l.fillDummy(...o)),class:"px-3 py-1 rounded border border-dashed border-gray-400 text-gray-500 dark:text-gray-300 text-sm"}," Debug: fill dummy article ")):u("",!0),t("span",q,p(r.article.status.replace("_"," ")),1)])]),r.article.review_notes?(i(),a("div",K,[e[19]||(e[19]=t("div",{class:"flex items-center text-gray-700 dark:text-white"},"âï¸ Â Editor note",-1)),t("div",N,p(r.article.review_notes),1)])):u("",!0),t("div",Q,[e[31]||(e[31]=t("div",{class:"flex items-center justify-between"},[t("div",null,"Title"),t("div",{class:"text-red-400 text-sm"},"Required")],-1)),t("div",z,[n(t("input",{type:"text","onUpdate:modelValue":e[1]||(e[1]=o=>r.article.title=o),maxlength:"140",class:"input-standard"},null,512),[[d,r.article.title]])]),e[32]||(e[32]=t("div",{class:"label-line"},"Category",-1)),t("div",G,[n(t("select",{"onUpdate:modelValue":e[2]||(e[2]=o=>r.article.category=o),class:"select-standard"},[(i(!0),a(f,null,T(r.categories,o=>(i(),a("option",{key:o},p(o),1))),128))],512),[[M,r.article.category]])]),e[33]||(e[33]=t("div",{class:"label-line"},[t("label",null,"Cover image"),t("span",{class:"text-sm text-gray-500 dark:text-gray-400 ml-2"},"Recommended minimum size: 1200x600")],-1)),t("div",O,[r.article.cover_image?(i(),a("div",H,[t("img",{src:r.article.cover_image,class:"w-64 max-w-full rounded-lg"},null,8,X),t("div",Y,[t("a",{href:"#",onClick:e[3]||(e[3]=g((...o)=>l.showCoverModal&&l.showCoverModal(...o),["prevent"])),class:"text-gray-500 dark:text-gray-400 text-xs hover:underline"},"Change"),t("a",{href:"#",onClick:e[4]||(e[4]=g(o=>r.article.cover_image=null,["prevent"])),class:"text-gray-500 dark:text-gray-400 text-xs hover:underline"},"Delete")])])):(i(),a("a",{key:1,href:"#",onClick:e[5]||(e[5]=g((...o)=>l.showCoverModal&&l.showCoverModal(...o),["prevent"])),class:"block"},e[20]||(e[20]=[t("div",{class:"border-2 border-dashed border-gray-300 dark:border-gray-600 rounded-lg p-2 hover:border-gray-400 dark:hover:border-gray-500 transition-colors cursor-pointer w-32 flex flex-col items-center justify-center",style:{height:"88px"}},[t("div",{class:"text-gray-400 dark:text-gray-500 flex-1 flex items-center justify-center"},[t("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})])])],-1)])))]),e[34]||(e[34]=t("div",{class:"label-line flex items-center justify-between"},[t("div",null,"Article body"),t("div",{class:"text-red-400 text-sm"},"Required")],-1)),t("div",J,[(i(),x(v,{key:"body-"+r.editorKey,modelValue:r.article.body,"onUpdate:modelValue":e[6]||(e[6]=o=>r.article.body=o),"editor-id":"article-editor","min-height":420,toolbar:r.toolbar,"image-upload":!0,"upload-user-id":s.sideprojectorsStore.getCurrUser.id,"upload-token":s.sideprojectorsStore.getToken,error:r.imageError,onUploadError:e[7]||(e[7]=o=>r.imageError=o)},null,8,["modelValue","toolbar","upload-user-id","upload-token","error"]))]),e[35]||(e[35]=t("div",{class:"label-line flex items-center justify-between"},[t("div",null,"Author name"),t("div",{class:"text-red-400 text-sm"},"Required")],-1)),t("div",Z,[n(t("input",{type:"text","onUpdate:modelValue":e[8]||(e[8]=o=>r.article.author_name=o),maxlength:"120",class:"input-standard"},null,512),[[d,r.article.author_name]])]),e[36]||(e[36]=t("div",{class:"label-line"},"Author bio",-1)),t("div",$,[(i(),x(v,{key:"bio-"+r.editorKey,modelValue:r.article.author_bio,"onUpdate:modelValue":e[9]||(e[9]=o=>r.article.author_bio=o),"editor-id":"article-author-bio","min-height":120,toolbar:r.bioToolbar},null,8,["modelValue","toolbar"]))]),e[37]||(e[37]=t("div",{class:"label-line"},"Your profiles - optional",-1)),t("div",ee,[t("div",null,[e[21]||(e[21]=t("div",{class:"sub-label text-sm"},"LinkedIn Profile",-1)),n(t("input",{type:"text","onUpdate:modelValue":e[10]||(e[10]=o=>r.article.linkedin_url=o),maxlength:"512",placeholder:"https://linkedin.com/in/â¦",class:"input-standard mt-1"},null,512),[[d,r.article.linkedin_url]])]),t("div",null,[e[22]||(e[22]=t("div",{class:"sub-label text-sm"},"X/Twitter handle or page",-1)),n(t("input",{type:"text","onUpdate:modelValue":e[11]||(e[11]=o=>r.article.x_url=o),maxlength:"512",placeholder:"https://x.com/â¦",class:"input-standard mt-1"},null,512),[[d,r.article.x_url]])])]),e[38]||(e[38]=t("div",{class:"label-line"},"Company - optional",-1)),e[39]||(e[39]=t("div",{class:"sub-label text-sm"},"If you are associated with a company, please add its name and URL.",-1)),t("div",te,[t("div",null,[e[23]||(e[23]=t("div",{class:"sub-label text-sm"},"Company name",-1)),n(t("input",{type:"text","onUpdate:modelValue":e[12]||(e[12]=o=>r.article.company_name=o),maxlength:"120",class:"input-standard mt-1"},null,512),[[d,r.article.company_name]])]),t("div",null,[e[24]||(e[24]=t("div",{class:"sub-label text-sm"},"Company URL",-1)),n(t("input",{type:"text","onUpdate:modelValue":e[13]||(e[13]=o=>r.article.company_url=o),maxlength:"512",placeholder:"https://company.com",class:"input-standard mt-1"},null,512),[[d,r.article.company_url]])])]),t("div",re,[e[26]||(e[26]=h(" Ready to submit? Please check the boxes below to confirm that this article is yours to publish, that its images are cleared, and that you comply with all terms & services. Unsure about any of them? Read the ")),y(w,{to:{name:"help-article-guidelines"},target:"_blank",class:"text-blue-500 hover:underline"},{default:R(()=>e[25]||(e[25]=[h("sponsored article guidelines")])),_:1,__:[25]}
1),e[27]||(e[27]=h(". "))]),t("label",oe,[n(t("input",{type:"checkbox","onUpdate:modelValue":e[14]||(e[14]=o=>r.confirmations.written=o),class:"mr-2 mt-1 shrink-0"},null,512),[[b,r.confirmations.written]]),e[28]||(e[28]=t("span",{class:"text-gray-600 dark:text-gray-300"},"I declare that this article is my own work and has not been published anywhere else",-1))]),t("label",se,[n(t("input",{type:"checkbox","onUpdate:modelValue":e[15]||(e[15]=o=>r.confirmations.images=o),class:"mr-2 mt-1 shrink-0"},null,512),[[b,r.confirmations.images]]),e[29]||(e[29]=t("span",{class:"text-gray-600 dark:text-gray-300"}," I declare that every image, the cover included, is one I made, one I hold the copyright to, one the copyright holder has permitted me to publish here, or one licensed for commercial use whose terms I have met â and that none are taken from a search engine or a site I have no licence from ",-1))]),t("label",ie,[n(t("input",{type:"checkbox","onUpdate:modelValue":e[16]||(e[16]=o=>r.confirmations.accurate=o),class:"mr-2 mt-1 shrink-0"},null,512),[[b,r.confirmations.accurate]]),e[30]||(e[30]=t("span",{class:"text-gray-600 dark:text-gray-300"}," I declare that the claims, figures and screenshots are truthful and unedited, that any commercial or affiliate relationship is disclosed in the article, and that I comply with all terms & services ",-1))]),r.termsError?(i(),a("div",le,p(r.termsError),1)):u("",!0),r.error?(i(),a("div",ae,p(r.error),1)):u("",!0),t("div",ne,[y(C,{isFullWidth:!0,isRounded:!0,onClick:l.submit,label:"Submit for review"},null,8,["onClick"]),t("div",de,[t("a",{href:"#",class:"text-sm text-gray-500 dark:text-gray-400 hover:underline",onClick:e[17]||(e[17]=g((...o)=>l.save&&l.save(...o),["prevent"]))},"Save draft")])])]),t("div",me,[y(S)])])):u("",!0),y(j,{userId:s.sideprojectorsStore.getCurrUser.id,token:s.sideprojectorsStore.getToken},null,8,["userId","token"])],64)}const Ce=E(A,[["render",ue]]);export{Ce 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.