PageSourceSearch

https://knuckl.com/assets/WorkerSettings-DIBWJxJ4.js

js knuckl.com collected 2026-09-24 14:46:42 UTC 12,950 bytes, 1 lines download raw bytes

1import{a,j as e,u as q,c as W}from"./vendor-query-BxlSJxfF.js";import{o as F}from"./feedback-Bgf_c1TA.js";import{a as D,Q as I,d as L,u as U,T as $,s as O,e as E}from"./index-DO0aGFYL.js";import{H as B}from"./Head-CFjoxvyt.js";import{d as V,u as Y}from"./vendor-react-DdNhUK9-.js";import{L as z,N as M,a as Z,C as G,P as J,W as X,b as ee,A as re,R as te,D as se,c as oe,d as T}from"./RolesSection-DdLPrhu2.js";import{n as ae}from"./moment-share-CYblPAFV.js";import{U as ne}from"./user-plus-e-panZql.js";import{R as ie}from"./ReferralsCard-CVmJ3YdU.js";import{S as le}from"./ShareAppDialog-Cxgpe6xU.js";import{A as ce}from"./arrow-left-DNK6fh5x.js";import{S as de}from"./settings-Cz62iviH.js";import{C as R}from"./chevron-right-n5eCbV2c.js";import{M as me}from"./message-square-plus-BJcrVrJI.js";import{F as A}from"./file-text-CHUqxuo4.js";import{E as ue}from"./external-link-BMHb0t-K.js";import{L as pe}from"./log-out-D2Yq8Kil.js";import"./vendor-supabase-Csx7YFID.js";import"./map-pin-Clc12hBl.js";import"./pencil-B-NCVQLG.js";import"./check-BTT3mgzE.js";import"./info-CrnkT6_5.js";import"./switch-CdLpmXwy.js";import"./sun-CN1i-azx.js";import"./bell-D4WR-0m3.js";import"./search-BkqYkxAv.js";import"./chevron-down-Bc6tfcMh.js";import"./shield-alert-CRGPPCh9.js";import"./PhoneInput-BCaIT_G3.js";import"./popover-wk50W3qJ.js";import"./index-Bidgsva9.js";import"./index-D17hSi50.js";import"./lock-CWPApfun.js";import"./message-circle-BO3xv6Rs.js";import"./chevron-up-EG6HBK1O.js";import"./haptics-C4kiRWSa.js";import"./alert-dialog-WBQzXKSB.js";import"./PushPrePrompt-CM-0ATu6.js";import"./sheet-KxRpZ2qz.js";import"./SmsOptInSheet-BBHAPXxb.js";import"./sms-consent-CU5n7lJn.js";import"./message-square-CLxZQpIa.js";import"./download--fCahH8w.js";import"./use-profile-edit-BGgdNu7H.js";import"./JobSkillPicker-BUap6frS.js";import"./skill-catalog-CiwHrT6-.js";import"./vendor-motion-CdL2ySym.js";import"./sparkles-B9Io74C_.js";import"./plus-Cn9YMeBw.js";import"./transportation-radius-Cf3RXfRC.js";import"./laborer-first-skill-defaults-snfVOtiO.js";import"./user-cog-BSDexrby.js";import"./hammer-EIffoAvM.js";import"./package-BP6xMrsL.js";import"./hard-hat-D6ZR2UoR.js";
1import"./referral-share-DSEBK8Kr.js";import"./use-toast-DIh7BwqI.js";import"./copy-0DH5VK1i.js";import"./share-2-0UyL2gfq.js";import"./coffee-CzwT2awH.js";import"./gtm-BvBzX99D.js";import"./award-BPuchHpr.js";import"./mail-jw7BVI6D.js";function xe({openShareDialog:o,scrollTargetId:l="referrals-card",highlightDurationMs:s=1800,maxScrollAttempts:r=5,scrollAttemptDelayMs:x=120}){const[i,n]=V(),[u,g]=a.useState(!1),b=a.useRef(!1),c=a.useRef(!1);return a.useEffect(()=>{if(i.get("share")==="1"&&!b.current){b.current=!0,o("post_onboarding");const d=new URLSearchParams(i);d.delete("share"),n(d,{replace:!0})}if(i.get("section")==="referrals"&&!c.current){c.current=!0;const d=(f=0)=>{const m=document.getElementById(l);if(m&&typeof m.scrollIntoView=="function")try{return m.scrollIntoView({behavior:"smooth",block:"start"}),g(!0),window.setTimeout(()=>g(!1),s),!0}catch{return!1}return f<r?(window.setTimeout(()=>d(f+1),x),!0):!1};d()||o("badge_notification");const p=new URLSearchParams(i);p.delete("section"),n(p,{replace:!0})}},[i,n,o,l,s,r,x]),{referralsHighlighted:u}}function fe({className:o,size:l="md"}){const{lang:s,setLang:r}=D(),x=l==="sm"?"h-11":"h-12",i=["en","es","pt","ht","fr"];return e.jsx("div",{role:"group","aria-label":"Language / Idioma / Lingua / Lang / Langue",className:L("flex w-full items-center justify-between gap-1.5",o),children:i.map(n=>{const u=s===n;return e.jsx("button",{type:"button",onClick:()=>r(n),"aria-pressed":u,"aria-label":I[n].nativeName,className:L("flex-1 px-2 rounded-full font-sans text-sm font-semibold transition-colors",x,u?"bg-[#E85D24] text-white shadow-sm":"bg-muted/50 text-muted-foreground hover:bg-accent"),children:n.toUpperCase()},n)})})}function ge({label:o,hint:l}){return e.jsxs("button",{type:"button",onClick:()=>{ae()},className:"w-full flex items-center gap-3 p-4 rounded-card bg-card border border-border/60 hover:border-primary/40 transition-all group text-left",children:[e.jsx("div",{className:"w-9 h-9 rounded-xl bg-primary/15 flex items-center justify-center shrink-0 group-hover:bg-primary/25 transition-colors",children:e.jsx(ne,{className:"w-4 h-4 text-primary"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground group-hover:text-primary transition-colors",children:o}),l&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:l})]})]})}function Cr(){var _,P;const o=Y(),{signOut:l,user:s}=U(),{t:r,lang:x}=D(),i=q(),[n,u]=a.useState(!1),[g,b]=a.useState("manual"),{data:c}=W({queryKey:["worker-work-prefs",s==null?void 0:s.id],queryFn:async()=>{const{data:t}=await O.from("worker_profiles").select("years_experience, has_own_tools, has_transportation, travel_radius_miles").eq("user_id",s.id).single();return t},enabled:!!(s!=null&&s.id)}),[d,j]=a.useState(""),[p,f]=a.useState(""),[m,w]=a.useState(null),[k,N]=a.useState(null),[v,S]=a.useState(!1);a.useEffect(()=>{c&&(j(c.years_experience??""),f(c.has_own_tools??""),w(c.has_transportation??null),N(c.travel_radius_miles??null))},[c]);const H=async()=>{if(s!=null&&s.id){S(!0);try{const t={years_experience:d||null,has_own_tools:p||null,has_transportation:m,travel_radius_miles:k},{error:y}=await O.from("worker_profiles").upsert({user_id:s.id,...t},{onConflict:"user_id"});if(y)throw y;await i.invalidateQueries({queryKey:["worker-work-prefs",s.id]}),await i.invalidateQueries({queryKey:["worker-profile"]}),E.success(r.pass2.preferencesSaved)}catch{E.error(r.pass2.failedToSave)}finally{S(!1)}}},C=t=>{b(t),u(!0)},{referralsHighlighted:K}=xe({openShareDialog:C}),Q=async()=>{await l(),o("/auth",{replace:!0})},h=({icon:t,label:y})=>e.jsxs("div",{className:"flex items-center gap-2 px-1 pt-2",children:[e.jsx(t,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:y})]});return e.jsxs(e.Fragment,{children:[e.jsx(B,{title:"Settings · Knuckl",description:"Manage your Knuckl preferences, account, and legal settings."}),e.jsxs("div",{className:"max-w-2xl mx-auto px-4 pt-3 pb-12 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>o(-1),"aria-label":r.aria.back,className:"w-10 h-10 flex items-center justify-center rounded-full hover:bg-accent transition-colors",children:e.jsx(ce,{className:"w-5 h-5 text-foreground"})}),e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:r.common.settings})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx(h,{icon:de,label:r.contractorProfile.preferences}),e.jsx(z,{}),e.jsxs("div",{className:"bg-card border border-border/60 rounded-card p-4 space-y-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:((_=r.worker)==null?void 0:_.language)??"Language"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:((P=r.worker)==null?void 0:P.chooseLanguage)??"Choose your language"})]}),e.jsx(fe,{size:"sm"})]}),e.jsx(M,{role:"worker"}),e.jsx(Z,{}),e.jsx(G,{}),e.jsx(J,{}),e.jsx(X,{}),e.jsx(ee,{}),e.jsx(re,{}),e.jsx(ge,{label:r.workerSettings.inviteCrew,hint:r.workerSettings.inviteCrewHint}),e.jsx(ie,{onShare:()=>C("profile_referrals_card"),highlighted:K}),e.jsxs("div",{className:"bg-card border border-border/60 rounded-card p-4 space-y-5",children:[e.jsx("p",{className:"text-caption font-bold uppercase tracking-widest text-muted-foreground",children:r.workPreferences.sectionTitle}),e.jsxs("div",{children:[e.jsx("p",{className:"text-body font-medium text-foreground mb-2",children:r.workPreferences.yearsExpLabel}),e.jsx("div",{className:"flex flex-wrap gap-2",children:["0-1","1-3","3-5","5-10","10+"].map(t=>e.jsxs("button",{type:"button",onClick:()=>j(d===t?"":t),className:`px-3 py-1.5 rounded-full border text-small font-medium transition-colors active:scale-95 ${d===t?"bg-primary text-primary-foreground border-primary":"bg-background border-border text-foreground"}`,children:[t," ",r.workerOnboarding.yearsExpSuffix]},t))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-body font-medium text-foreground mb-2",children:r.workPreferences.ownToolsQuestion}),e.jsx("div",{className:"flex gap-2",children:[{value:"yes",key:"fullKit"},{value:"some",key:"basic"},{value:"no",key:"none"}].map(t=>e.jsx("button",{type:"button",onClick:()=>f(p===t.value?"":t.value),className:`flex-1 py-2 rounded-xl border text-small font-medium transition-colors active:scale-95 ${p===t.value?"bg-primary text-primary-foreground border-primary":"bg-background border-border text-foreground"}`,children:r.workerSettings.toolKit[t.key]},t.value))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-body font-medium text-foreground mb-2",children:r.workPreferences.transportQuestion}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:()=>w(m===!0?null:!0),className:`flex-1 py-2 rounded-xl border text-small font-medium transition-colors active:scale-95 ${m===!0?"bg-primary text-primary-foreground border-primary":"bg-background border-border text-foreground"}`,children:r.workerOnboarding.transportYes}),e.jsx("button",{type:"button",onClick:()=>w(m===!1?null:!1),className:`flex-1 py-2 rounded-xl border text-small font-medium transition-colors active:scale-95 ${m===!1?"bg-primary text-primary-foreground border-primary":"bg-background border-border text-foreground"}`,children:r.workerOnboarding.transportNo})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-body font-medium text-foreground mb-2",children:r.workPreferences.travelQuestion}),e.jsx("div",{className:"grid grid-cols-4 gap-2",children:[5,10,25,50].map(t=>e.jsxs("button",{type:"button",onClick:()=>N(k===t?null:t),className:`py-2 rounded-xl border text-small font-medium transition-colors active:scale-95 ${k===t?"bg-primary text-primary-foreground border-primary":"bg-background border-border text-foreground"}`,children:[t," mi"]},t))})]}),e.jsx("button",{type:"button",onClick:H,disabled:v,className:"w-full h-11 rounded-full bg-primary text-primary-foreground text-title font-semibold disabled:opacity-50 active:scale-[0.97] transition-transform",children:v?r.workPreferences.saving:r.workPreferences.saveButton})]})]}),e.jsx(te,{}),e.jsx(se,{}),e.jsxs("section",{className:"space-y-3",children:[e.jsx(h,{icon:$,label:r.workerSettings.dangerZone}),e.jsx(oe,{})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx(h,{icon:T,label:r.settings.helpSupport.label}),e.jsxs("button",{type:"button",onClick:()=>o("/contact"),className:"w-full flex items-center justify-between px-4 min-h-[48px] py-3 rounded-card bg-card border border-border/60 hover:border-primary/30 transition-all text-left",children:[e.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(T,{className:"w-4 h-4 text-muted-foreground shrink-0"}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block text-sm text-foreground",children:r.settings.helpSupport.label}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:r.settings.helpSupport.hint})]})]}),e.jsx(R,{className:"w-4 h-4 text-muted-foreground shrink-0"})]}),e.jsxs("button",{type:"button",onClick:()=>F(),className:"w-full flex items-center justify-between px-4 min-h-[48px] py-3 rounded-card bg-card border border-border/60 hover:border-primary/30 transition-all text-left",children:[e.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(me,{className:"w-4 h-4 text-muted-foreground shrink-0"}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block text-sm text-foreground",children:r.feedback.settingsTitle}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:r.feedback.settingsDesc})]})]}),e.jsx(R,{className:"w-4 h-4 text-muted-foreground shrink-0"})]})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx(h,{icon:A,label:r.contractorProfile.legal}),e.jsxs("button",{type:"button",onClick:()=>o("/terms"),className:"w-full flex items-center justify-between px-4 min-h-[48px] py-3 rounded-card bg-card border border-border/60 hover:border-primary/30 transition-all text-sm text-foreground",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(A,{className:"w-4 h-4 text-muted-foreground"}),r.workerSettings.termsAndPrivacy]}),e.jsx(ue,{className:"w-3.5 h-3.5 text-muted-foreground"})]}),e.jsxs("button",{onClick:Q,className:"w-full flex items-center justify-center gap-2 min-h-[48px] py-3.5 rounded-card bg-card border border-border/60 text-destructive text-sm font-semibold hover:bg-accent transition-all",children:[e.jsx(pe,{className:"w-4 h-4"}),r.common.signOut]})]})]}),e.jsx(le,{open:n,onOpenChange:u,source:g})]})}
1export{Cr 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.