import{j as e}from"./app-BI7hSYr0.js";import{A as n}from"./AppLayout-ahz_yU39.js";function l(t,i){const r=t/i*100;return r>=70?"var(--color-primary-active)":r>=50?"#f59e0b":"#ef4444"}function d(t,i){const r=t/i*100;return r>=85?"عالی":r>=70?"خوب":r>=50?"متوسط":"ضعیف"}function x({grades:t,average:i}){return e.jsx(n,{title:"نمرات",children:e.jsxs("div",{className:"page-stack",children:[e.jsxs("section",{className:"section-header",children:[e.jsxs("div",{children:[e.jsxs("h2",{children:[e.jsx("i",{className:"bi bi-patch-check",style:{marginLeft:"0.5rem",color:"var(--color-primary)"}}),"نمرات"]}),e.jsx("p",{children:"نمرات تأیید شده توسط مدرسه"})]}),i!==null&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",background:"var(--color-primary-soft)",borderRadius:"var(--radius-md)",padding:"0.75rem 1.25rem",minWidth:100},children:[e.jsx("span",{style:{fontSize:"0.8rem",color:"var(--color-text-muted)"},children:"میانگین کل"}),e.jsx("strong",{style:{fontSize:"1.5rem",color:"var(--color-primary-active)",lineHeight:1.2},children:i.toFixed(1)}),e.jsx("span",{style:{fontSize:"0.75rem",color:"var(--color-text-muted)"},children:"از ۲۰"})]})]}),t.length===0?e.jsx("section",{className:"panel-card",children:e.jsxs("div",{style:{textAlign:"center",padding:"2rem 1rem"},children:[e.jsx("div",{className:"icon-badge",style:{width:56,height:56,fontSize:"1.5rem",margin:"0 auto 1rem"},children:e.jsx("i",{className:"bi bi-patch-check"})}),e.jsx("h2",{children:"نمره‌ای ثبت نشده"}),e.jsx("p",{children:"هنوز نمره‌ای برای شما تأیید نشده است."})]})}):e.jsx("section",{className:"panel-card",style:{padding:0,overflow:"hidden"},children:e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{className:"data-table",style:{width:"100%"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"درس"}),e.jsx("th",{children:"امتحان"}),e.jsx("th",{children:"نمره"}),e.jsx("th",{children:"وضعیت"}),e.jsx("th",{children:"تاریخ تأیید"}),e.jsx("th",{children:"توضیحات"})]})}),e.jsx("tbody",{children:t.map(r=>{const c=r.score/r.maxScore*20,o=Math.round(r.score/r.maxScore*100),s=l(r.score,r.maxScore);return e.jsxs("tr",{children:[e.jsx("td",{style:{fontWeight:600},children:r.subject}),e.jsx("td",{style:{color:"var(--color-text-muted)",fontSize:"0.875rem"},children:r.examTitle??"—"}),e.jsxs("td",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[e.jsx("strong",{style:{color:s,fontSize:"1rem",minWidth:40},children:r.score.toFixed(1)}),e.jsxs("span",{style:{color:"var(--color-text-muted)",fontSize:"0.8rem"},children:["/ ",r.maxScore]}),e.jsx("div",{style:{flex:1,minWidth:60,height:6,background:"var(--color-border)",borderRadius:99,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${o}%`,background:s,borderRadius:99,transition:"width 0.4s"}})}),e.jsxs("span",{style:{fontSize:"0.8rem",color:"var(--color-text-muted)",minWidth:28},children:[o,"٪"]})]}),r.maxScore!==20&&e.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--color-text-muted)",marginTop:"0.15rem"},children:["معادل ۲۰: ",c.toFixed(1)]})]}),e.jsx("td",{children:e.jsx("span",{style:{background:s+"20",color:s,border:`1px solid ${s}40`,borderRadius:"var(--radius-sm)",padding:"0.15rem 0.5rem",fontSize:"0.8rem",fontWeight:600},children:d(r.score,r.maxScore)})}),e.jsx("td",{style:{color:"var(--color-text-muted)",fontSize:"0.85rem",whiteSpace:"nowrap"},children:r.approvedAt}),e.jsx("td",{style:{color:"var(--color-text-muted)",fontSize:"0.85rem"},children:r.description??"—"})]},r.id)})})]})})})]})})}export{x as default};
