1import{F as j,r as s,ak as d,j as e,L as c,V as b}from"./index-BumohzBS.js";import{u as f}from"./useMutation-CnNyVA22.js";import{u as y}from"./auth-middleware-BWJI7Br7.js";import{I as N}from"./input-Ciw1zM7f.js";import{L as r}from"./label-43qKV7bp.js";import{T as w}from"./textarea-DbWMWPIg.js";import{x as C}from"./cms.functions-CBxjVF-m.js";function M(){const u=j(),[i,m]=s.useState(""),[n,x]=s.useState("Insights"),[o,p]=s.useState(""),[l,h]=s.useState(""),g=y(C),a=f({mutationFn:()=>g({data:{title:i,excerpt:l||null,category:n,division:o||null,read_time:5,status:"draft",published_at:null}}),onSuccess:t=>{d.success("Draft created"),u({to:"/admin/insights/$id",params:{id:t.id}})},onError:t=>d.error(t.message)}),v=t=>{t.preventDefault(),a.mutate()};return e.jsxs("div",{children:[e.jsxs(c,{to:"/admin/insights",className:"inline-flex items-center gap-1.5 text-xs uppercase tracking-wider text-muted-foreground hover:text-primary mb-4",children:[e.jsx(b,{className:"w-3.5 h-3.5"})," Back to insights"]}),e.jsx("h1",{className:"text-2xl font-semibold mb-1",children:"New article"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"Start with the basics â the article is saved as a draft and you can write, preview and publish it on the next screen."}),e.jsxs("form",{onSubmit:v,className:"bg-white border border-border rounded-lg p-6 space-y-5 max-w-3xl",children:[e.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2 sm:col-span-2",children:[e.jsx(r,{htmlFor:"title",children:"Title *"}),e.jsx(N,{id:"title",required:!0,value:i,onChange:t=>m(t.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"category",children:"Type *"}),e.jsxs("select",{id:"category",required:!0,value:n,onChange:t=>x(t.target.value),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 text-sm",children:[e.jsx("option",{value:"Insights",children:"Insights"}),e.jsx("option",{value:"Market Overview",children:"Market Overview"}),e.jsx("option",{value:"In the Press",children:"In the Press"}),e.jsx("option",{value:"News",children:"News"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"division",children:"Entity"}),e.jsxs("select",{id:"division",value:o,onChange:t=>p(t.target.value),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 text-sm",children:[e.jsx("option",{value:"",children:"Not set"}),e.jsx("option",{value:"FP",children:"Financial Planning"}),e.jsx("option",{value:"AM",children:"Asset Management"}),e.jsx("option",{value:"Corporate",children:"Corporate Benefits"}),e.jsx("option",{value:"Group",children:"Bowmore Group"})]})]}),e.jsxs("div",{className:"space-y-2 sm:col-span-2",children:[e.jsx(r,{htmlFor:"excerpt",children:"Excerpt"}),e.jsx(w,{id:"excerpt",rows:3,value:l,onChange:t=>h(t.target.value)})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-4 border-t border-border",children:[e.jsx("span",{className:"mr-auto text-xs text-muted-foreground",children:"Saved as a draft â nothing goes live until you publish."}),e.jsx(c,{to:"/admin/insights",className:"px-5 py-2 text-xs uppercase tracking-widest text-muted-foreground",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:a.isPending,className:"bg-primary text-primary-foreground px-5 py-2 text-xs uppercase tracking-widest font-semibold hover:bg-secondary transition-colors disabled:opacity-50",children:a.isPending?"Creatingâ¦":"Create draft"})]})]})]})}export{M as component};
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.