PageSourceSearch

https://tresda.institute/assets/AdminEvents-B45rLdIT.js

js tresda.institute collected 2026-10-02 01:58:11 UTC 8,935 bytes, 1 lines download raw bytes

1import{u as w,r as x,b as k,a as p,j as e,g as E,n as S,X as C,x as M,y as q,P as F,o as P,m as l}from"./index-u0HMC9Vb.js";const T=["live_session","critique_week","grading_period","advancement_decision","community_talk","showcase","school_moment","onboarding","brief_launch","major_review","final_presentation","other"],f={live_session:"Live Session",critique_week:"Critique Week",grading_period:"Grading Period",advancement_decision:"Advancement Decision",community_talk:"Community Talk",showcase:"Showcase",school_moment:"School Moment",onboarding:"Onboarding",brief_launch:"Brief Launch",major_review:"Major Review",final_presentation:"Final Presentation",other:"Other"},b={title:"",description:"",event_type:"live_session",start_time:"",end_time:"",is_all_day:!1,location:"",meeting_url:"",course_code:"",is_milestone:!1,exportable:!0};function A(){const c=w(),[h,d]=x.useState(!1),[n,u]=x.useState(null),[s,o]=x.useState(b),{data:g=[]}=k({queryKey:["schoolEvents"],queryFn:()=>l.entities.Event.list("-start_time",200)}),_=p({mutationFn:t=>l.entities.Event.create(t),onSuccess:()=>{c.invalidateQueries({queryKey:["schoolEvents"]}),i()}}),j=p({mutationFn:({id:t,data:r})=>l.entities.Event.update(t,r),onSuccess:()=>{c.invalidateQueries({queryKey:["schoolEvents"]}),i()}}),v=p({mutationFn:t=>l.entities.Event.delete(t),onSuccess:()=>c.invalidateQueries({queryKey:["schoolEvents"]})}),i=()=>{o(b),u(null),d(!1)},y=t=>{u(t),o({title:t.title||"",description:t.description||"",event_type:t.event_type||"other",start_time:t.start_time?t.start_time.slice(0,16):"",end_time:t.end_time?t.end_time.slice(0,16):"",is_all_day:t.is_all_day||!1,location:t.location||"",meeting_url:t.meeting_url||"",course_code:t.course_code||"",is_milestone:t.is_milestone||!1,exportable:t.exportable!==!1}),d(!0)},N=t=>{t.preventDefault();const r={...s,start_time:s.start_time?new Date(s.start_time).toISOString():null,end_time:s.end_time?new Date(s.end_time).toISOString():null,course_code:s.course_code||null};n?j.mutate({id:n.id,data:r}):_.mutate(r)},a=(t,r)=>o(m=>({...m,[t]:r}));return e.jsxs("div",{className:"bg-background min-h-screen",children:[e.jsx("header",{className:"border-b border-border px-5 lg:px-10 pt-8 pb-6",children:e.jsxs("div",{className:"max-w-5xl mx-auto flex items-end justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-meta uppercase tracking-[0.35em] text-muted-foreground",children:"Admin"}),e.jsx("h1",{className:"text-2xl font-display uppercase text-foreground mt-0.5",children:"School Events"})]}),!h&&e.jsxs(E,{onClick:()=>{u(null),o(b),d(!0)},className:"text-[10px] font-meta uppercase tracking-widest",children:[e.jsx(S,{className:"w-3.5 h-3.5 mr-1.5",strokeWidth:1.5}),"New Event"]})]})}),e.jsxs("div",{className:"max-w-5xl mx-auto px-5 lg:px-10 py-8 space-y-6",children:[h&&e.jsxs("form",{onSubmit:N,className:"bg-card border border-border p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("p",{className:"text-xs font-semibold text-stone-900",children:n?"Edit Event":"New Event"}),e.jsx("button",{type:"button",onClick:i,children:e.jsx(C,{className:"w-4 h-4 text-stone-400",strokeWidth:1.5})})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx("label",{className:"text-[9px] font-meta uppercase tracking-widest text-stone-400 block mb-1",children:"Title *"}),e.jsx("input",{required:!0,value:s.title,onChange:t=>a("title",t.target.value),className:"w-full border border-border bg-background px-3 py-2 text-sm text-foreground focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[9px] font-meta uppercase tracking-widest text-stone-400 block mb-1",children:"Event Type"}),e.jsx("select",{value:s.event_type,onChange:t=>a("event_type",t.target.value),className:"w-full border border-border bg-background px-3 py-2 text-sm text-foreground focus:outline-none",children:T.map(t=>e.jsx("option",{value:t,children:f[t]},t))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[9px] font-meta uppercase tracking-widest text-muted-foreground block mb-1",children:"Course (optional)"}),e.jsxs("select",{value:s.course_code,onChange:t=>a("course_code",t.target.value),className:"w-full border border-border bg-background px-3 py-2 text-sm text-foreground focus:outline-none",children:[e.jsx("option",{value:"",children:"School-wide"}),e.jsx("option",{value:"001",children:"001 — Self"}),e.jsx("option",{value:"002",children:"002 — Other"}),e.jsx("option",{value:"003",children:"003 — Synthesis"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[9px] font-meta uppercase tracking-widest text-stone-400 block mb-1",children:"Start *"}),e.jsx("input",{required:!0,type:"datetime-local",value:s.start_time,onChange:t=>a("start_time",t.target.value),className:"w-full border border-border bg-background px-3 py-2 text-sm text-foreground focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[9px] font-meta uppercase tracking-widest text-muted-foreground block mb-1",children:"End (optional)"}),e.jsx("input",{type:"datetime-local",value:s.end_time,onChange:t=>a("end_time",t.target.value),className:"w-full border border-border bg-background px-3 py-2 text-sm text-foreground focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[9px] font-meta uppercase tracking-widest text-muted-foreground block mb-1",children:"Location"}),e.jsx("input",{value:s.location,onChange:t=>a("location",t.target.value),className:"w-full border border-border bg-background px-3 py-2 text-sm text-foreground focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[9px] font-meta uppercase tracking-widest text-muted-foreground block mb-1",children:"Meeting URL"}),e.jsx("input",{value:s.meeting_url,onChange:t=>a("meeting_url",t.target.value),className:"w-full border border-border bg-background px-3 py-2 text-sm text-foreground focus:outline-none"})]}),e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx("label",{className:"text-[9px] font-meta uppercase tracking-widest text-muted-foreground block mb-1",children:"Description"}),e.jsx("textarea",{rows:3,value:s.description,onChange:t=>a("description",t.target.value),className:"w-full border border-border bg-background px-3 py-2 text-sm text-foreground focus:outline-none resize-none"})]}),e.jsx("div",{className:"flex flex-wrap gap-5 sm:col-span-2",children:[{key:"is_all_day",label:"All-day event"},{key:"is_milestone",label:"Milestone"},{key:"exportable",label:"Allow export to calendar"}].map(({key:t,label:r})=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:s[t],onChange:m=>a(t,m.target.checked),className:"w-3.5 h-3.5 accent-stone-900"}),e.jsx("span",{className:"text-[10px] font-meta uppercase tracking-widest text-stone-600",children:r})]},t))})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{type:"button",onClick:i,className:"text-[10px] font-meta uppercase tracking-widest text-muted-foreground px-4 py-2 border border-border hover:bg-muted transition-colors",children:"Cancel"}),e.jsx("button",{type:"submit",className:"text-[10px] font-meta uppercase tracking-widest text-primary-foreground bg-primary px-4 py-2 hover:opacity-90 transition-opacity",children:n?"Update Event":"Create Event"})]})]}),e.jsx("div",{className:"bg-card border border-border divide-y divide-border",children:g.length===0?e.jsx("div",{className:"p-8 text-center",children:e.jsx("p",{className:"text-[10px] font-meta uppercase tracking-widest text-muted-foreground",children:"No events yet"})}):g.map(t=>e.jsxs("div",{className:"flex items-start justify-between px-5 py-4 gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:t.title}),t.is_milestone&&e.jsx("span",{className:"text-[8px] font-meta uppercase tracking-widest px-1.5 py-0.5 bg-stone-100 text-stone-500 border border-stone-200",children:"Milestone"})]}),e.jsxs("p",{className:"text-[9px] font-meta uppercase tracking-widest text-stone-400 mt-1",children:[f[t.event_type]||"Event",t.course_code?` · Course ${t.course_code}`:" · School-wide"," · ",M(q(t.start_time),"d MMM yyyy")]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx("button",{onClick:()=>y(t),className:"p-1.5 hover:bg-stone-100 transition-colors",children:e.jsx(F,{className:"w-3.5 h-3.5 text-stone-400",strokeWidth:1.5})}),e.jsx("button",{onClick:()=>v.mutate(t.id),className:"p-1.5 hover:bg-red-50 transition-colors",children:e.jsx(P,{className:"w-3.5 h-3.5 text-stone-400 hover:text-red-500 transition-colors",strokeWidth:1.5})})]})]},t.id))})]})]})}export{A 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.