PageSourceSearch

https://letsknock.ai/app/assets/ProgressTracking-7ePU4op2.js

js letsknock.ai collected 2026-10-05 15:23:00 UTC 10,523 bytes, 1 lines download raw bytes

1import{u as k,a as N,s as y,j as e}from"./index-DJUqd4bY.js";import{h as S,b as f,L as C}from"./router-DCC30OjP.js";import{A as D}from"./AppHeader-Ds4T0wHQ.js";import{u as L}from"./useBackoffice-DKEnBHAx.js";import"./Logo_small-B8M67nsZ.js";import"./useLogin-D612JpkX.js";function M(r){return r.split(" ").map(l=>l[0]).join("").toUpperCase()}function $(r){return r>=75?"text-emerald-500":r>=40?"text-amber-500":"text-rose-500"}function A(r){return r>=75?"from-emerald-400 to-emerald-500":r>=40?"from-amber-400 to-amber-500":"from-rose-400 to-rose-500"}function P(r){const l=["from-tropical-teal to-teal-600","from-amber-400 to-amber-600","from-emerald-400 to-emerald-600","from-rose-400 to-rose-600"];return l[r%l.length]}const W=r=>{if(!r)return"Not yet active";const l=new Date(r);if(isNaN(l.getTime()))return"Not yet active";const n=Math.floor((new Date().getTime()-l.getTime())/1e3);if(n<60)return"just now";const i=Math.floor(n/60);if(i<60)return`${i} minute${i===1?"":"s"} ago`;const o=Math.floor(i/60);if(o<24)return`${o} hour${o===1?"":"s"} ago`;const g=new Date(r).setHours(0,0,0,0),p=new Date().setHours(0,0,0,0),c=Math.round((p-g)/(1e3*60*60*24));return c===0?"today":`${c} day${c===1?"":"s"} ago`},T=r=>{const l=new Set(r.map(i=>new Date(i.created_at).toDateString()));let x=0,n=new Date;for(;l.has(n.toDateString());)x++,n.setDate(n.getDate()-1);return x},E=()=>{const r=k(),{fetchCourseCompanyStats:l}=L(),{courseUuid:x}=S(),[n,i]=f.useState(!1),[o,g]=f.useState(),p=N(s=>s.authentication.user),c=N(s=>s.course.current);return f.useEffect(()=>{!p||n||o?.students?.length||!location.pathname.startsWith("/app/progress/")||(x||c)&&(i(!0),l(x??c.id).then(s=>{const{course:d,attendees:h}=s.data;g({students:h.map(a=>{const b=a.sessions.map(t=>t.score).reduce((t,m)=>t+m,0),u=a.sessions?.reverse()[0],v=a.sessions.map(t=>t.score_delivery).reduce((t,m)=>t+m,0)??0,j=a.sessions.map(t=>t.score_cadence).reduce((t,m)=>t+m,0)??0,w=a.sessions.map(t=>t.data?.cadence?.avgWpm??0).reduce((t,m)=>t+m,0)??0;return{id:a.id,name:a.name,role:a.id===p.id?"Sales Rep":"Trainee",overallProgress:b?b/a.sessions.length:0,sectionsCompleted:Array.from(new Set(a.sessions.filter(t=>t.successfully_completed).map(t=>t.section_id))).length,totalSections:d.sections.length,totalSessions:a.sessions.length,creditsLeft:a.credits_left??u?.credits_left??0,creditsUsed:a.credits_used??0,streak:T(a.sessions),avgDeliveryScore:v?v/a.sessions.length:0,avgCadenceScore:j?j/a.sessions.length:0,avgWpm:w?w/a.sessions.length:0,lastActive:u?W(u.created_at):"Not yet active"}})}),c||r.dispatch(y(d))}).finally(()=>i(!1)))},[p,x,c,n,o?.students]),e.jsxs("div",{className:"min-h-screen flex flex-col bg-aqua-bg",children:[e.jsx(D,{}),o?.students&&e.jsx("main",{className:"flex-1 container mx-auto p-4 md:p-6",children:e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"bg-white rounded-2xl p-6 shadow-sm border border-slate-200/60",children:[e.jsx("h2",{className:"text-2xl font-extrabold text-prussian-blue uppercase tracking-tight",children:"Progress Tracking"}),e.jsx("p",{className:"text-slate-500 mt-1",children:"Monitor your team's training progress and performance."})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-white rounded-xl p-4 border border-slate-200/60 shadow-sm text-center",children:[e.jsx("p",{className:"text-xs text-slate-400 uppercase tracking-widest font-bold mb-1",children:"Team Members"}),e.jsx("p",{className:"text-3xl font-extrabold text-prussian-blue",children:o.students.length})]}),e.jsxs("div",{className:"bg-white rounded-xl p-4 border border-slate-200/60 shadow-sm text-center",children:[e.jsx("p",{className:"text-xs text-slate-400 uppercase tracking-widest font-bold mb-1",children:"Avg. Progress"}),e.jsxs("p",{className:"text-3xl font-extrabold text-tropical-teal",children:[Math.round(o.students.reduce((s,d)=>s+d.overallProgress,0)/o.students.length),"%"]})]}),e.jsxs("div",{className:"bg-white rounded-xl p-4 border border-slate-200/60 shadow-sm text-center",children:[e.jsx("p",{className:"text-xs text-slate-400 uppercase tracking-widest font-bold mb-1",children:"Total Sessions"}),e.jsx("p",{className:"text-3xl font-extrabold text-prussian-blue",children:o.students.reduce((s,d)=>s+d.totalSessions,0)})]}),e.jsxs("div",{className:"bg-white rounded-xl p-4 border border-slate-200/60 shadow-sm text-center",children:[e.jsx("p",{className:"text-xs text-slate-400 uppercase tracking-widest font-bold mb-1",children:"Active Today"}),e.jsx("p",{className:"text-3xl font-extrabold text-emerald-500",children:o.students.filter(s=>s.lastActive.includes("hour")).length})]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:o.students.map((s,d)=>e.jsxs(C,{to:`/app/progress/${s.id}`,className:"bg-white rounded-2xl border border-slate-200/60 shadow-sm p-4 md:p-6 group hover:shadow-lg hover:border-tropical-teal/50 hover:shadow-tropical-teal/10 transition-all duration-300",children:[e.jsxs("div",{className:"flex items-center gap-3 md:gap-4 mb-3",children:[e.jsx("div",{className:`w-10 h-10 md:w-14 md:h-14 roun
1ded-xl bg-gradient-to-br ${P(d)} flex items-center justify-center text-white font-extrabold text-sm md:text-lg shrink-0 shadow-lg`,children:s.id==="myself"?e.jsx("svg",{className:"w-5 h-5 md:w-7 md:h-7",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})}):M(s.name)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-base md:text-lg font-extrabold text-prussian-blue leading-tight",children:s.name}),e.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[e.jsx("span",{className:"bg-prussian-blue/5 px-2 md:px-3 py-0.5 rounded-full text-[9px] md:text-[10px] font-bold text-prussian-blue/70 uppercase tracking-wider md:tracking-widest",children:s.role}),e.jsxs("span",{className:"text-[11px] md:text-xs text-slate-400 truncate",children:["Active ",s.lastActive]})]})]}),e.jsxs("span",{className:`text-lg md:text-xl font-extrabold shrink-0 ${$(s.overallProgress)}`,children:[s.overallProgress,"%"]})]}),e.jsx("div",{className:"w-full bg-slate-100 rounded-full h-2 mb-3",children:e.jsx("div",{className:`h-2 rounded-full bg-gradient-to-r ${A(s.overallProgress)} transition-all duration-500`,style:{width:`${s.overallProgress}%`}})}),e.jsxs("div",{className:"flex items-center gap-2 mb-3 bg-amber-50 rounded-lg px-3 py-1.5",children:[e.jsx("div",{className:"w-4 h-4 rounded-full bg-gradient-to-br from-amber-300 to-amber-500 flex items-center justify-center shrink-0",children:e.jsx("span",{className:"block w-2 h-2 rounded-full border border-amber-600/40 bg-gradient-to-br from-amber-200/80 to-amber-400/60"})}),e.jsxs("span",{className:"text-xs font-bold text-amber-700",children:[s.creditsLeft," credits left"]}),e.jsx("button",{onClick:h=>h.preventDefault(),className:"ml-auto w-5 h-5 rounded-full bg-amber-200 hover:bg-amber-300 flex items-center justify-center transition-colors shrink-0",children:e.jsx("svg",{className:"w-3 h-3 text-amber-700",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M12 4v16m8-8H4"})})})]}),e.jsxs("div",{className:"flex items-center gap-2 md:gap-3 mb-3",children:[e.jsxs("div",{className:`flex-1 rounded-lg px-2 md:px-3 py-1.5 text-center ${s.avgDeliveryScore>70?"bg-green-50":s.avgDeliveryScore>40?"bg-yellow-50":"bg-red-50"}`,children:[e.jsx("span",{className:"text-[9px] md:text-[10px] text-slate-500 uppercase tracking-wider md:tracking-widest font-bold block leading-tight",children:"Delivery"}),e.jsxs("span",{className:`text-sm font-extrabold ${s.avgDeliveryScore>70?"text-green-600":s.avgDeliveryScore>40?"text-yellow-600":"text-red-600"}`,children:[s.avgDeliveryScore,"%"]})]}),e.jsxs("div",{className:`flex-1 rounded-lg px-2 md:px-3 py-1.5 text-center ${s.avgCadenceScore>70?"bg-green-50":s.avgCadenceScore>40?"bg-yellow-50":"bg-red-50"}`,children:[e.jsx("span",{className:"text-[9px] md:text-[10px] text-slate-500 uppercase tracking-wider md:tracking-widest font-bold block leading-tight",children:"Cadence"}),e.jsxs("span",{className:`text-sm font-extrabold ${s.avgCadenceScore>70?"text-green-600":s.avgCadenceScore>40?"text-yellow-600":"text-red-600"}`,children:[s.avgCadenceScore,"%"]})]}),e.jsxs("div",{className:"flex-1 rounded-lg px-2 md:px-3 py-1.5 text-center bg-slate-50",children:[e.jsx("span",{className:"text-[9px] md:text-[10px] text-slate-500 uppercase tracking-wider md:tracking-widest font-bold block leading-tight",children:"Avg WPM"}),e.jsx("span",{className:"text-sm font-extrabold text-prussian-blue",children:s.avgWpm})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:flex md:items-center gap-x-3 gap-y-1.5 md:gap-4 text-[11px] md:text-xs text-slate-500",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),s.sectionsCompleted,"/",s.totalSections," sections"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),s.streak," day streak"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"})}),s.totalSessions," sessions"]}),e.jsxs("span",{className:"flex items-center gap-1 text-amber-500",children:[e.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),s.creditsUsed," used"]})]})]},s.id))})]})})]})};export{E 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.