1import{r as i,j as e}from"./vendor-react-BQgABvsW.js";import{L as c}from"./vendor-router-CmTf7CvE.js";import{b as m,A as x}from"./index-BehEujNw.js";import{V as _}from"./VoicePostCard-B-SFGirs.js";import{F as N}from"./ContributorAvatar-D49515iG.js";import{M as w}from"./message-square-plus-woVeRcfb.js";import"./vendor-recharts-BTwmqe1U.js";import"./vendor-motion-TVeuYHdg.js";import"./vendor-query-CCcTc5mB.js";import"./vendor-radix-DvwFXcam.js";import"./vendor-maps-PdLGBz8i.js";import"./thumbs-up-BAYTGUW_.js";function H({cityId:a,cityName:r,stateSlug:p,citySlug:u}){const[h,d]=i.useState([]),[s,f]=i.useState("latest"),[b,g]=i.useState(!0);i.useEffect(()=>{a&&m.entities.CityVoicePost.filter({city_id:a,status:"approved"},"-created_date",9).then(d).catch(()=>[]).finally(()=>g(!1))},[a]);async function j(t){await m.entities.CityVoicePost.update(t.id,{helpful_count:(t.helpful_count||0)+1}),d(v=>v.map(l=>l.id===t.id?{...l,helpful_count:(l.helpful_count||0)+1}:l))}const o=h.filter(t=>s==="food"?["food_tip","family_dining","coffee_shop","dessert_spot","budget_meal","local_favorite","brunch_pick"].includes(t.post_type):s==="family"?t.is_family_friendly||t.post_type==="family_recommendation":s==="moving"?t.post_type==="moving_advice"||t.is_newcomer_helpful:!0).slice(0,6),n=`/${p}/${u}/voices`;return e.jsx("section",{id:"city-voices",className:"scroll-mt-20 py-12 sm:py-16",children:e.jsxs("div",{className:"max-w-[1120px] mx-auto px-5 sm:px-8",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-end sm:justify-between gap-4 mb-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-xl",children:"ð£ï¸"}),e.jsx("span",{className:"text-xs font-bold text-blue-600 uppercase tracking-wider",children:"City Voices"})]}),e.jsxs("h2",{className:"text-2xl sm:text-3xl font-bold text-slate-900",children:["What Locals Say About ",r]}),e.jsxs("p",{className:"text-slate-500 text-sm mt-1",children:["Real tips and advice from ",r," residents"]})]}),e.jsxs(c,{to:n,className:"inline-flex items-center gap-2 px-5 py-2.5 bg-blue-600 text-white rounded-xl font-semibold text-sm hover:bg-blue-700 transition-colors whitespace-nowrap",children:[e.jsx(w,{className:"w-4 h-4"})," Share Your Knowledge"]})]}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-6",children:N.slice(0,5).map(t=>e.jsx("button",{onClick:()=>f(t.value),className:`px-3 py-1.5 rounded-full text-xs font-medium border transition-all ${s===t.value?"bg-slate-900 text-white border-slate-900":"bg-white text-slate-600 border-slate-200 hover:border-slate-300"}`,children:t.label},t.value))}),b?e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-4",children:[1,2,3].map(t=>e.jsx("div",{className:"h-48 bg-slate-100 rounded-2xl animate-pulse"},t))}):o.length>0?e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-4",children:o.map(t=>e.jsx(_,{post:t,onHelpful:j,compact:!0},t.id))}):e.jsxs("div",{className:"bg-gradient-to-br from-blue-50 to-slate-50 border border-blue-200 rounded-2xl p-8 text-center",children:[e.jsx("span",{className:"text-4xl mb-3 block",children:"ð£ï¸"}),e.jsx("h3",{className:"font-bold text-slate-800 text-lg mb-2",children:"Be the First Voice"}),e.jsxs("p",{className:"text-slate-500 text-sm mb-4",children:["Share your local knowledge to help newcomers and neighbors discover ",r,"."]}),e.jsxs(c,{to:n,className:"inline-flex items-center gap-2 px-5 py-2.5 bg-blue-600 text-white rounded-xl font-semibold text-sm hover:bg-blue-700 transition-colors",children:["Share a Tip ",e.jsx(x,{className:"w-4 h-4"})]})]}),o.length>0&&e.jsx("div",{className:"text-center mt-6",children:e.jsxs(c,{to:n,className:"inline-flex items-center gap-1.5 text-sm font-semibold text-blue-600 hover:text-blue-700",children:["View all City Voices ",e.jsx(x,{className:"w-4 h-4"})]})})]})})}export{H 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.