PageSourceSearch

https://knuckl.com/assets/Directory-s8st2HL3.js

js knuckl.com collected 2026-09-24 14:47:18 UTC 10,337 bytes, 6 lines download raw bytes

1import{a as i,j as e}from"./vendor-query-BxlSJxfF.js";import{H as V}from"./Head-CFjoxvyt.js";import{p as z,u as M,a as D,d as N,I as T,B as P,L as F,e as H,s as q}from"./index-DO0aGFYL.js";import{u as K}from"./use-geolocation-CF3oDqXg.js";import{P as R}from"./skill-catalog-CiwHrT6-.js";import{b as G,u as Q}from"./use-directory-_ioFDmAY.js";import{S as J,a as W,b as X,c as Y,d as Z}from"./sheet-KxRpZ2qz.js";import{T as ee}from"./textarea-CY9O0h4D.js";import{L as j}from"./label-Lh_RHPfV.js";import{h as te}from"./haptics-C4kiRWSa.js";import{C as U}from"./clock-TDYRjmmL.js";import{B as se,D as ae}from"./DirectoryCard-BaFW0EKn.js";import{C as le}from"./ContactActions-5QM815IJ.js";import{u as re,L as ne}from"./ListingCard-B0_5T_sF.js";import{u as ie}from"./AvailabilityCalendarCard-DYENFqXo.js";import{P as oe}from"./PersonPreviewSheet-mSiW1w0A.js";import{u as ce}from"./vendor-react-DdNhUK9-.js";import{S as de}from"./search-BkqYkxAv.js";import{U as me}from"./users-4wDC2oQA.js";import"./vendor-supabase-Csx7YFID.js";import"./badge-check-nBlvRFlm.js";import"./star-B2GJQJHh.js";import"./map-pin-Clc12hBl.js";import"./bookmark-D2iy1XDt.js";import"./use-call-worker-rKYeWsU9.js";import"./building-2-CTs9_w7h.js";import"./chevron-left-Bpy2VrDY.js";import"./chevron-right-n5eCbV2c.js";import"./image-url-_sEuZELz.js";import"./ChatView-ByxmI7l5.js";import"./use-feature-gate-D2hKRPw6.js";import"./use-subscription-OP_b8dLc.js";import"./use-messaging-permission-ub7ydGOC.js";import"./UpgradeCard-CvZNabGY.js";import"./dropdown-menu-CWX03-u_.js";import"./index-Ce1IEqmK.js";import"./index-Bidgsva9.js";import"./index-B9yCq0Ag.js";import"./check-BTT3mgzE.js";import"./circle-qEn4UVIP.js";import"./alert-dialog-WBQzXKSB.js";import"./ellipsis-vertical-hz3e7lEk.js";import"./ban-D47cmeaL.js";import"./flag-iQDr95MH.js";import"./application-status-OYVIyYV9.js";import"./arrow-left-DNK6fh5x.js";import"./briefcase-DprwYuVO.js";import"./message-circle-BO3xv6Rs.js";import"./vendor-motion-CdL2ySym.js";import"./lock-CWPApfun.js";import"./circle-alert-CepIuroe.js";import"./message-square-CLxZQpIa.js";import"./send-C6vNENnO.js";import"./truck-Lofw2l_u.js";import"./chevron-down-Bc6tfcMh.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const ue=z("Hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]);function pe({open:m,onOpenChange:u,origin:s}){const{user:r}=M(),{t:p}=D(),n=p.directory,[c,v]=i.useState([]),[f,k]=i.useState(""),[b,S]=i.useState(""),[x,w]=i.useState(""),[C,y]=i.useState(""),[L,_]=i.useState(!1),l=()=>{v([]),k(""),S(""),w(""),y("")},A=async()=>{if(r!=null&&r.id){if(c.length===0){H.error(n.pickTrade);return}_(!0);try{const{data:a,error:h}=await q.from("help_requests").insert({requester_id:r.id,trades:c,description:C.trim()||null,starts_on:f||null,location:b.trim()||null,lat:(s==null?void 0:s.lat)??null,lng:(s==null?void 0:s.lng)??null,pay_rate:x?Number(x):null}).select("id").single();if(h)throw h;q.functions.invoke("notify-help-request",{body:{help_request_id:a.id}}).catch(g=>{}),H.success(n.requestPosted),l(),u(!1)}catch{H.error(n.requestFailed)}finally{_(!1)}}},d=a=>v(h=>h.includes(a)?h.filter(g=>g!==a):[...h,a]);return e.jsx(J,{open:m,onOpenChange:u,children:e.jsxs(W,{side:"bottom",className:"max-h-[90vh] overflow-y-auto rounded-t-3xl pb-[calc(1.5rem+env(safe-area-inset-bottom))]",children:[e.jsxs(X,{className:"text-left",children:[e.jsx(Y,{children:n.needAHand}),e.jsx(Z,{children:n.needAHandHint})]}),e.jsxs("div",{className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{children:n.whatTrade}),e.jsx("div",{className:"flex flex-wrap gap-2",children:R.slice(0,14).map(a=>e.jsx("button",{type:"button",onClick:()=>d(a),"aria-pressed":c.includes(a),className:N("h-8 px-3 rounded-full text-xs font-medium border transition-colors",c.includes(a)?"bg-primary text-primary-foreground border-primary":"bg-secondary/50 text-muted-foreground border-border/60"),children:a},a))})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"need-when",children:n.whenLabel}),e.jsx(T,{id:"need-when",type:"date",value:f,onChange:a=>k(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"need-pay",children:n.payLabel}),e.jsx(T,{id:"need-pay",type:"number",inputMode:"decimal",placeholder:"25",value:x,onChange:a=>w(a.target.value)})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"need-where",children:n.whereLabel}),e.jsx(T,{id:"need-where",value:b,onChange:a=>S(a.target.value),placeholder:n.wherePlaceholder})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"need-notes",children:n.notesLabel}),e.jsx(ee,{id:"need-notes",rows:3,value:C,onChange:a=>y(a.target.value),placeholder:n.notesPlaceholder})]}),e.jsx(P,{onClick:A,disabled:L,className:"w-full h-12 rounded-xl font-semibold",children:L?e.jsx(F,{className:"w-4 h-4 animate-spin"}):n.postRequest})]})]})})}function he({className:m}){const{t:u}=D(),s=u.directory,{isAvailable:r,availableUntil:p,setAvailability:n}=G(),c=p?new Date(p).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}):null;return e.jsxs("button",{type:"button",disabled:n.isPending,onClick:()=>{te(),n.mutate(r?null:8)},className:N("w-full rounded-card border p-3 flex items-center gap-3 text-left transition-colors",r?"bg-primary/10 border-primary/40":"bg-card/60 border-border/60 hover:bg-accent/40",m),children:[e.jsx("span",{className:N("w-9 h-9 rounded-xl flex items-center justify-center shrink-0",r?"bg-primary/20 text-primary":"bg-secondary text-muted-foreground"),children:n.isPending?e.jsx(F,{className:"w-4 h-4 animate-spin"}):e.jsx(U,{className:"w-4 h-4"})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block text-sm font-semibold",children:r?s.youAreAvailable:s.markAvailable}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:r&&c?s.availableUntil.replace("{time}",c):s.markAvailableHint})]}),e.jsx("span",{className:N("shrink-0 h-6 px-2.5 rounded-full text-caption font-semibold inline-flex items-center",r?"bg-primary text-primary-foreground":"bg-secondary text-muted-foreground"),children:r?s.on:s.off})]})}function ft(){const m=ce(),{t:u}=D(),s=u.directory,{user:r}=M(),{position:p,refresh:n}=K(),[c,v]=i.useState(""),[f,k]=i.useState([]),[b,S]=i.useState(!1),[x,w]=i.useState(!1),[C,y]=i.useState(!1),[L,_]=i.useState(null),[l,A]=i.useState(null);i.useEffect(()=>{n()},[n]),i.useEffect(()=>{if(!(r!=null&&r.id)||p)return;let t=!1;return(async()=>{const{data:o}=await q.from("profiles").select("lat, lng").eq("user_id",r.id).maybeSingle();!t&&(o==null?void 0:o.lat)!=null&&(o==null?void 0:o.lng)!=null&&_({lat:o.lat,lng:o.lng})})(),()=>{t=!0}},[r==null?void 0:r.id,p]);const d=p??L,{data:a=[],isLoading:h}=Q({lat:(d==null?void 0:d.lat)??null,lng:(d==null?void 0:d.lng)??null,trades:f,query:c,availableOnly:b,savedOnly:x}),{data:g=[]}=re(c,20),{data:B={}}=ie(a.map(t=>t.user_id)),I=i.useMemo(()=>R.slice(0,14),[]),$=t=>k(o=>o.includes(t)?o.filter(E=>E!==t):[...o,t]);return e.jsxs("div",{className:"min-h-screen pb-28",children:[e.jsx(V,{title:"Trade directory | Knuckl",description:"Find plumbers, framers, drywall crews and more near you — call or text them in one tap."}),e.jsxs("div",{className:"px-4 pt-4 space-y-4",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.subtitle})]}),e.jsx(he,{}),e.jsxs("div",{className:"relative",children:[e.jsx(de,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(T,{value:c,onChange:t=>v(t.target.value),placeholder:s.searchPlaceholder,className:"pl-9 h-11 rounded-xl","aria-label":s.searchPlaceholder})]}),e.jsxs("div",{className:"flex gap-2 overflow-x-auto -mx-4 px-4 pb-1 scrollbar-none",children:[e.jsx(O,{active:x,onClick:()=>w(t=>!t),icon:e.jsx(se,{className:"w-3.5 h-3.5"}),label:s.myPeople}),e.jsx(O,{active:b,onClick:()=>S(t=>!t),icon:e.jsx(U,{className:"w-3.5 h-3.5"}),label:s.availableNow}),I.map(t=>e.jsx(O,{active:f.includes(t),onClick:()=>$(t),label:t},t))]}),e.jsxs(P,{onClick:()=>y(!0),className:"w-full h-12 rounded-xl gap-2 font-semibold",children:[e.jsx(ue,{className:"w-4 h-4"}),s.needAHand]}),h?e.jsx("div",{className:"py-16 flex justify-center",children:e.jsx(F,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):a.length===0?e.jsxs("div",{className:"py-16 text-center space-y-2",children:[e.jsx(me,{className:"w-8 h-8 mx-auto text-muted-foreground
6/60"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.empty})]}):e.jsx(le,{ids:a.map(t=>t.user_id),children:e.jsx("div",{className:"space-y-2",children:a.map(t=>e.jsx(ae,{person:t,nextOpen:B[t.user_id]??null,onOpen:()=>A(t),onText:()=>m(`/messages?to=${t.user_id}`)},`${t.kind}-${t.user_id}`))})}),g.length>0&&e.jsxs("div",{className:"space-y-2 pt-2",children:[e.jsx("p",{className:"text-xs uppercase tracking-wider text-muted-foreground font-medium",children:s.browseTabBusinesses}),g.map(t=>e.jsx(ne,{listing:t},t.id))]})]}),e.jsx(pe,{open:C,onOpenChange:y,origin:d}),e.jsx(oe,{userId:(l==null?void 0:l.user_id)??null,onClose:()=>A(null),seed:{name:l==null?void 0:l.name,avatarUrl:l==null?void 0:l.avatar_url,skills:l==null?void 0:l.trades,distanceMi:l==null?void 0:l.distance_miles,isAvailableToday:!!(l!=null&&l.available_until),rateLine:l!=null&&l.hourly_rate?`$${l.hourly_rate}/hr`:null}})]})}function O({active:m,onClick:u,label:s,icon:r}){return e.jsxs("button",{type:"button",onClick:u,"aria-pressed":m,className:N("shrink-0 h-8 px-3 rounded-full text-xs font-medium border inline-flex items-center gap-1.5 transition-colors",m?"bg-primary text-primary-foreground border-primary":"bg-secondary/50 text-muted-foreground border-border/60 hover:bg-accent/60"),children:[r,s]})}export{ft 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.