PageSourceSearch

https://bci-edu-6qu8apwz.manus.space/assets/AdminSEO-_k9fOfXr.js

js bci-edu-6qu8apwz.manus.space collected 2026-10-03 05:00:48 UTC 12,460 bytes, 1 lines download raw bytes

1import{j as e}from"./trpc-vendor-Bv0iaNDN.js";import{r as m}from"./react-vendor-CGOjsTCb.js";import{A as G}from"./AdminLayout-BvvhRFUw.js";import{t as g,i as n,X as T,G as F}from"./index-Bp5xQ-En.js";import{u as D}from"./forms-CoKEKBDA.js";import{U as R}from"./upload-BH8nrjRt.js";import{I as z}from"./image-NXvCck6X.js";import{S as M}from"./square-pen-tpyoT_BD.js";import"./bell-DDfP3iQl.js";import"./message-square-D7ASK-H8.js";import"./graduation-cap-DtyfmjZD.js";import"./phone-call-DR-uxlHF.js";import"./radix-vendor-BsQgJgbQ.js";import"./charts-DUKIMxkY.js";const j=[{slug:"home",label:"Home Page"},{slug:"about",label:"About Us"},{slug:"programmes",label:"Programmes"},{slug:"admissions",label:"Admissions"},{slug:"student-life",label:"Student Life"},{slug:"parents-students",label:"Parents & Students"},{slug:"gallery",label:"Gallery"},{slug:"careers",label:"Careers"},{slug:"contact",label:"Contact Us"},{slug:"news",label:"News & Announcements"},{slug:"policies",label:"Policies"},{slug:"fee-protection",label:"Fee Protection Scheme"},{slug:"student-support",label:"Student Support Services"},{slug:"medical-insurance",label:"Medical Insurance"},{slug:"student-contract",label:"Student Contract"}];function ee(){const[i,x]=m.useState(null),[f,t]=m.useState(""),[y,p]=m.useState(!1),O=m.useRef(null),E=g.useUtils(),{data:v}=g.seo.getAll.useQuery(),u=g.seo.upsert.useMutation({onSuccess:()=>{E.seo.getAll.invalidate(),x(null),n.success("SEO settings saved!")},onError:()=>n.error("Failed to save SEO settings.")}),b=g.seo.uploadOgImage.useMutation({onSuccess:s=>{l("ogImage",s.url),t(s.url),E.seo.getAll.invalidate(),n.success("OG image uploaded!")},onError:()=>n.error("Failed to upload OG image.")}),{register:r,handleSubmit:N,reset:w,setValue:l,watch:I}=D({defaultValues:{seoTitle:"",seoDescription:"",seoKeywords:"",ogImage:""}}),h=I("ogImage"),A=s=>v?.find(a=>a.pageSlug===s),P=s=>{const a=A(s);l("seoTitle",a?.seoTitle||""),l("seoDescription",a?.seoDescription||""),l("seoKeywords",a?.seoKeywords||""),l("ogImage",a?.ogImage||""),t(a?.ogImage||""),x(s)},k=async s=>{i&&await u.mutateAsync({pageSlug:i,...s})},C=async s=>{if(!i)return;const a=s.target.files?.[0];if(!a)return;if(!a.type.startsWith("image/")){n.error("Please select an image file.");return}if(a.size>5*1024*1024){n.error("Image must be under 5MB.");return}p(!0);const c=new FileReader;c.onerror=()=>{p(!1),n.error("Failed to read image file.")},c.onload=async S=>{const d=S.target?.result;t(d);try{await b.mutateAsync({pageSlug:i,fileDataUrl:d,fileName:a.name,mimeType:a.type})}catch{t("")}finally{p(!1)}},c.readAsDataURL(a),s.target.value=""},U=()=>{l("ogImage",""),t("")};return e.jsx(G,{"data-loc":"client/src/pages/admin/AdminSEO.tsx:112",title:"SEO Settings",children:e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:113",className:"space-y-5",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:114",children:[e.jsx("h1",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:115",className:"text-xl font-bold text-gray-900",children:"SEO Settings"}),e.jsx("p",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:116",className:"text-sm text-gray-500 mt-0.5",children:"Set meta title, description, keywords, and social share image for each page."})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:120",className:"bg-blue-50 border border-blue-200 rounded-xl p-4 text-sm text-blue-800",children:[e.jsx("strong",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:121",children:"SEO Tips:"})," Keep titles under 60 characters and descriptions under 160 characters. Use relevant keywords naturally. Each page should have a unique title and description. OG images should be 1200×630px for best social sharing results."]}),i&&e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:126",className:"bg-white rounded-xl border border-bci/30 shadow-sm p-6",children:[e.jsxs("h2",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:127",className:"font-semibold text-gray-900 mb-1",children:["Editing: ",j.find(s=>s.slug===i)?.label]}),e.jsxs("p",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:130",className:"text-xs text-gray-400 mb-5",children:["/",i]}),e.jsxs("form",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:131",onSubmit:N(k),className:"space-y-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:132",children:[e.jsxs("label",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:133",className:"block text-sm font-medium text-gray-700 mb-1.5",children:["SEO Title ",e.jsx("span",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:134",className:"text-gray-400 font-normal",children:"(max 60 chars)"})]}),e.jsx("input",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:136",...r("seoTitle"),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-bci/30 focus:border-bci",placeholder:"e.g. BCI – Quality Education in Singapore"})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:138",children:[e.jsxs("label",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:139",className:"block text-sm font-medium text-gray-700 mb-1.5",children:["Meta Description ",e.jsx("span",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:140",className:"text-gray-400 font-normal",children:"(max 160 chars)"})]}),e.jsx("textarea",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:142",...r("seoDescription"),rows:3,className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-bci/30 focus:border-bci resize-none",placeholder:"Brief description of this page for search engines..."})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:144",children:[e.jsx("label",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:145",className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Keywords"}),e.jsx("input",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:146",...r("seoKeywords"),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-bci/30 focus:border-bci",placeholder:"e.g. Singapore private school, international education, BCI"})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:150",children:[e.jsxs("label",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:151",className:"block text-sm font-medium text-gray-700 mb-1.5",children:["OG Image ",e.jsx("span",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:152",className:"text-gray-400 font-normal",children:"(Social Share Image — recommended 1200×630px)"})]}),(f||h)&&e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:157",className:"relative mb-3 rounded-lg overflow-hidden border border-gray-200 bg-gray-50",style:{maxWidth:400},children:[e.jsx("img",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:158",src:f||h,alt:"OG image preview",className:"w-full object-cover",style:{aspectRatio:"1200/630"},onError:()=>t("")}),e.jsx("button",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:165",type:"button",onClick:U,className:"absolute top-2 right-2 bg-white/90 hover:bg-white rounded-full p-1 shadow text-gray-600 hover:text-red-500 transition-colors",title:"Remove OG image",children:e.jsx(T,{"data-loc":"client/src/pages/admin/AdminSEO.tsx:171",size:14})}),e.jsx("div",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:173",className:"absolute bottom-0 left-0 right-0 bg-black/40 text-white text-xs px-2 py-1 truncate",children:h})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:180",className:"flex gap-2",children:[e.jsx("div",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:181",className:"flex-1",children:e.jsx("input",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:182",...r("ogImage"),onChange:s=>{r("ogImage").onChange(s),t(s.target.value)},className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-bci/30 focus:border-bci",placeholder:"https://... or upload an image →"})}),e.jsx("button",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:192",type:"button",onClick:()=>O.current?.click(),disabled:y||b.isPending,className:"flex items-center gap-1.5 px-4 py-2 bg-gray-100 hover:bg-gray-200 border border-gray-300 text-gray-700 text-sm font-medium rounded-lg transition-colors disabled:opacity-50 shrink-0",children:y||b.isPending?e.jsxs("span",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:199",className:"flex items-center gap-1.5",children:[e.jsx("span",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:199",className:"w-3 h-3 border-2 border-gray-400 border-t-transparent roun
1ded-full animate-spin"}),"Uploading..."]}):e.jsxs(e.Fragment,{children:[e.jsx(R,{"data-loc":"client/src/pages/admin/AdminSEO.tsx:201",size:14})," Upload Image"]})}),e.jsx("input",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:204",ref:O,type:"file",accept:"image/*",className:"hidden",onChange:C})]}),e.jsx("p",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:212",className:"text-xs text-gray-400 mt-1.5",children:"Upload a JPG/PNG (max 5MB) or paste a direct image URL. This image appears when sharing on WhatsApp, Facebook, WeChat, etc."})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:215",className:"flex gap-3",children:[e.jsx("button",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:216",type:"submit",disabled:u.isPending,className:"px-5 py-2.5 bg-bci text-white text-sm font-medium rounded-lg hover:bg-bci-dark transition-colors disabled:opacity-50",children:u.isPending?"Saving...":"Save SEO Settings"}),e.jsx("button",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:220",type:"button",onClick:()=>{x(null),w(),t("")},className:"px-5 py-2.5 border border-gray-300 text-gray-700 text-sm font-medium rounded-lg hover:bg-gray-50 transition-colors",children:"Cancel"})]})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:230",className:"bg-white rounded-xl border border-gray-200 shadow-sm overflow-hidden",children:[e.jsx("div",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:231",className:"p-4 border-b border-gray-100 bg-gray-50",children:e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:232",className:"flex items-center gap-2 text-sm font-semibold text-gray-700",children:[e.jsx(F,{"data-loc":"client/src/pages/admin/AdminSEO.tsx:233",size:16,className:"text-bci"})," All Pages SEO Status"]})}),e.jsx("div",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:236",className:"divide-y divide-gray-100",children:j.map(s=>{const a=A(s.slug),c=!!a?.seoTitle,S=!!a?.seoDescription,d=!!a?.ogImage,o=(c?40:0)+(S?40:0)+(d?20:0);return e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:244",className:"flex items-center gap-4 p-4 hover:bg-gray-50 transition-colors",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:245",className:"flex-1 min-w-0",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:246",className:"flex items-center gap-2",children:[e.jsx("span",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:247",className:"font-medium text-gray-900 text-sm",children:s.label}),d&&e.jsxs("span",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:249",className:"inline-flex items-center gap-0.5 text-xs text-purple-600 bg-purple-50 px-1.5 py-0.5 rounded-full",children:[e.jsx(z,{"data-loc":"client/src/pages/admin/AdminSEO.tsx:250",size:10})," OG"]})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:254",className:"text-xs text-gray-400",children:["/",s.slug]}),a?.seoTitle&&e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:255",className:"text-xs text-gray-500 mt-0.5 truncate",children:["Title: ",a.seoTitle]})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:257",className:"flex items-center gap-3 shrink-0",children:[e.jsx("div",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:258",className:`text-xs font-semibold px-2.5 py-1 rounded-full ${o===100?"bg-green-50 text-green-700":o>=40?"bg-yellow-50 text-yellow-700":"bg-red-50 text-red-600"}`,children:o===100?"✓ Complete":o>=40?`⚠ ${o}%`:"✗ Missing"}),e.jsxs("button",{"data-loc":"client/src/pages/admin/AdminSEO.tsx:261",onClick:()=>P(s.slug),className:"flex items-center gap-1.5 px-3 py-1.5 border border-gray-300 text-gray-600 text-xs font-medium rounded-lg hover:border-bci hover:text-bci transition-colors",children:[e.jsx(M,{"data-loc":"client/src/pages/admin/AdminSEO.tsx:263",size:12})," Edit"]})]})]},s.slug)})})]})]})})}export{ee 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.