PageSourceSearch

https://teachmo.ai/assets/FocusTab-DWOff7v8.js

js teachmo.ai collected 2026-10-05 17:10:55 UTC 15,353 bytes, 3 lines download raw bytes

1import{r,j as a}from"./vendor-react-BDlPBQ8H.js";import{t as o}from"./vendor-interactions-B-90v6Vt.js";import{B as m}from"./index-C9I8CK0-.js";import{a as Fe}from"./EnterpriseSurface-CxYSrS8g.js";import{I as z}from"./input-DdZnLe1O.js";import{L as f}from"./label-B__AywUL.js";import{S as U}from"./native-select-Bt4YFc9A.js";import{T as ne}from"./textarea-K_ft2Dhe.js";import{l as le,L as K,g as Ce,R as Se,a as ke,r as Re,b as Ee,c as De,u as He,d as Te,e as Be,s as Le,w as Me,p as Ae}from"./familyReachCopy-ZSQBFoGx.js";import{y as Pe,a as qe,z as _e}from"./vendor-ui-helpers-BA9Ou6yF.js";const oe=[{value:"literacy",label:"Literacy"},{value:"mathematics",label:"Mathematics"},{value:"science",label:"Science"},{value:"social_studies",label:"Social studies"},{value:"language",label:"Language"},{value:"arts",label:"Arts"},{value:"wellbeing",label:"Wellbeing"},{value:"other",label:"Other"},{value:"unknown",label:"Not sure yet"}],de=[{value:"practice",label:"Practice — reinforce what we covered"},{value:"review",label:"Review — revisit earlier material"},{value:"extension",label:"Extension — go a step further"},{value:"pre_teach",label:"Pre-teach — preview what is coming"},{value:"do_not_preteach",label:"Do not pre-teach — hold this back at home"}],Oe={draft:"Draft",shared:"Shared with families",withdrawn:"Withdrawn",superseded:"Replaced"},I={subjectHint:"literacy",gradeBandHint:"",topic:"",mode:"practice",standardRefs:"",requiredMethods:"",prohibitions:""};function $(s,p){return[...new Set(s.split(p).map(b=>b.trim()).filter(Boolean))]}const We=/[\n,]/,ce=/\n/;function G(s){return{subjectHint:s.subjectHint,gradeBandHint:s.gradeBandHint??"",topic:s.topic,mode:s.mode,standardRefs:s.standardRefs.join(", "),requiredMethods:s.requiredMethods.join(`
2`),prohibitions:s.prohibitions.join(`
3`)}}function ue(s){return!!(s.gradeBandHint||s.standardRefs||s.requiredMethods||s.prohibitions)}function ze(s){return{subjectHint:s.subjectHint,gradeBandHint:s.gradeBandHint.trim()||null,topic:s.topic.trim(),mode:s.mode,standardRefs:$(s.standardRefs,We),requiredMethods:$(s.requiredMethods,ce),prohibitions:$(s.prohibitions,ce)}}function J(s){return s instanceof K?s.message:"Could not update the focus right now. Please try again."}function he(s){return s instanceof K?s.message:"Could not load that right now. Please try again."}function me(s){return!!s&&!(s!=null&&s.unavailableReason)}function Ue(s){if(!s)return"";const p=new Date(s);return Number.isNaN(p.getTime())?"":p.toLocaleDateString(void 0,{dateStyle:"medium"})}const Ie=Be;function aa({classroomId:s,otherClassrooms:p=[]}){const[b,Y]=r.useState([]),[C,q]=r.useState("loading"),[pe,Q]=r.useState(null),[g,_]=r.useState(null),[n,d]=r.useState(I),[h,j]=r.useState(!1),[l,S]=r.useState(null),[y,R]=r.useState(null),[V,E]=r.useState("loading"),[O,k]=r.useState(!1),[D,X]=r.useState(""),[W,H]=r.useState(!1),[T,w]=r.useState(null),[v,N]=r.useState(null),[ge,B]=r.useState(!1),u=r.useRef(0),L=r.useRef(0),Z=r.useCallback(async()=>{q("loading"),Q(null);try{Y(await le(s)),q("idle")}catch(e){Q(e instanceof K?e.message:null),q("error")}},[s]),M=r.useCallback(async()=>{const e=++L.current;R(null),E("loading");try{const t=await Ce(s);if(L.current!==e)return;R(t),E("idle")}catch{if(L.current!==e)return;R(null),E("error")}},[s]);r.useEffect(()=>{u.current+=1,Z(),M(),_(null),d(I),k(!1),S(null),X(""),H(!1),B(!1),w(null),N(null)},[Z,M]);const A=e=>{Y(t=>{const i=t.filter(c=>c.id!==e.id),x=e.state==="shared"?i.map(c=>c.state==="shared"?{...c,state:"superseded"}:c):i;return[e,...x]}),T===e.id&&(w(null),N(null))},ee=e=>{if(e){L.current+=1,R(e),E("idle");return}M()},xe=e=>{u.current+=1,H(!1),B(!1),w(null),N(null),_(e),d(G(e)),k(ue(G(e))),S(null)},ae=()=>{_(null),d(I),k(!1)},se=e=>{const t=G(e);d(t),k(ue(t))},P=r.useMemo(()=>{const e=b.filter(t=>t.state!=="draft");return e.length===0?null:[...e].sort((t,i)=>new Date(i.updatedAt).getTime()-new Date(t.updatedAt).getTime())[0]},[b]),fe=()=>{P&&(se(P),o.success("Copied last week's focus. Update the topic if it changed."))},ye=async()=>{if(!D)return;const e=++u.current;H(!0);try{const t=await le(D);if(u.current!==e)return;const i=t.filter(c=>c.state!=="draft"),x=t.find(c=>c.state==="shared")??[...i].sort((c,Ne)=>new Date(Ne.updatedAt).getTime()-new Date(c.updatedAt).getTime())[0]??t[0];if(!x){o.error("That class does not have a focus to copy yet.");return}se(x),o.success("Copied that class's focus. Update the topic if it changed.")}catch(t){if(u.current!==e)return;o.error(he(t))}finally{u.current===e&&H(!1)}},ve=async e=>{if(T===e.id){w(null),N(null);return}const t=++u.current;w(e.id),N(null),B(!0);try{const i=await Ae(s,e.id);if(u.current!==t)return;N(i)}catch(i){if(u.current!==t)return;o.error(he(i)),w(null)}finally{u.current===t&&B(!1)}},te=n.topic.trim().length>0&&!h,be=async e=>{if(e.preventDefault(),!!te){j(!0);try{const t=ze(n);if(g){const i=await He(s,g.id,t);
3A(i.focus),S(i.delivery??null),ee(i.reach),o.success(i.focus.state!=="shared"?"Focus updated.":me(i.delivery)?"Focus updated. Families see the new version.":"Focus updated, but it did not reach families this time -- see the note below.")}else A(await Te(s,t)),o.success("Draft saved. Share it when you are ready.");ae()}catch(t){o.error(J(t))}finally{j(!1)}}},je=async e=>{j(!0);try{const t=await Le(s,e.id);A(t.focus),S(t.delivery??null),ee(t.reach),o.success(me(t.delivery)?"Focus shared with the families in this class.":"Focus saved, but it did not reach families this time -- see the note below.")}catch(t){o.error(J(t))}finally{j(!1)}},we=async e=>{j(!0);try{A(await Me(s,e.id)),S(null),await M(),o.success(e.state==="shared"?"Focus withdrawn. Families no longer see it.":"Draft withdrawn. It stays in this list and can be shared later.")}catch(t){o.error(J(t))}finally{j(!1)}},F=b.find(e=>e.state==="shared")??null,re=b.filter(e=>e.id!==(F==null?void 0:F.id)),ie=e=>{var t,i;return a.jsxs("li",{className:"space-y-2 rounded-xl border border-[var(--enterprise-border)] p-4",children:[a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-gray-900",children:e.topic}),a.jsxs("p",{className:"text-xs text-gray-600",children:[((t=oe.find(x=>x.value===e.subjectHint))==null?void 0:t.label)??e.subjectHint,e.gradeBandHint?` · ${e.gradeBandHint}`:""," · ",((i=de.find(x=>x.value===e.mode))==null?void 0:i.label)??e.mode]})]}),a.jsxs("span",{className:"rounded-full bg-gray-100 px-2 py-1 text-xs font-semibold text-gray-700",children:[Oe[e.state],e.state==="shared"&&e.sharedAt?` · ${Ue(e.sharedAt)}`:"",` · v${e.version}`]})]}),(e.state==="draft"||e.state==="shared"||e.state==="withdrawn")&&a.jsxs("div",{className:"flex flex-wrap gap-2",children:[(e.state==="draft"||e.state==="shared")&&a.jsx(m,{type:"button",size:"sm",variant:"outline",disabled:h,onClick:()=>xe(e),children:"Edit"}),e.state!=="shared"&&a.jsxs(m,{type:"button",size:"sm",className:"gap-1",disabled:h,onClick:()=>void je(e),children:[a.jsx(qe,{className:"h-4 w-4","aria-hidden":"true"}),"Share with families"]}),e.state!=="withdrawn"&&a.jsxs(m,{type:"button",size:"sm",variant:"ghost",className:"gap-1",disabled:h,onClick:()=>void we(e),children:[a.jsx(_e,{className:"h-4 w-4","aria-hidden":"true"}),"Withdraw"]}),a.jsx(m,{type:"button",size:"sm",variant:"ghost",disabled:h,onClick:()=>void ve(e),children:T===e.id?"Hide preview":"Preview for families"})]}),T===e.id&&a.jsx("div",{"aria-label":"Family preview",className:"rounded-lg border border-dashed border-[var(--enterprise-border)] p-3 text-sm",children:ge&&!v?a.jsx("div",{className:"h-16 animate-pulse rounded bg-gray-100"}):v&&a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"font-medium text-gray-900",children:v.copy.title}),a.jsx("p",{className:"mt-1 text-gray-700",children:v.copy.summary}),v.action&&a.jsxs("p",{className:"mt-1 text-gray-600",children:["Suggested activity: ",v.action.label," (",v.action.durationMinutes," min)"]})]})})]},e.id)};return a.jsx(Fe,{title:"Focus",description:"What this class is working on. Only what you share leaves this workspace.",children:a.jsxs("div",{className:"space-y-6",children:[C==="loading"&&a.jsx("div",{className:"h-24 animate-pulse rounded-xl bg-gray-100"}),C==="error"&&a.jsx("div",{className:"rounded-xl border border-red-100 bg-red-50 p-4 text-sm text-red-700",role:"alert",children:pe??"Could not load this class's focus right now. Please retry in a moment."}),C==="idle"&&a.jsxs("section",{"aria-label":"Current focus",className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[a.jsx(Pe,{className:"h-4 w-4","aria-hidden":"true"}),a.jsx("span",{children:F?"Families can see this focus.":"Nothing is shared with families yet."})]}),F&&a.jsx("ul",{className:"space-y-3",children:ie(F)})]}),a.jsx("section",{"aria-label":"Family reach",className:"rounded-xl border border-[var(--enterprise-border)] p-4 text-sm",children:V==="loading"&&!y?a.jsx("div",{role:"status","aria-label":"Checking family reach",className:"h-12 animate-pulse rounded bg-gray-100 motion-reduce:animate-none"}):V==="error"||!y?a.jsx("p",{className:"text-gray-700",role:"status",children:"Teachmo could not check how far this focus reached. Nothing has changed for families; the state will show again once this loads."}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.jsx("h3",{className:"font-medium text-gray-900",children:"Family reach"}),a.jsx("span",{className:"rounded-full bg-gray-100 px-2 py-1 text-xs font-semibold text-gray-700",children:Se[y.state]})]}),a.jsx("p",{className:"mt-1 text-gray-700",children:ke(y.linkedFamilies
3)}),a.jsx("p",{className:"mt-1 text-gray-600",children:Re(y)}),Ee(y)&&a.jsx("p",{className:"mt-1 text-gray-600",children:De(y)})]})}),C==="idle"&&l&&a.jsx("section",{"aria-label":"Delivery receipt",className:"rounded-xl border border-[var(--enterprise-border)] bg-[color-mix(in_srgb,var(--enterprise-primary)_4%,transparent)] p-4 text-sm",children:l.unavailableReason?a.jsx("p",{className:"text-gray-700",children:Ie(l.unavailableReason)}):l.smallCohortSuppressed||l.deliveredFamilies===null||l.skippedWithoutConsent===null?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-gray-700",children:"This class has too few linked families to show a delivery breakdown without identifying one of them, so exact counts are not shown here. The focus was shared with any family that has consented."}),a.jsx("p",{className:"mt-1 text-gray-600",children:l.actionCreated?"Families also received a short suggested activity.":"No family activity was created for this mode -- families only see the explanation."})]}):a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"font-medium text-gray-900",children:["Shared with ",l.deliveredFamilies??0," of ",l.eligibleFamilies," linked ",l.eligibleFamilies===1?"family":"families"]}),(l.skippedWithoutConsent??0)>0&&a.jsxs("p",{className:"mt-1 text-gray-600",children:[l.skippedWithoutConsent," ",l.skippedWithoutConsent===1?"family has":"families have"," not turned on class updates yet."]}),a.jsx("p",{className:"mt-1 text-gray-600",children:l.actionCreated?"Families also received a short suggested activity.":"No family activity was created for this mode -- families only see the explanation."})]})}),a.jsxs("form",{onSubmit:be,className:"space-y-4 rounded-xl border border-[var(--enterprise-border)] p-4","aria-label":g?"Edit focus":"New focus",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-base font-semibold text-gray-900",children:g?`Edit: ${g.topic}`:"New focus"}),a.jsx("p",{className:"text-sm text-gray-600",children:"A short description of the topic and how families should engage. No lesson materials or student data are stored."})]}),!g&&(P||p.length>0)&&a.jsxs("div",{className:"flex flex-wrap items-end gap-2 rounded-lg bg-gray-50 p-3",children:[P&&a.jsx(m,{type:"button",size:"sm",variant:"outline",disabled:h||W,onClick:fe,children:"Copy last week's focus"}),p.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(f,{htmlFor:"focus-copy-class",children:"Copy from another class"}),a.jsxs(U,{id:"focus-copy-class",value:D,onChange:e=>X(e.target.value),children:[a.jsx("option",{value:"",children:"Choose a class…"}),p.map(e=>a.jsx("option",{value:e.id,children:e.name},e.id))]})]}),a.jsx(m,{type:"button",size:"sm",variant:"outline",disabled:!D||h||W,onClick:()=>void ye(),children:W?"Copying…":"Copy"})]})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(f,{htmlFor:"focus-subject",children:"Subject"}),a.jsx(U,{id:"focus-subject",value:n.subjectHint,onChange:e=>d({...n,subjectHint:e.target.value}),children:oe.map(e=>a.jsx("option",{value:e.value,children:e.label},e.value))})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(f,{htmlFor:"focus-topic",children:"Topic"}),a.jsx(z,{id:"focus-topic",value:n.topic,onChange:e=>d({...n,topic:e.target.value}),required:!0,"aria-required":"true",maxLength:200,placeholder:"e.g. retelling a story in order"})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(f,{htmlFor:"focus-mode",children:"How families should engage"}
3),a.jsx(U,{id:"focus-mode",value:n.mode,onChange:e=>d({...n,mode:e.target.value}),children:de.map(e=>a.jsx("option",{value:e.value,children:e.label},e.value))})]}),a.jsx(m,{type:"button",variant:"ghost",size:"sm",className:"w-fit","aria-expanded":O,onClick:()=>k(e=>!e),children:O?"Hide more details":"More details (grade band, standards, approaches)"}),O&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(f,{htmlFor:"focus-grade",children:"Grade band (optional)"}),a.jsx(z,{id:"focus-grade",value:n.gradeBandHint,onChange:e=>d({...n,gradeBandHint:e.target.value}),maxLength:20,placeholder:"e.g. K-2, 3-5"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(f,{htmlFor:"focus-standards",children:"Standard references (optional, comma-separated)"}),a.jsx(z,{id:"focus-standards",value:n.standardRefs,onChange:e=>d({...n,standardRefs:e.target.value}),placeholder:"e.g. RL.1.2"})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(f,{htmlFor:"focus-required",children:"Approaches to include (optional, one per line)"}),a.jsx(ne,{id:"focus-required",value:n.requiredMethods,onChange:e=>d({...n,requiredMethods:e.target.value}),rows:2})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(f,{htmlFor:"focus-prohibitions",children:"Things to avoid at home (optional, one per line)"}),a.jsx(ne,{id:"focus-prohibitions",value:n.prohibitions,onChange:e=>d({...n,prohibitions:e.target.value}),rows:2})]})]})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(m,{type:"submit",className:"min-h-11",disabled:!te,children:h?"Saving…":g?"Save changes":"Save draft"}),g&&a.jsx(m,{type:"button",variant:"ghost",disabled:h,onClick:ae,children:"Cancel"})]})]}),C==="idle"&&re.length>0&&a.jsxs("section",{"aria-label":"Earlier focuses",className:"space-y-3",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Drafts and earlier focuses"}),a.jsx("ul",{className:"space-y-3",children:re.map(ie)})]})]})})}export{aa as F};

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.