PageSourceSearch

https://knuckl.com/assets/FutureWork-CreDtFLa.js

js knuckl.com collected 2026-09-24 14:46:44 UTC 5,086 bytes, 1 lines download raw bytes

1import{a as m,c as v,j as e}from"./vendor-query-BxlSJxfF.js";import{H as L}from"./Head-CFjoxvyt.js";import{B as w}from"./badge-4jZnSn2H.js";import{u as P,a as T,B as x,L as C,X as E}from"./index-DO0aGFYL.js";import{h as k}from"./haptics-C4kiRWSa.js";import{O as I}from"./OfferSheet-ChGpegXJ.js";import{u as _}from"./use-available-sub-packages-BCYvLeWL.js";import{f as B}from"./use-external-lead-pins-DVQQb9r4.js";import{u as A}from"./use-work-offers-i0L7CNkS.js";import{u as W}from"./vendor-react-DdNhUK9-.js";import{B as J}from"./briefcase-DprwYuVO.js";import{A as M,m as K}from"./vendor-motion-CdL2ySym.js";import{P as $}from"./package-BP6xMrsL.js";import{G as D}from"./globe-BblBOU8M.js";import{M as F}from"./map-pin-Clc12hBl.js";import{C as H}from"./check-BTT3mgzE.js";import"./vendor-supabase-Csx7YFID.js";import"./sheet-KxRpZ2qz.js";import"./label-Lh_RHPfV.js";import"./use-market-rate-BNhsAniP.js";import"./lead-kind-Cs-VxxJh.js";const f="knuckl_skipped_future_work";function q(){try{const r=localStorage.getItem(f);if(!r)return new Set;const t=JSON.parse(r),n=Date.now(),c=Object.entries(t).filter(([,l])=>n-l<864e5);return localStorage.setItem(f,JSON.stringify(Object.fromEntries(c))),new Set(c.map(([l])=>l))}catch{return new Set}}function G(r){try{const t=localStorage.getItem(f),n=t?JSON.parse(t):{};n[r]=Date.now(),localStorage.setItem(f,JSON.stringify(n))}catch{}}function pe(){const{user:r}=P(),{tr:t}=T(),n=W(),[c,l]=m.useState(q),[o,g]=m.useState(null),{data:h=[],isLoading:N}=_(r==null?void 0:r.id,{enabled:!!r}),{data:d,isLoading:b}=v({queryKey:["future-work-leads"],enabled:!!r,staleTime:6e4,queryFn:()=>B({limit:40,sort:"match"})}),{data:y=[]}=A(),j=m.useMemo(()=>new Set(y.map(i=>`${i.targetType}:${i.targetId}`)),[y]),p=m.useMemo(()=>{const i=h.map(a=>({id:a.id,targetType:"sub_package",title:a.name,subtitle:null,trade:a.primarySkill??null,rateLine:a.rateLine??null})),u=((d==null?void 0:d.leads)??[]).filter(a=>!a.locked).map(a=>({id:a.id,targetType:"external_lead",title:a.title??a.trade??t("crewOffers.aLead"),subtitle:[a.city,a.state].filter(Boolean).join(", ")||null,trade:a.trade,rateLine:null}));return[...i,...u].filter(a=>!c.has(a.id)&&!j.has(`${a.targetType}:${a.id}`))},[h,d,c,j,t]),O=N||b,s=p[0],S=i=>{k(),G(i),l(u=>new Set(u).add(i))};return e.jsxs("div",{className:"px-3 py-4 space-y-4 sm:px-5 sm:py-5 max-w-2xl mx-auto",children:[e.jsx(L,{title:"Future work · Knuckl",description:"Raise your hand on sub packages and off-app leads before the job is won."}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-display text-xl text-foreground",children:t("crewOffers.futureWork")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("crewOffers.futureWorkSubtitle")})]}),e.jsxs(x,{variant:"outline",size:"sm",className:"rounded-full text-xs",onClick:()=>n("/jobs"),children:[e.jsx(J,{className:"w-3.5 h-3.5 mr-1.5"}),t("crewOffers.openJobs")]})]}),O?e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsx(C,{className:"w-5 h-5 animate-spin text-muted-foreground"})}):s?e.jsx(M,{mode:"popLayout",children:e.jsxs(K.div,{initial:{opacity:0,y:16,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-16,scale:.98},transition:{duration:.22},className:"rounded-card border border-border/60 bg-card p-4 space-y-3 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[s.targetType==="sub_package"?e.jsx($,{className:"w-4 h-4 text-primary"}):e.jsx(D,{className:"w-4 h-4 text-primary"}),e.jsx(w,{variant:"outline",className:"text-micro",children:s.targetType==="sub_package"?t("crewOffers.subPackage"):t("crewOffers.offAppLead")})]}),e.jsx("h2",{className:"font-display text-lg text-foreground",children:s.title}),s.subtitle&&e.jsxs("p",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(F,{className:"w-3.5 h-3.5"})," ",s.subtitle]}),s.trade&&e.jsx(w,{variant:"secondary",className:"text-micro",children:s.trade}),s.rateLine&&e.jsx("p",{className:"text-sm text-foreground",children:s.rateLine}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsxs(x,{variant:"outline",className:"flex-1 rounded-xl",onClick:()=>S(s.id),children:[e.jsx(E,{className:"w-4 h-4 mr-1.5"}),t("crewOffers.pass")]}),e.jsxs(x,{className:"flex-1 rounded-xl",onClick:()=>{k(),g(s)},children:[e.jsx(H,{className:"w-4 h-4 mr-1.5"}),t("crewOffers.imAvailable")]})]})]},s.id)}):e.jsxs("div",{className:"rounded-card border border-border/60 bg-card/70 p-6 text-center space-y-2",children:[e.jsx("p",{className:"text-sm text-foreground",children:t("crewOffers.futureWorkEmpty")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("crewOffers.futureWorkEmptyHint")})]}),e.jsx("p",{className:"text-center text-xs text-muted-foreground",children:p.length>0&&t("crewOffers.remainingCount").replace("{count}",String(p.length))}),o&&e.jsx(I,{open:!!o,onOpenChange:i=>!i&&g(null),targetType:o.targetType,targetId:o.id,targetTitle:o.title,skills:o.trade?[o.trade]:void 0})]})}export{pe 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.