PageSourceSearch

https://knuckl.com/assets/ProjectPortal-CcD5Zncx.js

js knuckl.com collected 2026-09-24 14:47:16 UTC 6,894 bytes, 1 lines download raw bytes

1import{u as C,a as x,c as S,i as _,j as e}from"./vendor-query-BxlSJxfF.js";import{a as E,s as m,L as T,B as u,r as k,S as R,e as P}from"./index-DO0aGFYL.js";import{H as F}from"./Head-CFjoxvyt.js";import{K as B}from"./KnucklLogo-DmAzyuOm.js";import{T as K}from"./textarea-CY9O0h4D.js";import{t as q,a as A}from"./homeowner-i18n-BlSJu_P4.js";import{H}from"./homeowner-trades-DdI3fK_X.js";import{g as Q,L as U}from"./vendor-react-DdNhUK9-.js";import{U as I}from"./users-4wDC2oQA.js";import{C as O}from"./circle-check-BzeG-ygw.js";import{S as $}from"./send-C6vNENnO.js";import"./vendor-supabase-Csx7YFID.js";import"./skill-catalog-CiwHrT6-.js";function se(){var y,v;const{token:n=""}=Q(),{tr:o}=E(),f=C(),[p,g]=x.useState({}),[w,j]=x.useState([]),{data:l,isLoading:L}=S({queryKey:["homeowner-portal",n],queryFn:async()=>{const{data:r,error:s}=await m.rpc("homeowner_lead_by_token",{_token:n});if(s)throw s;return r},enabled:n.length>0,refetchInterval:6e4});x.useEffect(()=>{var r,s;(s=(r=l==null?void 0:l.lead)==null?void 0:r.photos)!=null&&s.length&&m.functions.invoke("homeowner-lead-photos",{body:{access_token:n}}).then(({data:t})=>j((t==null?void 0:t.urls)??[])).catch(()=>j([]))},[(v=(y=l==null?void 0:l.lead)==null?void 0:y.photos)==null?void 0:v.length,n]);const N=_({mutationFn:async({responseId:r,body:s})=>{const{data:t,error:d}=await m.rpc("homeowner_lead_reply",{_token:n,_response_id:r,_body:s});if(d)throw d;const c=t;if(c!=null&&c.error)throw new Error(c.error)},onSuccess:(r,s)=>{g(t=>({...t,[s.responseId]:""})),f.invalidateQueries({queryKey:["homeowner-portal",n]})},onError:()=>P.error(o("homeowner.portal.sendFailed"))}),b=_({mutationFn:async()=>{const{error:r}=await m.rpc("homeowner_lead_close",{_token:n,_reason:null});if(r)throw r},onSuccess:()=>{P.success(o("homeowner.portal.closed")),f.invalidateQueries({queryKey:["homeowner-portal",n]})}});if(L)return e.jsx("div",{className:"min-h-screen grid place-items-center",children:e.jsx(T,{className:"w-6 h-6 animate-spin text-muted-foreground"})});if(!l||l.error)return e.jsx("div",{className:"min-h-screen grid place-items-center px-6 text-center",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold",children:o("homeowner.portal.invalidTitle")}),e.jsx("p",{className:"text-muted-foreground mt-2 text-sm",children:o("homeowner.portal.invalidBody")}),e.jsx(u,{asChild:!0,className:"mt-5 rounded-xl",children:e.jsx(U,{to:"/homeowners/post",children:o("homeowner.portal.postAProject")})})]})});const{lead:a,responses:i}=l,h=a.status==="closed";return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(F,{title:`Your ${a.trade} project | Knuckl`,description:"Track replies from local pros.",noindex:!0}),e.jsxs("header",{className:"px-5 py-4 border-b border-border/60 flex items-center justify-between",children:[e.jsx(B,{className:"h-6"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:o("homeowner.portal.privateLink")})]}),e.jsxs("main",{className:"px-5 py-6 max-w-2xl mx-auto pb-20",children:[e.jsxs("div",{className:"rounded-card border border-border/60 bg-card/60 p-5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold",children:q(o,a.trade,H)}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[[a.city,a.state].filter(Boolean).join(", ")||o("homeowner.portal.locationOnFile")," ","· ",A(o,a.timeline)," ·"," ",o("homeowner.portal.postedAgo",{ago:k(a.created_at)})]})]}),h?e.jsx("span",{className:"text-xs px-2.5 py-1 rounded-full bg-muted text-muted-foreground",children:o("homeowner.portal.statusClosed")}):e.jsx("span",{className:"text-xs px-2.5 py-1 rounded-full bg-primary/15 text-primary",children:o("homeowner.portal.statusLive")})]}),e.jsx("p",{className:"mt-4 text-sm leading-relaxed whitespace-pre-wrap",children:a.description}),w.length>0&&e.jsx("div",{className:"mt-4 flex gap-2 overflow-x-auto",children:w.map((r,s)=>e.jsx("img",{src:r,alt:o("homeowner.post.projectPhoto",{n:s+1}),loading:"lazy",className:"w-24 h-24 rounded-lg object-cover border border-border/60"},r))}),e.jsxs("div",{className:"mt-4 flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(I,{className:"w-3.5 h-3.5"}),a.notified_pro_count>1?o("homeowner.portal.sentToPros",{count:a.notified_pro_count}):a.notified_pro_count===1?o("homeowner.portal.sentToPro"):o("homeowner.portal.willSee")]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(R,{className:"w-3.5 h-3.5"}),o("homeowner.portal.privacyNote")]})]}),e.jsx("h2",{className:"mt-8 mb-3 font-semibold",children:i.length>1?o("homeowner.portal.prosReplied",{count:i.length}):i.length===1?o("homeowner.portal.proReplied"):o("homeowner.portal.noRepliesYet")}),i.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:o("homeowner.portal.noRepliesB
1ody")}),e.jsx("div",{className:"space-y-4",children:i.map(r=>{var s;return e.jsxs("div",{className:"rounded-card border border-border/60 bg-card/60 p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[r.pro.avatar_url?e.jsx("img",{src:r.pro.avatar_url,alt:"",className:"w-10 h-10 rounded-full object-cover"}):e.jsx("div",{className:"w-10 h-10 rounded-full bg-primary/15 grid place-items-center text-primary font-semibold",children:r.pro.name.charAt(0)}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium truncate",children:r.pro.name}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:[r.pro.city,r.pro.avg_rating?`${r.pro.avg_rating.toFixed(1)}★`:null].filter(Boolean).join(" · ")||o("homeowner.portal.localPro")})]}),r.homeowner_replied_at&&e.jsx(O,{className:"w-4 h-4 text-primary ml-auto shrink-0"})]}),e.jsx("div",{className:"mt-3 space-y-2",children:r.messages.map(t=>e.jsxs("div",{className:`text-sm rounded-xl px-3 py-2 max-w-[85%] ${t.sender==="homeowner"?"bg-primary/15 ml-auto":"bg-muted"}`,children:[e.jsx("p",{className:"whitespace-pre-wrap",children:t.body}),e.jsx("span",{className:"block text-micro text-muted-foreground mt-1",children:k(t.created_at)})]},t.id))}),!h&&e.jsxs("div",{className:"mt-3 flex gap-2",children:[e.jsx(K,{value:p[r.id]??"",onChange:t=>g(d=>({...d,[r.id]:t.target.value})),rows:2,maxLength:2e3,placeholder:o("homeowner.portal.replyPlaceholder"),className:"rounded-xl text-sm"}),e.jsx(u,{size:"icon",className:"h-auto rounded-xl shrink-0",disabled:!((s=p[r.id])!=null&&s.trim())||N.isPending,onClick:()=>N.mutate({responseId:r.id,body:p[r.id].trim()}),"aria-label":o("homeowner.portal.sendReply"),children:e.jsx($,{className:"w-4 h-4"})})]})]},r.id)})}),!h&&e.jsx(u,{variant:"ghost",className:"w-full mt-8 text-muted-foreground",onClick:()=>b.mutate(),disabled:b.isPending,children:o("homeowner.portal.closeProject")})]})]})}export{se 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.