PageSourceSearch

https://brinx.ai/assets/user.subject-plans._index-CXN_Gbe7.js

js brinx.ai collected 2026-10-05 13:01:13 UTC 9,988 bytes, 1 lines download raw bytes

1import{r as o,j as e}from"./jsx-runtime-BZuK4Oxm.js";import{g as P,z as L}from"./utils-C6F7_Qdj.js";import{F as m}from"./FieldError-BntfS1FO.js";import{a as B}from"./seo-CgU8sAT5.js";import{A as z}from"./AiDisclosureNotice-DIC58GYn.js";import{d as N,C as $,i as T}from"./CrisisSupportNotice-pyRKDEYC.js";import{u as M}from"./components-BiGCuXRG.js";import{u as O,a as I}from"./index-C_q7mA0g.js";import{P as _}from"./plus-CnoQSSaA.js";import{G as k}from"./graduation-cap-CWJtuucN.js";import{B as G}from"./book-open-65B05rZY.js";import{C as R}from"./clock-DB0Li0N9.js";import{L as U}from"./loader-circle-GWeQVhjB.js";import"./index-CyL33P5D.js";import"./sparkles-BRoMn5JZ.js";import"./createLucideIcon-Kfy6jOGh.js";import"./index-Dks-47pC.js";const ie=()=>B("My Subject Plans","Create and manage your curriculum subject plans on BrinX.ai."),F={draft:{label:"Draft",color:"#6B7280",bg:"#F3F4F6"},reviewing_lessons:{label:"Reviewing Lessons",color:"#D97706",bg:"#FEF3C7"},lessons_approved:{label:"Lessons Approved",color:"#2563EB",bg:"#DBEAFE"},reviewing_modules:{label:"Reviewing Modules",color:"#D97706",bg:"#FEF3C7"},modules_approved:{label:"Modules Approved",color:"#2563EB",bg:"#DBEAFE"},los_approved:{label:"LOs Approved",color:"#7C3AED",bg:"#EDE9FE"},generating:{label:"Generating",color:"#EA580C",bg:"#FFF7ED"},completed:{label:"Completed",color:"#16A34A",bg:"#DCFCE7"},partially_completed:{label:"Partial",color:"#CA8A04",bg:"#FEF9C3"},error:{label:"Error",color:"#DC2626",bg:"#FEE2E2"}};function ne(){const{plans:h,user:u}=M(),{showToast:i}=O(),S=I(),[E,n]=o.useState(!1),[w,p]=o.useState(null),[s,x]=o.useState({subject_code:"",subject_name:"",description:"",total_weeks:"",department:""}),[b,v]=o.useState(!1),[a,c]=o.useState({}),d=(t,r)=>{x(l=>({...l,[t]:r})),a[t]&&c(l=>({...l,[t]:void 0}))},y=()=>{p(null),n(!1),c({})},D=async t=>{var C;if(N(`${s.subject_name} ${s.description}`)){(C=t==null?void 0:t.preventDefault)==null||C.call(t);return}t.preventDefault();const r=P().safeParse(s);if(!r.success){c(L(r.error));return}c({});const l=r.data;v(!0);try{const j={"X-User-Id":u.user_uuid||u.user_id||u.user_identifier||"","Content-Type":"application/json"},f=await fetch("/api/subject-plans",{method:"POST",headers:j,body:JSON.stringify({subject_code:l.subject_code,subject_name:l.subject_name,description:l.description||void 0,total_weeks:typeof l.total_weeks=="number"?l.total_weeks:void 0,department:s.department.trim()||void 0})});if(!f.ok){const A=await f.json();i(A.error||"Failed to create plan",!1);return}const g=await f.json();if(T(g)){p(g),i(g.message,!1);return}i("Subject plan created successfully"),y(),x({subject_code:"",subject_name:"",description:"",total_weeks:"",department:""}),window.location.reload()}catch(j){i("Failed to create plan: "+j.message,!1)}finally{v(!1)}};return e.jsxs("div",{style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[e.jsxs("div",{className:"tw-flex tw-items-center tw-justify-between tw-mb-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"tw-text-2xl tw-font-semibold tw-m-0",style:{color:"var(--text-primary, #1a1a1a)"},children:"Subject Plans"}),e.jsx("p",{className:"tw-text-sm tw-m-0 tw-mt-1",style:{color:"var(--text-muted, #9ca3af)"},children:"Create and manage curriculum plans with AI-generated lessons and courses"})]}),e.jsxs("button",{className:"tw-btn-primary tw-flex tw-items-center tw-gap-2",onClick:()=>n(!0),children:[e.jsx(_,{size:18}),"New Plan"]})]}),h.length>0?e.jsx("div",{className:"tw-grid tw-gap-4",style:{gridTemplateColumns:"repeat(auto-fill, minmax(320px, 1fr))"},children:h.map(t=>{const r=F[t.status]||F.draft;return e.jsxs("div",{className:"tw-card-gamma tw-p-5 tw-cursor-pointer tw-group",onClick:()=>S(`/user/subject-plans/${t.id}`),children:[e.jsxs("div",{className:"tw-flex tw-items-start tw-justify-between tw-mb-3",children:[e.jsxs("div",{className:"tw-flex tw-items-center tw-gap-3",children:[e.jsx("div",{className:"tw-w-10 tw-h-10 tw-rounded-button tw-flex tw-items-center tw-justify-center tw-flex-shrink-0",style:{backgroundColor:"#F5F3FF"},children:e.jsx(k,{size:20,style:{color:"#7C3AED"}})}),e.jsx("div",{children:e.jsx("span",{className:"tw-text-xs tw-font-medium tw-px-2 tw-py-0.5 tw-rounded-pill",style:{backgroundColor:"#F3F4F6",color:"#6B7280"},children:t.subject_code})})]}),e.jsx("span",{className:"tw-text-xs tw-font-medium tw-px-2 tw-py-0.5 tw-rounded-pill",style:{backgroundColor:r.bg,color:r.color},children:r.label})]}),e.jsx("h3",{className:"tw-text-base tw-font-semibold tw-m-0 tw-mb-1 tw-truncate",style:{color:"var(--text-primary, #1a1a1a)"},title:t.subject_name,children:t.subject_name}),t.description&&e.jsx("p",{className:"tw-text-sm tw-m-0 tw-mb-3",style:{color:"var(--text-muted, #9ca3af)",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:t.description}),e.jsxs("div",{className:"tw-flex tw-items-center tw-gap-4 tw-text-xs tw-mt-3 tw-pt-3 tw-border-t tw-border-solid",style:{color:"var(--text-muted, #9ca3af)",borderColor:"var(--border-primary, #e5e7eb)"},children:[e.jsxs("span",{className:"tw-flex tw-items-center tw-gap-1",children:[e.jsx(G,{size:14}),t.total_lessons," lessons"]}),t.department&&e.jsx("span",{children:t.department}),e.jsxs("span",{className:"tw-ml-auto tw-flex tw-items-center tw-gap-1",children:[e.jsx(R,{size:14}),new Date(t.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric"})]})]})]},t.id)})}):e.jsxs("div",{className:"tw-text-center tw-py-16",style:{color:"var(--text-muted, #9ca3af)"},children:[e.jsx(k,{size:48,strokeWidth:1.5,style:{color:"var(--text-faint, #d1d5db)",margin:"0 auto 16px",display:"block"}}),e.jsx("p",{className:"tw-text-base tw-font-medium tw-mb-1",style:{color:"var(--text-secondary, #4a5568)"},children:"No subject plans yet"}),e.jsx("p",{className:"tw-text-sm tw-mb-4",children:"Create your first curriculum plan to get started"}),e.jsxs("button",{className:"tw-btn-primary tw-flex tw-items-center tw-gap-2 tw-mx-auto",onClick:()=>n(!0),children:[e.jsx(_,{size:18}),"Create First Plan"]})]}),E&&e.jsx("div",{className:"tw-fixed tw-inset-0 tw-z-50 tw-flex tw-items-center tw-justify-center",style:{backgroundColor:"rgba(0,0,0,0.5)"},onClick:t=>{t.target===t.currentTarget&&n(!1)},children:e.jsxs("div",{className:"tw-rounded-modal tw-p-6 tw-w-full tw-max-w-lg tw-mx-4",style:{backgroundColor:"var(--surface-primary, #ffffff)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.25)"},children:[e.jsx("h2",{className:"tw-text-xl tw-font-semibold tw-m-0 tw-mb-5",style:{color:"var(--text-primary, #1a1a1a)"},children:"New Subject Plan"}),e.jsxs("form",{onSubmit:D,children:[e.jsxs("div",{className:"tw-flex tw-flex-col tw-gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"tw-text-sm tw-font-medium tw-mb-1 tw-block",style:{color:"var(--text-primary, #1a1a1a)"},children:"Subject Code *"}),e.jsx("input",{type:"text",className:`tw-input-gamma tw-w-full${a.subject_code?" tw-input-gamma--invalid":""}`,"aria-invalid":a.subject_code?"true":"false","aria-describedby":a.subject_code?"plan-subject-code-error":void 0,placeholder:"e.g. CS101",value:s.subject_code,onChange:t=>d("subject_code",t.target.value),required:!0,minLength:2,maxLength:20}),e.jsx(m,{id:"plan-subject-code-error",children:a.subject_code})]}),e.jsxs("div",{children:[e.jsx("label",{className:"tw-text-sm tw-font-medium tw-mb-1 tw-block",style:{color:"var(--text-primary, #1a1a1a)"},children:"Subject Name *"}),e.jsx("input",{type:"text",className:`tw-input-gamma tw-w-full${a.subject_name?" tw-input-gamma--invalid":""}`,"aria-invalid":a.subject_name?"true":"false","aria-describedby":a.subject_name?"plan-subject-name-error":void 0,placeholder:"e.g. Introduction to Computer Science",value:s.subject_name,onChange:t=>d("subject_name",t.target.value),required:!0,minLength:2,maxLength:120}),e.jsx(m,{id:"plan-subject-name-error",children:a.subject_name})]}),e.jsxs("div",{children:[e.jsx("label",{className:"tw-text-sm tw-font-medium tw-mb-1 tw-block",style:{color:"var(--text-primary, #1a1a1a)"},children:"Description"}),e.jsx("textarea",{className:`tw-input-gamma tw-w-full${a.description?" tw-input-gamma--invalid":""}`,"aria-invalid":a.description?"true":"false","aria-describedby":a.description?"plan-description-error":void 0,rows:3,placeholder:"Brief description of the subject...",value:s.description,onChange:t=>d("description",t.target.value),maxLength:2e3}),e.jsx(m,{id:"plan-description-error",children:a.description}),e.jsx(z,{context:"curriculum",className:"tw-mt-2"}),(N(`${s.subject_name} ${s.description}`)||w)&&e.jsx($,{payload:w,onDismiss:w?()=>p(null):void 0})]}
1),e.jsxs("div",{className:"tw-grid tw-grid-cols-2 tw-gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"tw-text-sm tw-font-medium tw-mb-1 tw-block",style:{color:"var(--text-primary, #1a1a1a)"},children:"Department"}),e.jsx("input",{type:"text",className:"tw-input-gamma tw-w-full",placeholder:"e.g. Computer Science",value:s.department,onChange:t=>x({...s,department:t.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"tw-text-sm tw-font-medium tw-mb-1 tw-block",style:{color:"var(--text-primary, #1a1a1a)"},children:"Total Weeks"}),e.jsx("input",{type:"number",className:`tw-input-gamma tw-w-full${a.total_weeks?" tw-input-gamma--invalid":""}`,"aria-invalid":a.total_weeks?"true":"false","aria-describedby":a.total_weeks?"plan-total-weeks-error":void 0,placeholder:"e.g. 16",min:"1",max:"52",step:"1",value:s.total_weeks,onChange:t=>d("total_weeks",t.target.value)}),e.jsx(m,{id:"plan-total-weeks-error",children:a.total_weeks})]})]})]}),e.jsxs("div",{className:"tw-flex tw-justify-end tw-gap-3 tw-mt-6",children:[e.jsx("button",{type:"button",className:"tw-btn-ghost",onClick:y,children:"Cancel"}),e.jsxs("button",{type:"submit",className:"tw-btn-primary tw-flex tw-items-center tw-gap-2",disabled:b,children:[b&&e.jsx(U,{size:16,className:"tw-animate-spin"}),b?"Creating...":"Create Plan"]})]})]})]})})]})}export{ne as default,ie as meta};

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.