PageSourceSearch

https://theonlineprintcoach.com/assets/CoachSettings-DpRx3heU.js

js theonlineprintcoach.com collected 2026-10-07 02:11:37 UTC 4,914 bytes, 6 lines download raw bytes

1import{c as H,d as T,r as o,j as e,e as g,I as i,B as u,S as b,l as w,m as f,n as N,o as l,p as d,s as B}from"./index-CkXulS_j.js";import{w as E,j as I,i as k,y as L}from"./queries-9gGW95Ia.js";import{H as M,P as R,a as m,C as x}from"./HubUI-_0krcTxf.js";import{P as F}from"./plus-8q_y1HTE.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 U=H("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),C=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],K=()=>{const{user:t}=T(),{data:S=[],isLoading:_}=E(),{data:h=[]}=I(),p=k("organisations",[["organisations"],["coach-clients"]]),P=k("coach_availability",[["coach_availability"]]),A=L("coach_availability",[["coach_availability"]]),[c,j]=o.useState(""),[v,y]=o.useState(""),[a,r]=o.useState({weekday:"2",start:"09:00",end:"12:00",minutes:"60"});if(_)return e.jsx(M,{});const V=async()=>{if(c.length<8){d.error("Use at least 8 characters.");return}const{error:s}=await B.auth.updateUser({password:c,current_password:v});if(s){d.error(s.message);return}d.success("Password updated."),j(""),y("")};return e.jsxs("div",{children:[e.jsx(R,{eyebrow:"Settings",title:"Hub settings",description:"Your account and client configuration."}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(m,{title:"Account",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Signed in as ",t==null?void 0:t.email]}),e.jsxs("div",{className:"mt-5 grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(g,{htmlFor:"current-password",children:"Current password"}),e.jsx(i,{id:"current-password",type:"password",className:"mt-2",value:v,onChange:s=>y(s.target.value)})]}),e.jsxs("div",{children:[e.jsx(g,{htmlFor:"new-password",children:"New password"}),e.jsx(i,{id:"new-password",type:"password",className:"mt-2",value:c,onChange:s=>j(s.target.value)})]})]}),e.jsx(u,{className:"mt-4",variant:"outline",onClick:V,children:"Update password"})]}),e.jsxs(m,{title:"Booking availability",description:"The weekly times clients can book sessions from.",children:[h.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No availability set - clients cannot self-book yet."}):h.map(s=>e.jsxs("div",{className:"flex items-center justify-between border-b border-border py-3 last:border-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(x,{tone:"muted",children:C[s.weekday]}),e.jsxs("p",{className:"text-sm",children:[s.start_time.slice(0,5)," - ",s.end_time.slice(0,5)]}),e.jsxs(x,{tone:"muted",children:[s.slot_minutes," min slots"]})]}),e.jsx(u,{size:"sm",variant:"ghost",onClick:()=>A.mutate(s.id),"aria-label":"Remove availability",children:e.jsx(U,{className:"h-4 w-4"})})]},s.id)),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-5",children:[e.jsxs(b,{value:a.weekday,onValueChange:s=>r({...a,weekday:s}),children:[e.jsx(w,{children:e.jsx(f,{})}),e.jsx(N,{children:C.map((s,n)=>e.jsx(l,{value:String(n),children:s},s))})]}),e.jsx(i,{type:"time",value:a.start,onChange:s=>r({...a,start:s.target.value})}),e.jsx(i,{type:"time",value:a.end,onChange:s=>r({...a,end:s.target.value})}),e.jsx(i,{type:"number",min:15,step:15,value:a.minutes,onChange:s=>r({...a,minutes:s.target.value})}),e.jsxs(u,{variant:"outline",onClick:async()=>{await P.mutateAsync({coach_id:t==null?void 0:t.id,weekday:Number(a.weekday),start_time:a.start,end_time:a.end,slot_minutes:Number(a.minutes)||60}),d.success("Availability added.")},children:[e.jsx(F,{className:"mr-2 h-4 w-4"})," Add"]})]})]}),e.jsx(m,{title:"Client configuration",description:"Session cadence and engagement status per client.",children:S.map(s=>e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-border py-4 last:border-0",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.sector??"Print business"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx(x,{tone:"muted",children:"Cadence"}
6),e.jsx(i,{type:"number",min:1,className:"w-20",defaultValue:s.cadence_weeks??4,onBlur:n=>p.mutate({id:s.id,cadence_weeks:Number(n.target.value)||4})}),e.jsxs(b,{defaultValue:s.status,onValueChange:n=>p.mutate({id:s.id,status:n}),children:[e.jsx(w,{className:"w-36",children:e.jsx(f,{})}),e.jsxs(N,{children:[e.jsx(l,{value:"active",children:"Active"}),e.jsx(l,{value:"paused",children:"Paused"}),e.jsx(l,{value:"completed",children:"Completed"})]})]})]})]},s.id))})]})]})};export{K 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.