PageSourceSearch

https://performrgo.com/assets/ScriptSchoolPage.IfKKK1ke.js

js performrgo.com collected 2026-10-05 22:47:19 UTC 6,694 bytes, 1 lines download raw bytes

1import{b as Q,d as r,j as e,e as c,v as V,T as n,P as u,V as X,Q as Y,h as S,t as L,A as q,R as A,B as C,I as J}from"./index.BdFycjDt.js";import{scriptSeatApi as x}from"./scriptSeatApi.CjUdt7T3.js";import{scriptClassApi as B}from"./scriptClassApi.DfWYGccV.js";import{E as Z}from"./EventSeat.w9PPm3Va.js";import{L as ee}from"./LinearProgress.B-V9CFME.js";import{P as se}from"./PersonAdd.CZ4fHCEV.js";import{T as te,a as w,b as l,c as ae}from"./TableRow.CMTA0Wzu.js";import{T as ie}from"./TableHead.CitOgRM7.js";import{T as ne}from"./Tooltip.CdGw_Rit.js";import{U as re}from"./Undo.Dvy5sBxF.js";import{L as le}from"./LinkOff.BLMV_7eo.js";import{L as oe}from"./Link.DZC79Qb9.js";import"./script.BwFS_wMi.js";import"./Popper.D4RQBrC3.js";function Ce(){const j=Q(s=>s.user),[p,N]=r.useState([]),[o,_]=r.useState(""),[v,g]=r.useState([]),[D,G]=r.useState([]),[P,T]=r.useState([]),[y,I]=r.useState(""),[k,R]=r.useState(""),[M,b]=r.useState(!0),[U,E]=r.useState(!1),[W,d]=r.useState(null),i=p.find(s=>s.id===o)??null,f=v.filter(s=>s.status!=="released").length,m=r.useCallback(async s=>{const[t,a]=await Promise.all([x.listGrants(s),x.listPoolClasses(s)]);g(t),G(a)},[]);r.useEffect(()=>{j?.id&&(async()=>{try{const t=(await x.listPools()).filter(h=>h.owner_id===j.id);N(t);const a=t[0]?.id??"";_(a),a&&await m(a),T(await B.listTeachingClasses(j.id))}catch(s){d(s?.message||"Could not load your seats")}finally{b(!1)}})()},[j?.id,m]);const O=async s=>{_(s),b(!0);try{await m(s)}finally{b(!1)}},z=async()=>{if(!(!o||!y.trim())){E(!0),d(null);try{const s=await x.inviteSeat({poolId:o,email:y,displayName:k});g(t=>[...t.filter(a=>a.id!==s.id&&a.email!==s.email),s]),I(""),R("")}catch(s){d(s?.message||"Could not give out that seat")}finally{E(!1)}}},$=async s=>{g(t=>t.map(a=>a.id===s.id?{...a,status:"released"}:a)),await x.releaseSeat(s.id)},F=async s=>{d(null);try{await x.restoreSeat(s.id,!!s.user_id),await m(o)}catch(t){d(t?.message||"Could not give that seat back")}},H=async(s,t)=>{await B.updateClass(s.id,{pool_id:t?o:null}),await m(o),T(a=>a.map(h=>h.id===s.id?{...h,pool_id:t?o:null}:h))};if(M)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",py:8},children:e.jsx(V,{})});if(p.length===0)return e.jsxs(c,{children:[e.jsx(n,{variant:"h5",fontWeight:700,gutterBottom:!0,children:"School Seats"}),e.jsxs(u,{variant:"outlined",sx:{borderRadius:3,p:4,textAlign:"center"},children:[e.jsx(Z,{sx:{fontSize:40,color:"text.secondary",mb:1}}),e.jsx(n,{variant:"body1",fontWeight:600,gutterBottom:!0,children:"No seats are assigned to you"}),e.jsx(n,{variant:"body2",color:"text.secondary",children:"Seats are set up for a school when it buys them. Once yours are in place, this is where you hand them out."})]})]});const K=i?.seat_limit?Math.min(100,Math.round(f/i.seat_limit*100)):0;return e.jsxs(c,{children:[e.jsxs(c,{sx:{display:"flex",alignItems:"center",gap:2,mb:1,flexWrap:"wrap"},children:[e.jsx(n,{variant:"h5",fontWeight:700,sx:{flex:1},children:"School Seats"}),p.length>1&&e.jsx(X,{size:"small",value:o,onChange:s=>O(s.target.value),sx:{minWidth:220},children:p.map(s=>e.jsx(Y,{value:s.id,children:s.name},s.id))})]}),i&&e.jsx(u,{variant:"outlined",sx:{borderRadius:3,p:2.5,mb:3},children:e.jsxs(S,{direction:{xs:"column",sm:"row"},spacing:2,sx:{alignItems:{sm:"center"}},children:[e.jsxs(c,{sx:{flex:1},children:[e.jsx(n,{variant:"h6",fontWeight:700,children:i.name}),e.jsxs(n,{variant:"body2",color:"text.secondary",children:[f," of ",i.seat_limit," seats in use",i.email_domain?` · addresses at ${i.email_domain} only`:"",i.expires_on?` · runs to ${new Date(i.expires_on).toLocaleDateString()}`:""]}),e.jsx(ee,{variant:"determinate",value:K,sx:{height:8,borderRadius:4,mt:1,maxWidth:420}})]}),!i.is_active&&e.jsx(L,{color:"warning",label:"Paused"})]})}),W&&e.jsx(q,{severity:"error",sx:{mb:2},onClose:()=>d(null),children:W}),e.jsxs(u,{variant:"outlined",sx:{borderRadius:3,p:2.5,mb:3},children:[e.jsx(n,{variant:"overline",color:"text.secondary",children:"Give out a seat"}),e.jsxs(S,{direction:{xs:"column",sm:"row"},spacing:1.5,sx:{mt:1},children:[e.jsx(A,{size:"small",label:"Email address",value:y,onChange:s=>I(s.target.value),sx:{flex:1},onKeyDown:s=>s.key==="Enter"&&z()}),e.jsx(A,{size:"small",label:"Name",value:k,onChange:s=>R(s.target.value),sx:{flex:1}}),e.jsx(C,{variant:"contained",startIcon:e.jsx(se,{}),onClick:z,disabled:U||!y.trim()||(i?f>
1=i.seat_limit:!0),sx:{textTransform:"none"},children:"Give Seat"})]}),i&&f>=i.seat_limit&&e.jsx(n,{variant:"caption",color:"text.secondary",sx:{display:"block",mt:1},children:"Every seat is in use. Release one to hand it to somebody else."})]}),e.jsx(u,{variant:"outlined",sx:{borderRadius:3,mb:3,overflowX:"auto"},children:e.jsxs(te,{size:"small",children:[e.jsx(ie,{children:e.jsxs(w,{children:[e.jsx(l,{children:"Name"}),e.jsx(l,{children:"Email"}),e.jsx(l,{children:"Status"}),e.jsx(l,{children:"Last wrote"}),e.jsx(l,{align:"right",children:"Seat"})]})}),e.jsxs(ae,{children:[v.length===0&&e.jsx(w,{children:e.jsx(l,{colSpan:5,children:e.jsx(n,{variant:"body2",color:"text.secondary",sx:{py:2,textAlign:"center"},children:"No seats given out yet."})})}),v.map(s=>e.jsxs(w,{sx:{opacity:s.status==="released"?.55:1},children:[e.jsx(l,{children:s.display_name||"—"}),e.jsx(l,{children:s.email}),e.jsx(l,{children:e.jsx(L,{size:"small",variant:s.status==="active"?"filled":"outlined",color:s.status==="active"?"success":s.status==="invited"?"default":"warning",label:s.status==="active"?"Writing":s.status==="invited"?"Invited":"Released"})}),e.jsx(l,{children:s.last_active_at?new Date(s.last_active_at).toLocaleDateString():"Not yet"}),e.jsx(l,{align:"right",children:s.status==="released"?e.jsx(ne,{title:"Give this seat back",children:e.jsx(J,{size:"small",onClick:()=>F(s),children:e.jsx(re,{fontSize:"small"})})}):e.jsx(C,{size:"small",onClick:()=>$(s),sx:{textTransform:"none"},children:"Release"})})]},s.id))]})]})}),e.jsx(n,{variant:"overline",color:"text.secondary",children:"Classes on these seats"}),e.jsx(u,{variant:"outlined",sx:{borderRadius:3,p:2,mt:1},children:P.length===0?e.jsx(n,{variant:"body2",color:"text.secondary",sx:{py:1},children:"You are not teaching any classes yet."}):e.jsx(S,{spacing:1,children:P.map(s=>{const t=D.some(a=>a.id===s.id);return e.jsxs(c,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsxs(c,{sx:{flex:1,minWidth:0},children:[e.jsx(n,{variant:"body2",fontWeight:600,noWrap:!0,children:s.name}),e.jsx(n,{variant:"caption",color:"text.secondary",children:s.term||"No term set"})]}),e.jsx(C,{size:"small",startIcon:t?e.jsx(le,{}):e.jsx(oe,{}),onClick:()=>H(s,!t),sx:{textTransform:"none"},children:t?"Detach":"Attach"})]},s.id)})})})]})}export{Ce 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.