PageSourceSearch

https://app.kaksha.ai/assets/index-CXTOYMSf.js

js kaksha.ai collected 2026-10-05 15:37:10 UTC 11,435 bytes, 1 lines download raw bytes

1import{by as f,a_ as q,bC as E,bz as M,a$ as G,j as e,aA as j,a as n,b as o,c,d as i,e as x,aY as I,B as b,h as A,f as w,t as F,bD as O,r as S,F as T,T as g,m as p,o as v,aw as U,S as Q,bE as R,w as W,ay as _,bF as V}from"./index-CikpnCPq.js";import{I as u}from"./index-BwjBiYk8.js";import{S as H}from"./switch-CgG8H_Uo.js";import{A as X,a as Y,b as J}from"./avatar-C3iluZf1.js";import{C as Z}from"./circle-x-BJJIu7VL.js";import{C as ee}from"./circle-plus-BgqGNqPm.js";const N="v1/profile",se=()=>f.get(N),ae=a=>f.patch(`${N}/student`,a),re=a=>f.patch(`${N}/teacher`,a),y={me:["profile","me"]},D={updateStudent:["updateStudentProfile"],updateTeacher:["updateTeacherProfile"]},te=()=>q({queryKey:y.me,queryFn:se,staleTime:G,retry:!1}),le=()=>{const a=E();return M({mutationKey:D.updateStudent,mutationFn:d=>ae(d),onSuccess:()=>{a.invalidateQueries({queryKey:y.me})}})},ne=()=>{const a=E();return M({mutationKey:D.updateTeacher,mutationFn:d=>re(d),onSuccess:()=>{a.invalidateQueries({queryKey:y.me})}})},oe=()=>e.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-6 px-4 py-8",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(j,{className:"h-16 w-16 rounded-full"}),e.jsx(j,{className:"h-6 w-48 rounded-full"})]}),Array.from({length:6}).map((a,d)=>e.jsxs("div",{className:"grid gap-2",children:[e.jsx(j,{className:"h-4 w-24 rounded-full"}),e.jsx(j,{className:"h-10 w-full rounded-md"})]},d))]}),z=({control:a,name:d,displayName:t})=>e.jsx(n,{control:a,name:d,render:({field:r})=>{var h;return e.jsxs(o,{className:"w-full",children:[e.jsx(c,{children:"Avatar URL"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(X,{className:"h-16 w-16",children:[e.jsx(Y,{src:r.value||void 0,alt:t}),e.jsx(J,{children:((h=t==null?void 0:t.charAt(0))==null?void 0:h.toUpperCase())||"?"})]}),e.jsx(i,{children:e.jsx(u,{placeholder:"https://example.com/avatar.png",value:r.value??"",onChange:s=>r.onChange(s.target.value)})})]}),e.jsx(x,{})]})}}),m=({control:a,name:d,label:t,placeholder:r,addLabel:h="Add"})=>{const{fields:s,append:l,remove:B}=I({control:a,name:d});return e.jsxs("div",{children:[e.jsx(c,{children:t}),s.map((K,L)=>e.jsx(n,{control:a,name:`${d}.${L}`,render:({field:P})=>e.jsxs(o,{className:"group mt-2 w-full",children:[e.jsx(i,{children:e.jsxs("div",{className:"relative",children:[e.jsx(u,{placeholder:r,value:P.value??"",onChange:$=>P.onChange($.target.value)}),e.jsx("button",{type:"button","aria-label":`Remove ${t} entry`,onClick:()=>B(L),className:"invisible absolute bottom-0 right-3 top-0 flex cursor-pointer items-center justify-center group-hover:visible",children:e.jsx(Z,{className:"size-4"})})]})}),e.jsx(x,{})]})},K.id)),e.jsxs(b,{type:"button",variant:"outline",size:"sm",className:"mt-2 flex w-full gap-2",onClick:()=>l(""),children:[e.jsx(ee,{className:"size-4"}),h]})]})},C=a=>({firstName:a.firstName??"",lastName:a.lastName??"",preferredName:a.preferredName??"",contact:a.contact??"",description:a.description??"",targetExam:a.targetExam??"",targetExamDate:a.targetExamDate?a.targetExamDate.slice(0,10):"",targetScore:a.targetScore??"",isExamBooked:a.isExamBooked??!1,avatarUrl:a.avatarUrl??"",location:a.location??"",githubUrl:a.githubUrl??"",externalLinks:a.externalLinks??[],socialMedia:a.socialMedia??[]}),ce=({profile:a})=>{const{toast:d}=A(),t=le(),r=w({resolver:F(O),defaultValues:C(a)});S.useEffect(()=>{r.reset(C(a))},[a,r]);const h=async s=>{if(!t.isPending)try{await t.mutateAsync({...s,targetExamDate:s.targetExamDate||null,externalLinks:(s.externalLinks??[]).filter(l=>l.trim().length>0),socialMedia:(s.socialMedia??[]).filter(l=>l.trim().length>0)}),d({title:"Profile updated"})}catch(l){d({title:"Could not update profile",description:l instanceof Error?l.message:void 0,variant:"destructive"})}};return e.jsx(T,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit(h),className:"mx-auto flex w-full max-w-2xl flex-col gap-6 px-4 py-8",children:[e.jsx(g,{size:v.LG,fontWeight:p.BOLD,children:"Student Profile"}),e.jsx(z,{control:r.control,name:"avatarUrl",displayName:a.firstName||"Student"}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[e.jsx(n,{control:r.control,name:"firstName",render:({field:s})=>e.jsxs(o,{children:[e.jsx(c,{children:"First Name"}),e.jsx(i,{children:e.jsx(u,{...s,value:s.value??""})}),e.jsx(x,{})]})}),e.jsx(n,{control:r.control,name:"lastName",render:({field:s})=>e.jsxs(o,{children:[e.jsx(c,{children:"Last Name"}),e.jsx(i,{children:e.jsx(u,{...s,value:s.value??""})}),e.jsx(x,{})]})})]}),e.jsx(n,{control:r.control,name:"preferredName",render:({field:s})=>e.jsxs(o,{children:[e.jsx(c,{children:"Preferred Name"}),e.jsx(i,{children:e.jsx(u,{placeholder:"What should we call you?",...s,value:s.value??""})}),e.jsx(x,{})]})}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[e.jsx(n,{control:r.control,name:"contact",render:({field:s})=>e.jsxs(o,{children:[e.jsx(c,{children:"Phone"}),e.jsx(i,{children:e.jsx(u,{...s,value:s.value??""})}),e.jsx(x,{})]})}),e.jsx(n,{control:r.control,name:"location",render:({field:s})=>e.jsxs(o,{children:[e.jsx(c,{children:"Location"}),e.jsx(i,{children:e.jsx(u,{placeholder:"City, Country",...s,value:s.value??""})}),e.jsx(x,{})]})})]}),e.jsx(n,{control:r.control,name:"description",render:({field:s})=>e.jsxs(o,{children:[e.jsx(c,{children:"About Me"}),e.jsx(i,{children:e.jsx(U,{rows:4,placeholder:"A short bio",...s,value:s.value??""})}),e.jsx(x,{})]})}),e.jsx(n,{control:r.control,name:"githubUrl",render:({field:s})=>e.jsxs(o,{children:[e.jsx(c,{children:"GitHub"}),e.jsx(i,{children:e.jsx(u,{placeholder:"https://github.com/yourhandle",...s,value:s.value??""})}),e.jsx(x,{})]})}),e.jsx(m,{control:r.control,name:"externalLinks",label:"External Links",placeholder:"https://...",addLabel:"Add Link"}),e.jsx(m,{control:r.control,name:"socialMedia",label:"Social Media",placeholder:"https://...",addLabel:"Add Social Link"}),e.jsx(Q,{}
1),e.jsx(g,{size:v.MD,fontWeight:p.BOLD,children:"Exam Details"}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[e.jsx(n,{control:r.control,name:"targetExam",render:({field:s})=>e.jsxs(o,{children:[e.jsx(c,{children:"Target Exam"}),e.jsx(i,{children:e.jsx(u,{placeholder:"e.g. GMAT",...s,value:s.value??""})}),e.jsx(x,{})]})}),e.jsx(n,{control:r.control,name:"targetScore",render:({field:s})=>e.jsxs(o,{children:[e.jsx(c,{children:"Target Score"}),e.jsx(i,{children:e.jsx(u,{...s,value:s.value??""})}),e.jsx(x,{})]})})]}),e.jsx(n,{control:r.control,name:"targetExamDate",render:({field:s})=>e.jsxs(o,{children:[e.jsx(c,{children:"Target Exam Date"}),e.jsx(i,{children:e.jsx(u,{type:"date",...s,value:s.value??""})}),e.jsx(x,{})]})}),e.jsx(n,{control:r.control,name:"isExamBooked",render:({field:s})=>e.jsxs(o,{className:"flex items-center justify-between rounded-md border p-3",children:[e.jsx(c,{className:"!mt-0",children:"Exam Booked"}),e.jsx(i,{children:e.jsx(H,{checked:s.value??!1,onCheckedChange:s.onChange})})]})}),e.jsx(b,{type:"submit",disabled:t.isPending,className:"w-fit",children:t.isPending?"Saving…":"Save Profile"})]})})},k=a=>({firstName:a.firstName??"",lastName:a.lastName??"",tagline:a.tagline??"",contact:a.contact??"",description:a.description??"",avatarUrl:a.avatarUrl??"",location:a.location??"",skills:a.skills??[],languages:a.languages??[],googleScholarUrl:a.googleScholarUrl??"",preferredContactMethods:a.preferredContactMethods??[],externalLinks:a.externalLinks??[],socialMedia:a.socialMedia??[],profileSlug:a.profileSlug??""}),ie=({profile:a})=>{const{toast:d}=A(),t=ne(),r=w({resolver:F(R),defaultValues:k(a)});S.useEffect(()=>{r.reset(k(a))},[a,r]);const h=async s=>{if(!t.isPending)try{await t.mutateAsync({...s,profileSlug:s.profileSlug||null,skills:(s.skills??[]).filter(l=>l.trim().length>0),languages:(s.languages??[]).filter(l=>l.trim().length>0),preferredContactMethods:(s.preferredContactMethods??[]).filter(l=>l.trim().length>0),externalLinks:(s.externalLinks??[]).filter(l=>l.trim().length>0),socialMedia:(s.socialMedia??[]).filter(l=>l.trim().length>0)}),d({title:"Profile updated"})}catch(l){d({title:"Could not update profile",description:l instanceof Error?l.message:void 0,variant:"destructive"})}};return e.jsx(T,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit(h),className:"mx-auto flex w-full max-w-2xl flex-col gap-6 px-4 py-8",children:[e.jsx(g,{size:v.LG,fontWeight:p.BOLD,children:"Teacher Profile"}),e.jsx(z,{control:r.control,name:"avatarUrl",displayName:a.firstName||"Teacher"}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[e.jsx(n,{control:r.control,name:"firstName",render:({field:s})=>e.jsxs(o,{children:[e.jsx(c,{children:"First Name"}),e.jsx(i,{children:e.jsx(u,{...s,value:s.value??""})}),e.jsx(x,{})]})}),e.jsx(n,{control:r.control,name:"lastName",render:({field:s})=>e.jsxs(o,{children:[e.jsx(c,{children:"Last Name"}),e.jsx(i,{children:e.jsx(u,{...s,value:s.value??""})}),e.jsx(x,{})]})})]}),e.jsx(n,{control:r.control,name:"tagline",render:({field:s})=>e.jsxs(o,{children:[e.jsx(c,{children:"Tagline"}),e.jsx(i,{children:e.jsx(u,{placeholder:"e.g. Math teacher",...s,value:s.value??""})}),e.jsx(x,{})]})}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[e.jsx(n,{control:r.control,name:"contact",render:({field:s})=>e.jsxs(o,{children:[e.jsx(c,{children:"Phone"}),e.jsx(i,{children:e.jsx(u,{...s,value:s.value??""})}),e.jsx(x,{})]})}),e.jsx(n,{control:r.control,name:"location",render:({field:s})=>e.jsxs(o,{children:[e.jsx(c,{children:"Location"}),e.jsx(i,{children:e.jsx(u,{placeholder:"City, Country",...s,value:s.value??""})}),e.jsx(x,{})]})})]}),e.jsx(n,{control:r.control,name:"description",render:({field:s})=>e.jsxs(o,{children:[e.jsx(c,{children:"About Me"}),e.jsx(i,{children:e.jsx(U,{rows:4,placeholder:"A short bio",...s,value:s.value??""})}),e.jsx(x,{})]})}),e.jsx(m,{control:r.control,name:"skills",label:"Areas of Expertise",addLabel:"Add Skill"}),e.jsx(m,{control:r.control,name:"languages",label:"Languages",addLabel:"Add Language"}),e.jsx(m,{control:r.control,name:"preferredContactMethods",label:"Preferred Contact Methods",placeholder:"e.g. email, chat",addLabel:"Add Method"}),e.jsx(n,{control:r.control,name:"googleScholarUrl",render:({field:s})=>e.jsxs(o,{children:[e.jsx(c,{children:"Google Scholar"}),e.jsx(i,{children:e.jsx(u,{placeholder:"https://scholar.google.com/...",...s,value:s.value??""})}),e.jsx(x,{})]})}),e.jsx(m,{control:r.control,name:"externalLinks",label:"External Links",placeholder:"https://...",addLabel:"Add Link"}),e.jsx(m,{control:r.control,name:"socialMedia",label:"Social Media",placeholder:"https://...",addLabel:"Add Social Link"}),e.jsx(n,{control:r.control,name:"profileSlug",render:({field:s})=>e.jsxs(o,{children:[e.jsx(c,{children:"Profile URL"}),e.jsx(i,{children:e.jsx(u,{placeholder:"theresa-flores",...s,value:s.value??""})}),e.jsx(x,{})]})}),e.jsx(b,{type:"submit",disabled:t.isPending,className:"w-fit",children:t.isPending?"Saving…":"Save Profile"})]})})},ge=()=>{const{session:a}=W(),{setNavbarTitle:d}=_(),{data:t,isLoading:r,isError:h}=te();return S.useEffect(()=>(d("Profile"),()=>{d("")}),[d]),r?e.jsx(oe,{}):h||!t?e.jsx("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-2 px-4 py-8",children:e.jsx(g,{size:v.MD,children:"Could not load your profile. Please refresh the page."})}):V(a)?e.jsx(ie,{profile:t}):e.jsx(ce,{profile:t})};export{ge 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.