1import{c as _,u as C,r as l,ch as T,ci as M,j as e,am as x,U as E,I as n,bM as m,X as u,A as f,ar as j,ap as S,aq as A,W as L,aK as D,B as R,h as z,al as G}from"./index-XxZ7LJbz.js";import{P as W}from"./PageHeader-gdhc76u6.js";import{r as I,s as p,X as v,Y as y,t as $,R as F,v as P,T as Y}from"./generateCategoricalChart-CgjX_n9N.js";import"./arrow-left-DhUnvVRI.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 H=_("Hourglass",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]);var B=I({chartName:"LineChart",GraphicalChild:p,axisComponents:[{axisType:"xAxis",AxisComp:v},{axisType:"yAxis",AxisComp:y}],formatAxisMap:$});function N(t){return t==null?"text-muted-foreground":t>=3.5?"text-success":t>=3?"text-foreground":t>=2.5?"text-warning":"text-destructive"}function g(t){return t==null?"-":t>=80?"Heavy":t>=60?"Moderate-high":t>=40?"Moderate":"Light"}function J(){const t=C(),[a,o]=l.useState(null),[b,k]=l.useState(!0),c=T(typeof window<"u"?window.location.pathname:"");l.useEffect(()=>{document.title="Timeline · Canvas Companion",(async()=>{try{const s=await M();o(s)}finally{k(!1)}})()},[]);const h=l.useMemo(()=>a?[...a.semesters].filter(s=>s.term_gpa!=null).sort((s,r)=>(s.start_date??"").localeCompare(r.start_date??"")).map(s=>({name:s.name.replace(/(\w+) (\d+)/,"$1 '$2").replace(/'20/,"'"),term:s.term_gpa,cumulative:s.cumulative_gpa})):[],[a]),i=(a==null?void 0:a.semesters.find(s=>s.is_current))??(a==null?void 0:a.semesters[a.semesters.length-1])??null;return e.jsxs("main",{className:"min-h-screen bg-background",children:[e.jsx(W,{eyebrow:"ACADEMIC TIMELINE",title:"Your academic journey",subtitle:"Term-by-term progress, patterns, and growth.",backTo:x("/dashboard",c)}),e.jsxs("div",{className:"mx-auto max-w-4xl px-4 sm:px-6 py-6 space-y-6",children:[b?e.jsx(E,{children:e.jsxs("div",{className:"space-y-4","aria-busy":"true","aria-label":"Loading timeline",children:[e.jsxs(n,{className:"p-6 space-y-3",children:[e.jsx("div",{className:"shimmer h-4 w-1/4 rounded"}),e.jsx("div",{className:"shimmer h-48 w-full rounded"})]}),[0,1].map(s=>e.jsxs(n,{className:"p-6 space-y-2",children:[e.jsx("div",{className:"shimmer h-4 w-1/3 rounded"}),e.jsx("div",{className:"shimmer h-3 w-2/3 rounded"})]},s))]})}):!a||a.semesters.length===0?e.jsx(O,{}):e.jsxs(e.Fragment,{children:[(()=>{const s=[...a.semesters].filter(r=>r.end_date&&new Date(r.end_date).getTime()<=Date.now()).sort((r,w)=>(w.end_date??"").localeCompare(r.end_date??""))[0];return s?e.jsx(m.button,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},transition:{duration:.4},onClick:()=>t(x(`/timeline/wrapped/${s.id}`,c)),className:"group w-full text-left rounded-xl overflow-hidden relative border border-primary/30 bg-gradient-to-r from-primary/15 via-primary/5 to-background hover:border-primary/50 transition-colors",children:e.jsxs("div",{className:"px-4 sm:px-5 py-3.5 flex items-center gap-3",children:[e.jsx("div",{className:"size-9 rounded-full bg-primary/20 grid place-items-center shrink-0",children:e.jsx(u,{className:"size-4 text-primary"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-mono text-[10px] tracking-[0.22em] text-primary",children:"NEW"}),e.jsxs("div",{className:"text-sm font-semibold truncate",children:["Your ",s.name," Wrapped is ready"]})]}),e.jsx(f,{className:"size-4 text-primary transition-transform group-hover:translate-x-0.5"})]})}):null})(),i&&e.jsx(m.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.4},children:e.jsxs(n,{className:"p-6 md:p-8 bg-gradient-to-br from-primary/10 via-background to-background border-primary/20",children:[e.jsx("div",{className:"font-mono text-[10px] tracking-[0.22em] text-primary mb-2",children:i.is_current?"THIS TERM":"MOST RECENT TERM"}),e.jsxs("div",{className:"flex items-end gap-4 flex-wrap",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl md:text-3xl font-bold tracking-tight",children:i.name}),e.jsxs("div",{className:"text-sm text-muted-foreground mt-1",children:[i.course_count," courses · ",i.total_assignments," assignments"]})]}),e.jsxs("div",{className:"ml-auto text-right",children:[e.jsx("div",{className:`text-4xl md:text-5xl font-bold tabular-nums ${N(i.term_gpa)}`,children:i.term_gpa!=null?i.term_gpa.toFixed(2):"-"}),e.jsx("div",{className:"font-mono text-[10px] tracking-[0.2em] text-muted-foreground mt-1",children:"TERM GPA"})]})]}),i.cumulative_gpa!=null&&e.jsxs("div",{className:"mt-4 pt-4 border-t border-border/60 text-sm text-muted-foreground flex items-center gap-2",children:[e.jsx(j,{className:"size-4 text-primary"}),"Cumulative GPA ",e.jsx("span",{className:"font-semibold text-foreground tabular-nums",children:i.cumulative_gpa.toFixed(2)})]})]})}),h.length>=2&&e.jsxs(n,{className:"p-5 md:p-6",children:[e.jsx("div",{className:"flex items-center justify-between mb-4",children:e.jsxs("div",{children:[e.jsx("div",{className:"font-mono text-[10px] tracking-[0.22em] text-muted-foreground",children:"GPA TREND"}),e.jsx("h3",{className:"text-base font-semibold tracking-tight",children:"Term vs. cumulative"})]})}),e.jsx("div",{className:"h-[220px] -ml-2",children:e.jsx(F,{width:"100%",height:"100%",children:e.jsxs(B,{data:h,margin:{top:8,right:12,left:0,bottom:0},children:[e.jsx(P,{stroke:"hsl(var(--border))",strokeDasharray:"3 3",vertical:!1}),e.jsx(v,{dataKey:"name",tick:{fill:"hsl(var(--muted-foreground))",fontSize:11}
6,axisLine:!1,tickLine:!1}),e.jsx(y,{domain:[0,4],ticks:[0,1,2,3,4],tick:{fill:"hsl(var(--muted-foreground))",fontSize:11},axisLine:!1,tickLine:!1,width:32}),e.jsx(Y,{contentStyle:{background:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:8,fontSize:12},labelStyle:{color:"hsl(var(--muted-foreground))"}}),e.jsx(p,{type:"monotone",dataKey:"term",stroke:"hsl(var(--primary))",strokeWidth:2.5,dot:{r:4,fill:"hsl(var(--primary))"},name:"Term"}),e.jsx(p,{type:"monotone",dataKey:"cumulative",stroke:"hsl(var(--muted-foreground))",strokeWidth:1.5,strokeDasharray:"4 4",dot:!1,name:"Cumulative"})]})})})]}),a.insights.length>0&&e.jsxs(n,{className:"p-5 md:p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(u,{className:"size-4 text-primary"}),e.jsx("h3",{className:"text-base font-semibold tracking-tight",children:"What we're noticing"})]}),e.jsx("ul",{className:"space-y-2.5",children:a.insights.map((s,r)=>e.jsxs(m.li,{initial:{opacity:0,x:-6},animate:{opacity:1,x:0},transition:{delay:r*.05},className:"flex gap-3 text-sm leading-snug",children:[e.jsx("span",{className:`mt-1.5 inline-block size-1.5 rounded-full shrink-0 ${s.tone==="positive"?"bg-success":s.tone==="info"?"bg-primary":"bg-muted-foreground"}`}),e.jsx("span",{children:s.text})]},s.id))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"font-mono text-[10px] tracking-[0.22em] text-muted-foreground mb-3 px-1",children:"SEMESTERS"}),e.jsx("div",{className:"space-y-3",children:[...a.semesters].sort((s,r)=>(r.start_date??"").localeCompare(s.start_date??"")).map((s,r)=>e.jsx(K,{sem:s,index:r,onWrapped:()=>t(x(`/timeline/wrapped/${s.id}`,c))},s.id))})]})]}),e.jsx(S,{})]})]})}function K({sem:t,index:a,onWrapped:o}){return e.jsx(m.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:a*.04,duration:.3},children:e.jsxs(n,{className:"p-5 md:p-6 hover:border-primary/40 transition-colors group",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 flex-wrap",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:"text-lg font-semibold tracking-tight",children:t.name}),t.is_current&&e.jsx(A,{variant:"outline",className:"text-[10px] font-mono tracking-[0.18em] border-primary/40 text-primary",children:"CURRENT"})]}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-0.5",children:[t.course_count," courses · workload ",g(t.workload_score).toLowerCase()]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:`text-2xl font-bold tabular-nums ${N(t.term_gpa)}`,children:t.term_gpa!=null?t.term_gpa.toFixed(2):"-"}),e.jsx("div",{className:"font-mono text-[9px] tracking-[0.2em] text-muted-foreground",children:"TERM GPA"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mt-5 pt-4 border-t border-border/60",children:[e.jsx(d,{icon:L,label:"Cumulative",value:t.cumulative_gpa!=null?t.cumulative_gpa.toFixed(2):"-"}),e.jsx(d,{icon:D,label:"Completion",value:t.completion_rate!=null?`${Math.round(t.completion_rate)}%`:"-"}),e.jsx(d,{icon:R,label:"Assignments",value:String(t.total_assignments??0)}),e.jsx(d,{icon:j,label:"Workload",value:g(t.workload_score)})]}),(t.hardest_course||t.strongest_course)&&e.jsxs("div",{className:"mt-4 grid sm:grid-cols-2 gap-2 text-xs",children:[t.strongest_course&&e.jsxs("div",{className:"rounded-lg bg-success/10 border border-success/20 px-3 py-2",children:[e.jsx("div",{className:"font-mono text-[9px] tracking-[0.2em] text-success/80",children:"STRONGEST"}),e.jsx("div",{className:"text-foreground font-medium truncate",children:t.strongest_course})]}),t.hardest_course&&e.jsxs("div",{className:"rounded-lg bg-warning/10 border border-warning/20 px-3 py-2",children:[e.jsx("div",{className:"font-mono text-[9px] tracking-[0.2em] text-warning/90",children:"MOST DEMANDING"}),e.jsx("div",{className:"text-foreground font-medium truncate",children:t.hardest_course})]})]}),e.jsx("div",{className:"mt-4 flex justify-end",children:e.jsxs(z,{variant:"ghost",size:"sm",onClick:o,className:"gap-1.5",children:[e.jsx(u,{className:"size-3.5"})," View Wrapped ",e.jsx(f,{className:"size-3.5 transition-transform group-hover:translate-x-0.5"})]})})]})})}function d({icon:t,label:a,value:o}){return e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(t,{className:"size-3"}),e.jsx("span",{className:"font-mono text-[9px] tracking-[0.2em]",children:a.toUpperCase()})]}),e.jsx("div",{className:"text-sm font-semibold tabular-nums mt-0.5 truncate",children:o})]})}function O(){return e.jsxs(n,{className:"p-10 text-center bg-gradient-to-br from-primary/5 to-background border-primary/15",children:[e.jsx("div",{className:"mx-auto h-14 w-14 roun
6ded-full bg-primary/10 flex items-center justify-center mb-5",children:e.jsx(H,{className:"size-6 text-primary"})}),e.jsx("h2",{className:"text-xl font-semibold tracking-tight",children:"Your timeline starts now"}),e.jsx("p",{className:"mt-3 text-sm text-muted-foreground max-w-md mx-auto leading-relaxed",children:"Stick around - every term you sync becomes part of a long-term picture of your growth, completion habits, and strongest subjects. Your first semester archive will appear here when this term wraps up."}),G()&&e.jsx("p",{className:"mt-4 text-xs text-muted-foreground/80",children:"In demo mode you can preview a multi-semester journey with sample data."})]})}export{J 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.