PageSourceSearch

https://xterns.ai/assets/XternSkillUpdateWizard-BiXGiUbs.js

js xterns.ai collected 2026-10-05 13:24:24 UTC 12,051 bytes, 1 lines download raw bytes

1import{u as re,f as ae,r as i,j as e,aK as z,bt as I,bu as $,aZ as te,B as o,h as x,i as h,k as u,F as J,l as v,m as p,J as L,A as g,t as w,ad as le,n as ne,S as ie,x as ce,s as E,g as j}from"./index-DLd_kDlx.js";import{u as de,S as O,Q as F,g as K}from"./useSkillUpdateSession-COerTTEz.js";import{L as C}from"./loader-circle-D2miE2xB.js";import{C as me}from"./chevron-left-Wewsh5d7.js";import{P as Q}from"./plus-0WhrdjYO.js";import{B as oe}from"./brain-pqum15ho.js";import{S as xe}from"./star-BH1OFEcs.js";import"./dareyScoreProfileSync-Bj-bhG5E.js";const be=()=>{const f=re(),{user:N}=ae(),{loadOrCreateSession:T,isLoading:y}=de(),[_,V]=i.useState([]),[n,U]=i.useState(null),[b,X]=i.useState([]),[H,R]=i.useState(!0),[S,q]=i.useState([]),[G,P]=i.useState([]),[c,k]=i.useState(null),[Y,B]=i.useState(!1);i.useEffect(()=>{(async()=>{if(N){R(!0);try{const{data:r}=await E.from("xterns_profiles").select("skill_proficiencies, preferred_roles").eq("user_id",N.id).maybeSingle();if(r!=null&&r.skill_proficiencies){const d=r.skill_proficiencies.filter(l=>l.name&&l.proficiency<5).map(l=>({name:l.name,proficiency:l.proficiency||1}));V(d)}r!=null&&r.preferred_roles&&Array.isArray(r.preferred_roles)&&q(r.preferred_roles.slice(0,2));const{data:t}=await E.from("xtern_skill_update_sessions").select("*").eq("user_id",N.id).eq("status","in_progress").order("updated_at",{ascending:!1});t&&X(t.map(a=>({id:a.id,userId:a.user_id,techStackName:a.tech_stack_name,currentProficiency:a.current_proficiency,targetProficiency:a.target_proficiency,currentLevel:a.current_level,completedLevels:a.completed_levels||[],overallScorePercentage:a.overall_score_percentage||0,status:a.status,startedAt:a.started_at,completedAt:a.completed_at})))}catch(r){console.error("Error loading data:",r)}finally{R(!1)}}})()},[N]);const M=s=>{q(r=>r.includes(s)?r.filter(t=>t!==s):r.length>=2?(j.error("Maximum 2 career paths allowed"),r):[...r,s]),P([]),k(null)},W=async()=>{if(S.length===0){j.error("Please select at least one career path");return}B(!0),P([]),k(null);try{const{data:s,error:r}=await E.functions.invoke("generate-assessment-tech-stacks",{body:{careerPaths:S}});if(r)throw r;if(s!=null&&s.techStacks&&Array.isArray(s.techStacks)){const t=_.map(l=>l.name.toLowerCase()),a=b.map(l=>l.techStackName.toLowerCase()),d=s.techStacks.filter(l=>{var D;const A=(D=l.name)==null?void 0:D.toLowerCase();return A&&!t.includes(A)&&!a.includes(A)});P(d),d.length===0?j.info("All generated tech stacks are already in your skills"):j.success(`Generated ${d.length} new tech stack${d.length>1?"s":""}`)}}catch(s){console.error("Error generating tech stacks:",s),j.error("Failed to generate tech stacks")}finally{B(!1)}},Z=async()=>{if(!n)return;const s=await T(n.name,n.proficiency);s&&f(`/xterns/skill-update-assessment?session=${s.id}`)},ee=async()=>{if(!c)return;const s=await T(c.name,0);s&&f(`/xterns/skill-update-assessment?session=${s.id}`)},se=s=>{f(`/xterns/skill-update-assessment?session=${s.id}`)},m=(s,r="md")=>e.jsx("div",{className:"flex items-center gap-0.5",children:Array.from({length:5}).map((t,a)=>e.jsx(xe,{className:w(r==="sm"?"w-3 h-3":"w-4 h-4",a<s?"fill-yellow-400 text-yellow-400":"text-muted-foreground/30")},a))});return H?e.jsxs(z,{children:[e.jsx(I,{}),e.jsx($,{children:e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(C,{className:"w-8 h-8 animate-spin text-primary"})})})]}):e.jsxs(z,{children:[e.jsx(I,{}),e.jsxs($,{children:[e.jsxs("header",{className:"sticky top-0 z-10 flex h-14 shrink-0 items-center gap-2 border-b bg-background px-4",children:[e.jsx(te,{className:"-ml-1"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("h1",{className:"text-lg font-semibold",children:"Skill Update Assessment"})}),e.jsx("div",{className:"ml-auto",children:e.jsxs(o,{variant:"ghost",size:"sm",onClick:()=>f("/xterns/ei-tracker"),children:[e.jsx(me,{className:"w-4 h-4 mr-1"}),"Back to Skill Tracker"]})})]}),e.jsxs("div",{className:"container max-w-4xl mx-auto py-8 space-y-6",children:[e.jsx("div",{children:e.jsx("p",{className:"text-muted-foreground",children:"Upgrade your proficiency level by completing 6 assessment levels"})}),b.length>0&&e.jsxs(x,{className:"border-primary/50 bg-primary/5",children:[e.jsxs(h,{children:[e.jsxs(u,{className:"text-lg flex items-center gap-2",children:[e.jsx(J,{className:"w-5 h-5 text-primary"}),"Continue Your Progress"]}),e.jsx(v,{children:"You have skill updates in progress. Resume where you left off."})]}),e.jsx(p,{className:"space-y-3",children:b.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-4 bg-background rounded-lg border",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:s.techStackName}),e.jsxs(L,{variant:"outline",className:"text-xs",children:["Level ",s.currentLevel," of 6"]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsxs("span",{children:["Current: ",m(s.currentProficiency,"sm")]}),e.jsx(g,{className:"w-3 h-3"}),e.jsxs("span",{children:["Target: ",m(s.targetProficiency,"sm")]})]})]}),e.jsxs(o,{onClick:()=>se(s),children:["Resume",e.jsx(g,{className:"w-4 h-4 ml-1"})]})]},s.id))})]}),e.jsxs(x,{children:[e.jsxs(h,{children:[e.jsx(u,{children:"Select Skill to Upgrade"}),e.jsx(v,{children:"Choose a skill to increase its proficiency level. You can only upgrade one level at a time."})]}),e.jsx(p,{className:"space-y-4",children:_.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(J,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"No skills available for upgrade."}),e.jsx("p",{className:"text-sm mt-1",children:"Complete your onboarding assessment first."})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:_.map(s=>{const r=(n==null?void 0:n.name)===s.name,t=b.some(a=>a.techStackName===s.name);return e.jsxs("button",{onClick:()=>{t||(U(s),k(null))},disabled:t,className:w("p-4 rounded-lg border text-left transition-all",r&&"border-primary bg-primary/5 ring-2 ring-primary",!r&&!t&&"hover:border-primary/50 hover:bg-muted/50",t&&"opacity-50 cursor-not-allowed"),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"font-medium",children:s.name}),t&&e.jsx(L,{variant:"secondary",className:"text-xs",children:"In Progress"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Current:"}),m(s.proficiency,"sm"),e.jsx(g,{className:"w-3 h-3 text-muted-foreground"}),m(s.proficiency+1,"sm")]})]},s.name)})})})]}),e.jsxs(x,{children:[e.jsxs(h,{children:[e.jsxs(u,{className:"flex items-center gap-2",children:[e.jsx(Q,{className:"w-5 h-5 text-primary"}),"Add New Tech Stack"]}),e.jsx(v,{children:"Generate tech stacks based on your career path and complete 6 assessment levels to add a new skill with proficiency level 1"})]}),e.jsxs(p,{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium mb-3",children:"Select Career Paths (max 2)"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:le.map(s=>
1{const r=S.includes(s.id);return e.jsxs("label",{className:w("flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-all",r&&"border-primary bg-primary/5",!r&&"hover:border-primary/50 hover:bg-muted/50"),children:[e.jsx(ne,{checked:r,onCheckedChange:()=>M(s.id),className:"mt-0.5"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-sm",children:s.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:s.description})]})]},s.id)})})]}),e.jsxs(o,{onClick:W,disabled:S.length===0||Y,className:"w-full",children:[Y?e.jsx(C,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(oe,{className:"w-4 h-4 mr-2"}),"Generate Tech Stacks"]}),G.length>0&&e.jsxs("div",{children:[e.jsxs("h4",{className:"font-medium mb-3 flex items-center gap-2",children:[e.jsx(ie,{className:"w-4 h-4 text-primary"}),"Generated Tech Stacks"]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:G.map(s=>{const r=(c==null?void 0:c.name)===s.name;return e.jsxs("button",{onClick:()=>{k(s),U(null)},className:w("p-4 rounded-lg border text-left transition-all",r&&"border-primary bg-primary/5 ring-2 ring-primary",!r&&"hover:border-primary/50 hover:bg-muted/50"),children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-medium",children:s.name}),e.jsx(L,{variant:"secondary",className:"text-xs",children:"New"})]}),s.description&&e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description}),e.jsxs("div",{className:"flex items-center gap-2 text-sm mt-2",children:[e.jsx("span",{className:"text-muted-foreground",children:"Target:"}),m(1,"sm")]})]},s.name)})})]})]})]}),n&&!c&&e.jsxs(x,{children:[e.jsx(h,{children:e.jsxs(u,{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"w-5 h-5 text-primary"}),"Upgrade ",n.name]})}),e.jsxs(p,{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium mb-3",children:"Your 6-Level Journey"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:O.map(s=>e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded bg-muted/50",children:[e.jsx("span",{className:"w-6 h-6 rounded-full bg-primary/20 text-primary text-xs flex items-center justify-center font-medium",children:s.number}),e.jsx("span",{className:"text-sm",children:s.name})]},s.number))})]}),e.jsxs("div",{className:"bg-muted rounded-lg p-4 space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Requirements"}),e.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsxs("li",{children:["• Complete all 6 levels (",F," questions each, 30 total)"]}),e.jsxs("li",{children:["• Required score: ",K(n.proficiency+1),"% per level"]}),e.jsx("li",{children:"• 3 minutes per level"}),e.jsx("li",{children:"• You can save and resume between levels"})]})]}),e.jsxs(o,{className:"w-full",size:"lg",onClick:Z,disabled:y,children:[y?e.jsx(C,{className:"w-4 h-4 mr-2 animate-spin"}):null,"Start Skill Update Assessment",e.jsx(g,{className:"w-4 h-4 ml-2"})]})]})]}),c&&e.jsxs(x,{className:"border-green-500/50 bg-green-500/5",children:[e.jsxs(h,{children:[e.jsxs(u,{className:"flex items-center gap-2",children:[e.jsx(Q,{className:"w-5 h-5 text-green-600"}),"Add ",c.name," to Your Skills"]}),e.jsx(v,{children:"Complete all 6 levels to add this tech stack with proficiency level 1"})]}),e.jsxs(p,{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium mb-3",children:"Your 6-Level Journey"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:O.map(s=>e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded bg-muted/50",children:[e.jsx("span",{className:"w-6 h-6 rounded-full bg-green-500/20 text-green-600 text-xs flex items-center justify-center font-medium",children:s.number}),e.jsx("span",{className:"text-sm",children:s.name})]},s.number))})]}),e.jsxs("div",{className:"bg-green-500/10 border border-green-500/30 rounded-lg p-4 space-y-2",children:[e.jsx("h4",{className:"font-medium text-green-700 dark:text-green-400",children:"Adding a New Skill"}),e.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsxs("li",{children:["• Complete all 6 levels (",F," questions each, 30 total)"]}),e.jsxs("li",{children:["• Required score: ",K(1),"% per level"]}),e.jsx("li",{children:"• 3 minutes per level"}),e.jsx("li",{children:"• Upon completion, this skill will be added with proficiency level 1"})]})]}),e.jsxs(o,{className:"w-full bg-green-600 hover:bg-green-700",size:"lg",onClick:ee,disabled:y,children:[y?e.jsx(C,{className:"w-4 h-4 mr-2 animate-spin"}):null,"Start New Skill Assessment",e.jsx(g,{className:"w-4 h-4 ml-2"})]})]})]})]})]})]})};export{be 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.