1import{a as C,d as H,j as e,H as _,L as h,B as j,S as L,s as m}from"./index--q7BMy73.js";import{S as $}from"./SEOHead-BqqI_484.js";import{B as A}from"./badge-pmsJtCT8.js";import{V as B}from"./VerifiedBadge-BuEVfgpB.js";import{D as v}from"./droplets-CNE1LL7z.js";import{A as E}from"./apple-PlCka6iL.js";import{Z as F}from"./zap-S9geZOwx.js";import{H as U}from"./house-CyPr2pkU.js";import"./message-circle-B8GSAMuA.js";const b={well_completion:{icon:v,label:"Well Complete",color:"bg-status-underway text-white"},well_progress:{icon:v,label:"Well Update",color:"bg-status-underway/80 text-white"},nutrition_campaign:{icon:E,label:"Nutrition",color:"bg-accent text-accent-foreground"},disaster_relief:{icon:F,label:"Relief",color:"bg-destructive text-destructive-foreground"},general_update:{icon:U,label:"Update",color:"bg-muted text-muted-foreground"}},Z=()=>{var x,p,u,f;const{slug:n}=C(),{data:i,isLoading:N}=H({queryKey:["impact-event",n],queryFn:async()=>{const{data:r}=await m.rpc("get_impact_event_by_slug",{_slug:n}),s=Array.isArray(r)?r[0]:null;if(!s)return null;let g=null;if(s.field_report_id){const{data:I}=await m.from("field_reports").select("id, whatsapp_message_ids, field_partner_id, report_type, parsed_data, is_verified, verified_by, verified_at, project_id, status, created_at, updated_at, source, external_id, field_partners(name), projects(name, description, program_category, people_served, families_served)").eq("id",s.field_report_id).maybeSingle();g=I}const w=s.partner_company_name?{company_name:s.partner_company_name,company_logo_url:s.partner_company_logo_url}:null,{data:S}=await m.from("field_report_images").select("public_url, caption").eq("field_report_id",s.field_report_id).order("image_order",{ascending:!0});return{...s,field_reports:g,corporate_partners:w,images:S||[]}},enabled:!!n});if(N)return e.jsx("div",{className:"flex min-h-screen items-center justify-center",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})});if(!i)return e.jsxs("div",{className:"flex min-h-screen flex-col items-center justify-center p-8 text-center",children:[e.jsx(_,{className:"h-16 w-16 text-muted-foreground/30"}),e.jsx("h1",{className:"mt-4 font-serif text-2xl font-bold",children:"Impact Update Not Found"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"This impact event may have been moved or is no longer available."}),e.jsx(h,{to:"/",children:e.jsx(j,{className:"mt-6",children:"Visit SevaChild"})})]});const a=i.field_reports,o=a==null?void 0:a.projects,l=i.corporate_partners,t=a==null?void 0:a.parsed_data,c=b[a==null?void 0:a.report_type]||b.general_update,y=c.icon,d=(p=(x=i.images)==null?void 0:x[0])==null?void 0:p.public_url;return e.jsxs(e.Fragment,{children:[e.jsx($,{title:`${(t==null?void 0:t.milestone)||(t==null?void 0:t.village_name)||"Impact Update"} â SevaChild`,description:((u=t==null?void 0:t.description)==null?void 0:u.slice(0,160))||"See the real impact of SevaChild's programs in India.",ogImage:d,canonical:`${L}/impact/${n}`}),e.jsxs("div",{className:"min-h-screen bg-background",children:[d&&e.jsxs("div",{className:"relative h-[50vh] min-h-[300px] w-full",children:[e.jsx("img",{src:d,alt:(t==null?void 0:t.village_name)||"Impact",className:"h-full w-full object-cover"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 to-transparent"}),e.jsxs("div",{className:"absolute bottom-6 left-6 right-6",children:[e.jsxs(A,{className:`${c.color} gap-1`,children:[e.jsx(y,{className:"h-3 w-3"})," ",c.label]}),(t==null?void 0:t.milestone)&&e.jsx("h1",{className:"mt-2 font-serif text-3xl font-bold text-white md:text-4xl",children:t.milestone})]})]}),e.jsxs("div",{className:"container max-w-3xl py-12",children:[l&&e.jsxs("div",{className:"mb-8 flex items-center gap-3 rounded-lg border bg-muted/30 p-4",children:[l.company_logo_url&&e.jsx("img",{src:l.company_logo_url,alt:l.company_name,className:"h-8 w-auto"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.jsx("span",{className:"font-semibold",children:l.company_name})," Ã SevaChild"]})]}),(t==null?void 0:t.village_name)&&e.jsxs("p",{className:"text-sm font-semibold uppercase tracking-wider text-primary",children:[t.village_name,t.district?`, ${t.district}`:"",t.state?`, ${t.state}`:""]}),e.jsx("p",{className:"mt-4 text-lg leading-relaxed text-foreground",children:t==null?void 0:t.description}
1),(a==null?void 0:a.is_verified)&&(a==null?void 0:a.verified_at)&&e.jsx("div",{className:"mt-6",children:e.jsx(B,{variant:"detailed",verifiedAt:a.verified_at,fieldPartnerName:(f=a.field_partners)==null?void 0:f.name,confidenceScore:t==null?void 0:t.confidence_score})}),e.jsxs("div",{className:"mt-8 grid grid-cols-2 gap-4 sm:grid-cols-3",children:[(t==null?void 0:t.beneficiary_count)&&e.jsxs("div",{className:"rounded-lg border p-4 text-center",children:[e.jsx("p",{className:"text-2xl font-bold text-primary",children:t.beneficiary_count.toLocaleString()}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"People Served"})]}),(t==null?void 0:t.families_served)&&e.jsxs("div",{className:"rounded-lg border p-4 text-center",children:[e.jsx("p",{className:"text-2xl font-bold text-primary",children:t.families_served.toLocaleString()}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Families"})]}),(o==null?void 0:o.name)&&e.jsxs("div",{className:"rounded-lg border p-4 text-center",children:[e.jsx("p",{className:"text-sm font-semibold",children:o.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Project"})]})]}),i.images.length>1&&e.jsx("div",{className:"mt-8 grid gap-3 sm:grid-cols-2",children:i.images.slice(1).map((r,s)=>e.jsxs("div",{className:"overflow-hidden rounded-lg",children:[e.jsx("img",{src:r.public_url,alt:r.caption||"Field photo",className:"w-full object-cover",loading:"lazy"}),r.caption&&e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:r.caption})]},s))}),e.jsxs("div",{className:"mt-12 rounded-xl bg-primary/5 p-8 text-center",children:[e.jsx("h2",{className:"font-serif text-2xl font-bold",children:"Support SevaChild"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"Help us bring clean water, nutrition, and safety to more communities in India."}),e.jsx(h,{to:"/donate",children:e.jsxs(j,{size:"lg",className:"mt-4 gap-2",children:["Give Now ",e.jsx(_,{className:"h-4 w-4"})]})})]}),e.jsx("p",{className:"mt-8 text-center text-xs text-muted-foreground",children:"SevaChild is a registered 501(c)(3) nonprofit. EIN: 27-2259641."})]})]})]})};export{Z 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.