PageSourceSearch

https://golfsim.co/assets/review-venue-Dzh_quXh.js

js golfsim.co collected 2026-10-01 23:43:01 UTC 5,944 bytes, 1 lines download raw bytes

1import{c as $,U as V,R as Y,aG as q,Q as G,r as n,X as F,a as I,j as e,L as p,S as N,l,b as d,Z as S,$ as K,a9 as k,a3 as Q,a4 as B,az as D}from"./index-DPvlhSbR.js";import{T as M}from"./textarea-5AWQa9ul.js";import{A as U}from"./arrow-left-BTh5i4r5.js";import{C as O}from"./circle-check-22BWz-Kl.js";import{E as W}from"./external-link-7GMNOEEH.js";function A({value:c,onChange:a}){const[i,u]=n.useState(0);return e.jsx("div",{className:"flex items-center gap-1",children:[1,2,3,4,5].map(t=>e.jsx("button",{type:"button",onMouseEnter:()=>u(t),onMouseLeave:()=>u(0),onClick:()=>a(t),className:"p-0.5 text-accent transition-transform hover:scale-110","aria-label":`Rate ${t} star${t>1?"s":""}`,children:e.jsx(Q,{className:B("w-9 h-9",(i||c)>=t?"fill-current":"fill-none text-muted-foreground/40")})},t))})}function J(){const[,c]=$("/review/:slug"),a=c?.slug||"",{toast:i}=V(),u=Y(),{data:t,isLoading:R,error:C}=q(a,{query:{enabled:!!a,queryKey:D(a)}}),{data:w}=G(a,{query:{enabled:!!a,queryKey:k(a)}}),r=n.useMemo(()=>(w?.reviews??[]).find(s=>s.isOwn),[w]),[m,g]=n.useState(0),[f,b]=n.useState(""),[h,j]=n.useState(""),[o,L]=n.useState(null);n.useEffect(()=>{r&&o===null&&(g(r.rating),b(r.title??""),j(r.body))},[r,o]);const x=F();I({title:t?`Review ${t.name} | Golf Sim Finder`:"Leave a review | Golf Sim Finder",description:"Share your experience at this indoor golf simulator venue. Your review is published on the venue's listing.",robots:"noindex, follow"});const T=s=>{if(s.preventDefault(),m<1){i({title:"Select a rating",description:"Please choose 1 to 5 stars.",variant:"destructive"});return}if(!h.trim()){i({title:"Write a review",description:"Please add a few words about your visit.",variant:"destructive"});return}x.mutate({slug:a,data:{rating:m,title:f.trim()||void 0,body:h.trim(),simTech:r?.simTech??null,visitDate:r?.visitDate??null,photoObjectPaths:r?.photos.map(v=>v.url.replace(/^\/api\/storage/,""))??[]}},{onSuccess:v=>{u.invalidateQueries({queryKey:k(a)}),L(v.rating)},onError:()=>i({title:"Something went wrong",description:"Could not save your review. Please try again.",variant:"destructive"})})};if(R)return e.jsx(p,{children:e.jsxs("div",{className:"max-w-xl mx-auto px-4 py-12",children:[e.jsx(N,{className:"h-8 w-2/3 mb-4"}),e.jsx(N,{className:"h-40 w-full"})]})});if(C||!t)return e.jsx(p,{children:e.jsxs("div",{className:"max-w-xl mx-auto px-4 py-16 text-center",children:[e.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Venue not found"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:"This review link doesn't match a venue in our directory."}),e.jsx(l,{asChild:!0,variant:"outline",children:e.jsx(d,{href:"/",children:"Back to home"})})]})});const y=[{label:"Google",url:t.googleWriteReviewUrl},{label:"Tripadvisor",url:t.reviewLinkTripadvisor},{label:"Yelp",url:t.reviewLinkYelp},{label:"Facebook",url:t.reviewLinkFacebook}].filter(s=>!!s.url),E=t.reviewFunnelThreshold??1,P=o!==null&&o>=E&&y.length>0;return e.jsx(p,{children:e.jsxs("div",{className:"max-w-xl mx-auto px-4 py-10",children:[e.jsxs(d,{href:`/venues/${t.slug}`,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground mb-6",children:[e.jsx(U,{className:"w-4 h-4"})," ",t.name]}),o!==null?e.jsxs("section",{className:"bg-card border rounded-2xl p-6 md:p-8 shadow-lg text-center",children:[e.jsx(O,{className:"w-12 h-12 text-primary mx-auto mb-4"}),e.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Thanks for your review"}),e.jsxs("p",{className:"text-muted-foreground mb-6",children:["Your review is now live on ",t.name,"'s listing."]}),P&&e.jsxs("div",{className:"border-t pt-6 mt-2",children:[e.jsx("p",{className:"font-semibold mb-1",children:"Share your experience elsewhere"}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:["If you have a minute, you can also post a review of"," ",t.name," on these platforms."]}),e.jsx("div",{className:"flex flex-wrap justify-center gap-3",children:y.map(s=>e.jsx(l,{asChild:!0,variant:"outline",children:e.jsxs("a",{href:s.url,target:"_blank",rel:"nofollow noopener noreferrer",children:["Review on ",s.label,e.jsx(W,{className:"w-4 h-4 ml-1.5"})]})},s.label))})]}),e.jsx("div",{className:"mt-6",children:e.jsx(l,{asChild:!0,variant:"ghost",children:e.jsx(d,{href:`/venues/${t.slug}`,children:"See your review on the listing"})})})]}):e.jsxs("section",{className:"bg-card border rounded-2xl p-6 md:p-8 shadow-lg",children:[e.jsxs("h1",{className:"text-2xl font-bold mb-1",children:["How was your visit to ",t.name,"?"]}),e.jsxs("p",{className:"text-muted-foreground mb-6",children:[t.city,", ",t.state," · Your review is published on the venue's public listing."]}),e.jsx(S,{when:"signed-in",children:e.jsxs("form",{onSubmit:T,children:[e.jsx("div",{className:"mb-5",children:e.jsx(A,{value:m,onChange:g})}),e.jsx(K,{className:"mb-3",placeholder:"Title (optional)","aria-label":"Review title (optional)",value:f,maxLength:120,onChange:s=>b(s.target.value)}),e.jsx(M,{className:"mb-5",placeholder:"What did you think? Bays, te
1ch, service, value...","aria-label":`Your review of ${t.name}`,rows:5,value:h,onChange:s=>j(s.target.value)}),e.jsx(l,{type:"submit",className:"w-full",disabled:x.isPending,children:x.isPending?"Saving...":r?"Update review":"Post review"}),r&&e.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center",children:"You've reviewed this venue before — posting updates your existing review."})]})}),e.jsx(S,{when:"signed-out",children:e.jsxs("div",{className:"bg-muted/40 border rounded-xl p-5 text-center",children:[e.jsxs("p",{className:"text-muted-foreground mb-4",children:["Sign in to share your review of ",t.name,". It takes a minute and keeps every review tied to a real visitor."]}),e.jsx(l,{asChild:!0,children:e.jsx(d,{href:`/sign-in?redirect_url=${encodeURIComponent(window.location.pathname)}`,children:"Sign in to review"})})]})})]})]})})}export{J 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.