PageSourceSearch

https://domain-discover-tool.lovable.app/assets/requirements.index-DDwYkglO.js

js domain-discover-tool.lovable.app collected 2026-10-03 03:22:21 UTC 5,141 bytes, 1 lines download raw bytes

1import{a_ as _,m as g,a$ as R,r,s as b,aE as T,t as j,j as e,H as k,B as i,L as m,h as x,Y as f,b0 as S,b1 as C,b2 as B,b3 as F,aF as L,F as A}from"./index-DUiXJ36l.js";import{T as D,a as E,b as y,c as N}from"./tabs-DZgkHC4v.js";import{r as H,a as P}from"./requirement-responses.functions-ZRI-W-7q.js";function z(){const{tab:v}=_.useSearch(),{data:o,isLoading:q}=g({queryKey:["requirements","all"],queryFn:()=>R({data:{}})}),[n,u]=r.useState(!1);r.useEffect(()=>{b.auth.getSession().then(({data:h})=>u(!!h.session));const{data:{subscription:s}}=b.auth.onAuthStateChange((h,w)=>u(!!w));return()=>s.unsubscribe()},[]);const a=g({queryKey:["requirements","inbox"],queryFn:()=>H(),enabled:n}),[t,d]=r.useState(null),[l,p]=r.useState(""),c=T({mutationFn:()=>P({data:{requirement_id:t.id,message:l}}),onSuccess:()=>{j.success("Response sent"),d(null),p("")},onError:s=>j.error(s.message)});return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(k,{}),e.jsxs("main",{className:"mx-auto max-w-5xl px-4 py-8 sm:px-6",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:"Buyer requirements"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Active property searches. Match your listing to a real buyer."})]}),e.jsx(i,{asChild:!0,children:e.jsx(m,{to:"/requirements/new",children:"Post your requirement"})})]}),e.jsxs(D,{defaultValue:v==="inbox"&&n?"inbox":"browse",className:"mt-8",children:[e.jsxs(E,{children:[e.jsx(y,{value:"browse",children:"Browse requirements"}),n&&e.jsxs(y,{value:"inbox",children:["Responses received",a.data?.length?` (${a.data.length})`:""]})]}),e.jsx(N,{value:"browse",children:e.jsx("div",{className:"overflow-hidden rounded-2xl border border-border bg-card",children:q?e.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"Loading…"}):!o||o.length===0?e.jsx("p",{className:"p-8 text-center text-sm text-muted-foreground",children:"No active requirements yet — be the first to post."}):e.jsx("ul",{className:"divide-y divide-border",children:o.map(s=>e.jsxs("li",{className:"p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-2",children:[e.jsx("span",{className:"rounded-full bg-primary/15 px-2 py-0.5 text-xs font-semibold uppercase text-primary",children:s.category}),s.bhk?e.jsxs("span",{className:"text-sm font-semibold",children:[s.bhk," BHK"]}):null,s.localities?.name&&e.jsxs("span",{className:"text-sm",children:["in ",s.localities.name]}),s.cities?.name&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:["· ",s.cities.name]}),e.jsx("div",{className:"ml-auto",children:n?e.jsx(i,{size:"sm",variant:"outline",onClick:()=>d(s),children:"Respond"}):e.jsx(i,{size:"sm",variant:"outline",asChild:!0,children:e.jsx(m,{to:"/auth",children:"Sign in to respond"})})})]}),e.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:[(s.min_budget||s.max_budget)&&e.jsxs(e.Fragment,{children:["Budget ",x(Number(s.min_budget??0))," – ",x(Number(s.max_budget??0))," · "]}),(s.min_area||s.max_area)&&e.jsxs(e.Fragment,{children:["Area ",s.min_area??0,"–",s.max_area??"any"," sqft · "]}),"Posted ",f(s.created_at)]}),s.notes&&e.jsx("p",{className:"mt-2 whitespace-pre-wrap text-sm",children:s.notes})]},s.id))})})}),n&&e.jsx(N,{value:"inbox",children:e.jsx("div",{className:"overflow-hidden rounded-2xl border border-border bg-card",children:a.isLoading?e.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"Loading…"}):!a.data||a.data.length===0?e.jsx("p",{className:"p-8 text-center text-sm text-muted-foreground",children:"No responses yet on your requirements."}):e.jsx("ul",{className:"divide-y divide-border",children:a.data.map(s=>e.jsxs("li",{className:"p-4",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:f(s.created_at)}),e.jsxs("p",{className:"mt-1 text-sm font-semibold",children:[s.responder?.full_name??"Anonymous"," ",s.responder?.phone&&e.jsxs("span",{className:"font-normal text-muted-foreground",children:["· ",s.responder.phone]})]}),e.jsx("p",{className:"mt-1 whitespace-pre-wrap text-sm",children:s.message}),s.property&&e.jsxs(m,{to:"/property/$slug",params:{slug:s.property.slug},className:"mt-2 inline-block text-xs font-semibold text-primary hover:underline",children:["View linked property: ",s.property.title," · ",x(Number(s.property.price))]})]},s.id))})})})]}),e.jsx(S,{open:!!t,onOpenChange:s=>!s&&d(null),children:e.jsxs(C,{children:[e.jsx(B,{children:e.jsx(F,{children:"Respond to requirement"})}),t&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.category,t.bhk?` · ${t.bhk} BHK`:"",t.cities?.name?` · ${t.cities.name}`:""]}
1),e.jsx(L,{rows:5,value:l,onChange:s=>p(s.target.value),placeholder:"Briefly describe your matching property and contact details…",maxLength:2e3}),e.jsx(i,{onClick:()=>c.mutate(),disabled:c.isPending||l.trim().length<5,children:c.isPending?"Sending…":"Send response"})]})]})})]}),e.jsx(A,{})]})}export{z 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.