PageSourceSearch

https://reviewslift.ai/assets/dashboard.blog._id-C81XMLZ0.js

js reviewslift.ai collected 2026-10-05 13:58:11 UTC 4,674 bytes, 1 lines download raw bytes

1import{d4 as f,u as b,g as y,r as m,h as w,j as e,bu as k,L as h,G as F,k as N,m as i,I as n,B as g,F as x,d5 as C,d6 as S}from"./index-B3BNobLj.js";import{T as p}from"./textarea-XoulL_ZW.js";const P={title:"",slug:"",excerpt:"",content:"",meta_title:"",meta_description:"",primary_keyword:"",featured_image_url:"",published_at:"",author_name:"ReviewsLift Team"};function L(o){if(!o)return"";const d=new Date(o),l=r=>String(r).padStart(2,"0");return`${d.getFullYear()}-${l(d.getMonth()+1)}-${l(d.getDate())}T${l(d.getHours())}:${l(d.getMinutes())}`}function E(){const{id:o}=f.useParams(),d=b(),l=o==="new",{data:r}=y({queryKey:["admin","blog","post",o],queryFn:()=>S({data:{id:o}}),enabled:!l}),[t,c]=m.useState(P);m.useEffect(()=>{r&&c({title:r.title,slug:r.slug,excerpt:r.excerpt??"",content:r.content,meta_title:r.meta_title??"",meta_description:r.meta_description??"",primary_keyword:r.primary_keyword??"",featured_image_url:r.featured_image_url??"",published_at:L(r.published_at),author_name:r.author_name})},[r]);const u=w({mutationFn:async()=>{const a={title:t.title.trim(),slug:t.slug.trim(),content:t.content,excerpt:t.excerpt||null,meta_title:t.meta_title||null,meta_description:t.meta_description||null,primary_keyword:t.primary_keyword||null,featured_image_url:t.featured_image_url||null,author_name:t.author_name||"ReviewsLift Team",published_at:t.published_at?new Date(t.published_at).toISOString():null};return C({data:{id:l?null:o,post:a}})},onSuccess:()=>{x.success(l?"Post created":"Post saved"),d({to:"/dashboard/blog"})},onError:a=>x.error(a?.message??"Save failed")});function s(a,v){c(j=>({...j,[a]:v}))}function _(){t.slug||!t.title||s("slug",t.title.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80))}return e.jsxs(k,{active:"Blog",children:[e.jsxs("div",{className:"mb-6",children:[e.jsxs(h,{to:"/dashboard/blog",className:"inline-flex items-center text-sm text-muted-foreground hover:text-primary",children:[e.jsx(F,{className:"mr-1 h-4 w-4"})," Back to posts"]}),e.jsx("h1",{className:"mt-2 text-2xl font-bold tracking-tight",children:l?"New Post":"Edit Post"})]}),e.jsx(N,{className:"p-6",children:e.jsxs("div",{className:"grid gap-5",children:[e.jsxs("div",{children:[e.jsx(i,{htmlFor:"title",children:"Title"}),e.jsx(n,{id:"title",value:t.title,onChange:a=>s("title",a.target.value),onBlur:_})]}),e.jsxs("div",{children:[e.jsx(i,{htmlFor:"slug",children:"Slug"}),e.jsx(n,{id:"slug",value:t.slug,onChange:a=>s("slug",a.target.value),placeholder:"e.g. how-to-do-something"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Lowercase letters, numbers, hyphens only."})]}),e.jsxs("div",{children:[e.jsx(i,{htmlFor:"excerpt",children:"Excerpt"}),e.jsx(p,{id:"excerpt",rows:2,value:t.excerpt,onChange:a=>s("excerpt",a.target.value)})]}),e.jsxs("div",{children:[e.jsx(i,{htmlFor:"content",children:"Content (Markdown)"}),e.jsx(p,{id:"content",rows:20,className:"font-mono text-sm",value:t.content,onChange:a=>s("content",a.target.value)})]}),e.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(i,{htmlFor:"featured",children:"Featured Image URL"}),e.jsx(n,{id:"featured",value:t.featured_image_url,onChange:a=>s("featured_image_url",a.target.value),placeholder:"https://…"})]}),e.jsxs("div",{children:[e.jsx(i,{htmlFor:"author",children:"Author Name"}),e.jsx(n,{id:"author",value:t.author_name,onChange:a=>s("author_name",a.target.value)})]})]}),e.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(i,{htmlFor:"metaTitle",children:"Meta Title"}),e.jsx(n,{id:"metaTitle",value:t.meta_title,onChange:a=>s("meta_title",a.target.value)})]}),e.jsxs("div",{children:[e.jsx(i,{htmlFor:"metaDesc",children:"Meta Description"}),e.jsx(n,{id:"metaDesc",value:t.meta_description,onChange:a=>s("meta_description",a.target.value)})]})]}),e.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(i,{htmlFor:"keyword",children:"Primary Keyword"}),e.jsx(n,{id:"keyword",value:t.primary_keyword,onChange:a=>s("primary_keyword",a.target.value)})]}),e.jsxs("div",{children:[e.jsx(i,{htmlFor:"published",children:"Published At (leave blank for draft)"}),e.jsx(n,{id:"published",type:"datetime-local",value:t.published_at,onChange:a=>s("published_at",a.target.value)})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-border pt-5",children:[e.jsx(h,{to:"/dashboard/blog",children:e.jsx(g,{variant:"outline",children:"Cancel"})}),e.jsx(g,{onClick:()=>u.mutate(),disabled:u.isPending||!t.title||!t.slug||!t.content,children:u.isPending?"Saving…":"Save"})]})]})})]})}export{E 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.