PageSourceSearch

https://knuckl.com/assets/MyBids-DQn4ssy1.js

js knuckl.com collected 2026-09-24 14:46:40 UTC 12,896 bytes, 6 lines download raw bytes

1import{j as e,a as _}from"./vendor-query-BxlSJxfF.js";import{u as A}from"./use-primary-query-B8u8fHwG.js";import{p as P,a as N,u as k,B as g,o as S,r as L,s as M}from"./index-DO0aGFYL.js";import{H as D}from"./Head-CFjoxvyt.js";import{B as y}from"./badge-4jZnSn2H.js";import{a as R}from"./use-sub-attention-items-BoA_Jnai.js";import{u as $}from"./use-sub-bid-quota-BqJc9KN6.js";import{u as q}from"./use-subscription-OP_b8dLc.js";import{u as T}from"./use-feature-gate-D2hKRPw6.js";import{U}from"./UpgradeCard-CvZNabGY.js";import{d as E}from"./differenceInDays-DtcEJM-I.js";import{C as z}from"./clock-TDYRjmmL.js";import{Z as F}from"./zap-3WSssjod.js";import{C as Z}from"./chart-column-BKXGRJUl.js";import{u as I}from"./use-contextual-prompt-D1DZFfx0.js";import{C as O}from"./ContextualPromptCard-6FgUlM7P.js";import{L as Q}from"./LoadErrorCard-DBbQlF04.js";import{u as v}from"./vendor-react-DdNhUK9-.js";import{C as H}from"./chevron-left-Bpy2VrDY.js";import{C as K}from"./camera-vAyeR-gp.js";import{P as B}from"./package-BP6xMrsL.js";import"./vendor-supabase-Csx7YFID.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 W=P("Infinity",[["path",{d:"M12 12c-2-2.67-4-4-6-4a4 4 0 1 0 0 8c2 0 4-1.33 6-4Zm0 0c2 2.67 4 4 6 4a4 4 0 0 0 0-8c-2 0-4 1.33-6 4Z",key:"1z0uae"}]]);function G(){const{t}=N(),{used:a,limit:o,isPaid:s,isLoading:c,nextResetAt:m}=$(),{trialEndsAt:u,effectiveTier:h}=q(),{openUpgrade:b}=T(),r=t.subUx;if(c)return null;const p=!!u&&new Date(u).getTime()>Date.now()&&h==="paid",n=p?Math.max(0,E(new Date(u),new Date)):0,i=(()=>{if(!m)return null;const f=new Date(m);if(Number.isNaN(f.getTime()))return null;try{return f.toLocaleDateString(void 0,{month:"short",day:"numeric"})}catch{return f.toDateString()}})(),d=o??3,x=Math.min(100,Math.round(a/d*100)),l=!s&&a>=d,j=({value:f,tone:w="primary"})=>e.jsx("div",{className:"mt-3 h-1.5 rounded-full bg-primary/15 overflow-hidden",children:e.jsx("div",{className:`h-full ${w==="destructive"?"bg-destructive":w==="muted"?"bg-muted-foreground/40":"bg-primary"}`,style:{width:`${Math.min(100,Math.max(0,f))}%`}})});if(s&&p){const f=Math.max(0,Math.min(100,n/30*100));return e.jsx("div",{className:"rounded-xl bg-muted/40 border border-border/60 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-primary/12 text-primary",children:e.jsx(z,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:r.quotaTrialRemaining(n)}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:r.quotaTrialBody}),e.jsx(j,{value:f,tone:"muted"})]})]})})}return s?e.jsx("div",{className:"rounded-xl bg-muted/40 border border-border/60 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-primary/12 text-primary",children:e.jsx(W,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:r.quotaUnlimited}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:r.quotaPaidBody}),e.jsx("span",{className:"inline-flex items-center mt-2 h-6 px-2 rounded-full bg-primary/10 text-primary text-caption font-medium",children:r.quotaThisMonthTotal(a)})]})]})}):l?e.jsx(U,{icon:F,title:r.quotaLimitReachedTitle,body:i?r.quotaNextSlot(i):r.quotaLimitReachedBody,primaryCta:r.upgradeUnlimitedCta,onPrimary:()=>b("sub_bid")}):e.jsx("div",{className:"rounded-xl bg-muted/40 border border-border/60 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-primary/12 text-primary",children:e.jsx(Z,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:r.quotaUsed(a,d)}),i&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:r.quotaNextSlot(i)}),e.jsx(j,{value:x}),e.jsx("div",{className:"mt-3",children:e.jsx("button",{type:"button",onClick:()=>b("sub_bid"),className:"inline-flex items-center justify-center h-9 px-3 rounded-full text-xs font-medium text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors",children:r.upgradeUnlimitedCta})})]})]})})}function ve(){const{user:t}=k(),{t:a}=N(),o=v(),s=(a==null?void 0:a.myBids)??{};_.useEffect(()=>
6{t!=null&&t.id&&R(t.id)},[t==null?void 0:t.id]);const{data:c,isLoading:m,isError:u,isFetching:h,refetch:b}=A({queryKey:["my-bids",t==null?void 0:t.id],enabled:!!(t!=null&&t.id),staleTime:3e4,queryFn:async()=>{const{data:i,error:d}=await M.from("applications").select("id, job_id, bid_amount, bid_note, status, created_at, job:jobs!inner(id, title, location, status, pay, pay_range_max, job_type, is_demo)").eq("worker_id",t.id).order("created_at",{ascending:!1});if(d)throw d;return(i??[]).filter(x=>{var l;return((l=x.job)==null?void 0:l.job_type)==="sub_package"})}}),r=c??[],p=(i,d)=>o(d==="sub_package"?`/contractor/sub-jobs/${i}`:`/jobs/${i}`),n=_.useMemo(()=>{var x;const i=[],d=[];for(const l of r){const j=((x=l.job)==null?void 0:x.status)&&!["active","open","pending"].includes(l.job.status),f=["withdrawn","rejected","not_selected"].includes(l.status);j||f?d.push(l):i.push(l)}return{active:i,closed:d}},[r]);return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(D,{title:`${s.title??"My Bids"} · Knuckl`,description:s.title??"My Bids"}),e.jsx("div",{className:"sticky top-0 z-10 bg-background/80 backdrop-blur-md border-b border-border/60",children:e.jsxs("div",{className:"max-w-2xl mx-auto flex items-center gap-2 px-4 py-3",children:[e.jsx(g,{variant:"ghost",size:"icon",onClick:()=>o(-1),"aria-label":s.back??"Back",className:"rounded-full",children:e.jsx(H,{className:"h-5 w-5"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h1",{className:"text-lg font-semibold tracking-tight leading-none",children:s.title??"My Bids"}),!m&&r.length>0&&e.jsxs("p",{className:"text-caption text-muted-foreground mt-0.5",children:[n.active.length," ",s.active??"Active"," · ",n.closed.length," ",s.closed??"Closed"]})]})]})}),e.jsxs("div",{className:"max-w-2xl mx-auto px-4 py-6 space-y-6",children:[e.jsx(G,{}),e.jsx(X,{hasRejected:n.closed.some(i=>["rejected","not_selected"].includes(i.status))}),m?e.jsx("div",{className:"space-y-3",children:[0,1,2].map(i=>e.jsxs("div",{className:"rounded-card border border-border/60 bg-card/60 p-4 animate-pulse space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"h-4 w-1/2 roun
6ded bg-muted"}),e.jsx("div",{className:"h-4 w-14 rounded-lg bg-muted"})]}),e.jsx("div",{className:"h-3 w-1/3 rounded bg-muted"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"h-5 w-16 rounded-lg bg-muted"}),e.jsx("div",{className:"h-5 w-20 rounded-lg bg-muted"})]})]},i))}):u?e.jsx(Q,{onRetry:()=>b(),isRetrying:h}):r.length===0?e.jsx(V,{title:s.emptyTitle??"No bids yet",subtitle:s.emptySubtitle??"Browse sub packages and submit your first bid.",cta:s.browse??"Browse packages",onCta:()=>o("/contractor/sub-jobs")}):e.jsxs(e.Fragment,{children:[e.jsx(C,{label:`${s.active??"Active"} (${n.active.length})`,rows:n.active,onOpen:p,strings:s,empty:s.noActive??"No active bids."}),e.jsx(C,{label:`${s.closed??"Closed"} (${n.closed.length})`,rows:n.closed,onOpen:p,strings:s,empty:s.noClosed??"No closed bids.",muted:!0})]})]})]})}function C({label:t,rows:a,onOpen:o,strings:s,empty:c,muted:m}){return e.jsxs("section",{children:[e.jsx("h2",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground mb-2",children:t}),a.length===0?e.jsx("p",{className:"text-sm text-muted-foreground py-3",children:c}):e.jsx("div",{className:`space-y-2 ${m?"opacity-70":""}`,children:a.map(u=>e.jsx(Y,{b:u,onOpen:o,strings:s},u.id))})]})}function Y({b:t,onOpen:a,strings:o}){var r,p,n,i,d;const s=!!((r=t.job)!=null&&r.is_demo)&&t.status==="accepted",c=t.status==="accepted"&&!((p=t.job)!=null&&p.is_demo),m=o.awarded??{},u=["rejected","not_selected"].includes(t.status),h=!!((n=t.job)!=null&&n.is_demo),b=v();return e.jsxs("div",{id:`bid-${t.id}`,className:`group rounded-card border p-3.5 transition-all ${s||c?"border-primary/40 bg-primary/5 shadow-[0_8px_24px_-12px_hsl(var(--primary)/0.35)]":"border-border/60 bg-card/60 backdrop-blur-sm hover:bg-accent/30 hover:border-border hover:-translate-y-0.5 hover:shadow-md"}`,children:[e.jsx("button",{type:"button",onClick:()=>{var x;return h?void 0:a(t.job_id,(x=t.job)==null?void 0:x.job_type)},disabled:h,className:"w-full text-left disabled:cursor-default",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"mt-0.5 shrink-0 w-9 h-9 rounded-full bg-primary/10 text-primary flex items-center justify-center",children:e.jsx(B,{className:"w-4 h-4"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm font-semibold truncate",children:((i=t.job)==null?void 0:i.title)??o.untitled??"Untitled"}),c?e.jsx(y,{className:"text-micro shrink-0",children:m.chip??"Awarded"}):e.jsx(J,{status:t.status,strings:o}),h&&e.jsx(y,{variant:"outline",className:"text-micro shrink-0 border-primary/50 text-primary bg-primary/10",children:o.sampleBadge??"SAMPLE"})]}),((d=t.job)==null?void 0:d.location)&&e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:t.job.location}),e.jsxs("div",{className:"mt-1 flex items-center gap-3 text-xs",children:[t.bid_amount!=null&&e.jsxs("span",{className:"font-medium text-foreground",children:[c?`${m.bidLabel??"Your bid"}: `:"","$",Number(t.bid_amount).toLocaleString()]}),e.jsx("span",{className:"text-muted-foreground",children:L(t.created_at)})]}),t.bid_note&&e.jsx("p",{className:"mt-1.5 text-xs text-muted-foreground line-clamp-2",children:t.bid_note})]})]})}),u&&e.jsx("div",{className:"mt-3 pt-3 border-t border-border/60",children:e.jsx(g,{size:"sm",variant:"outline",className:"opacity-100",onClick:()=>b("/contractor/sub-jobs"),children:o.lostCta??"Browse open packages"})}),s&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-primary/20 space-y-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:o.sampleAcceptedNote??"This was a sample bid. On a real bid, the accepted package opens its own page where you can message the poster."}),e.jsx(g,{size:"sm",variant:"outline",onClick:()=>b("/contractor/sub-jobs"),children:o.browseRealCta??"Browse real packages"})]})]})}function J({status:t,strings:a}){const o={pending:a.statusPending??"Pending",accepted:a.statusAccepted??"Accepted",rejected:a.statusRejected??"Not selected",not_selected:a.statusRejected??"Not selected",withdrawn:a.statusWithdrawn??"Withdrawn"},s=t==="accepted"?"default":t==="rejected"||t==="not_selected"||t==="withdrawn"?"secondary":"outline";return e.jsx(y,{variant:s,className:"text-micro shrink-0",children:o[t]??t})}function V({title:t,subtitle:a,cta:o,onCta:s}){return e.jsxs("div",{className:"relative overflow-hidden rounded-3xl border border-border/60 bg-card/60 backdrop-blur-sm px-6 py-14 text-center",children:[e.jsx("div",{"aria-hidden":!0,
6className:"pointer-events-none absolute inset-x-0 -top-24 h-48 bg-[radial-gradient(circle_at_center,hsl(var(--primary)/0.18),transparent_70%)]"}),e.jsx("div",{className:"relative mx-auto w-16 h-16 rounded-card bg-primary/10 text-primary flex items-center justify-center mb-4 ring-1 ring-primary/20 shadow-[0_10px_30px_-10px_hsl(var(--primary)/0.5)]",children:e.jsx(B,{className:"w-7 h-7"})}),e.jsx("h2",{className:"relative text-lg font-semibold tracking-tight",children:t}),e.jsx("p",{className:"relative text-sm text-muted-foreground mt-1.5 mb-5 max-w-xs mx-auto leading-relaxed",children:a}),e.jsx(g,{onClick:s,className:"relative rounded-full px-6 shadow-lg shadow-primary/25",children:o})]})}function X({hasRejected:t}){var n,i,d,x,l,j;const{user:a}=k(),o=v(),{t:s}=N(),{data:c}=S(a==null?void 0:a.id),m=!!((n=c==null?void 0:c.sub)!=null&&n.logoUrl),{show:u,dismiss:h,markComplete:b}=I("sub_add_portfolio_after_bid_rejected",t,{alreadyDone:m});if(!u)return null;const r=((x=(d=(i=s.prompts)==null?void 0:i.contextual)==null?void 0:d.sub)==null?void 0:x.addPortfolioAfterReject)??{},p=((j=(l=s.prompts)==null?void 0:l.contextual)==null?void 0:j.dismissCta)??"Not now";return e.jsx(O,{icon:K,title:r.title??"Add portfolio to strengthen future bids",body:r.body,primaryCta:r.cta??"Upload portfolio",onPrimary:()=>{b(),o("/profile")},dismissCta:p,onDismiss:h})}export{ve 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.