PageSourceSearch

https://msastroacademy.com/assets/notifications-Bawx-nhN.js

js msastroacademy.com collected 2026-09-24 14:48:23 UTC 3,389 bytes, 1 lines download raw bytes

1import{r as i,j as e}from"./react-vendor-DDlTsOEd.js";import{a as j,d as o,K as y,Q as h,W as N,Y as w}from"./index-dMYrr1t8.js";import{A as b}from"./AdminLayout-C0t6TWD9.js";import{C as k,F as d}from"./file-check-Cm4X2sBJ.js";import{C as v}from"./credit-card-CV_Lm4ZC.js";import"./megaphone-CG_Y22E9.js";import"./clipboard-check-H9MOfMyT.js";import"./database-BMcpOIuo.js";import"./tag-CsU2rQcC.js";const x={payment:e.jsx(v,{size:16,className:"text-emerald-600"}),certificate:e.jsx(w,{size:16,className:"text-amber-600"}),assignment:e.jsx(d,{size:16,className:"text-blue-600"}),case_study:e.jsx(d,{size:16,className:"text-violet-600"}),account:e.jsx(N,{size:16,className:"text-indigo-600"}),general:e.jsx(h,{size:16,className:"text-gray-900"})};function O(){const[s,n]=i.useState([]),[r,p]=i.useState(!0),[,u]=j(),c=i.useCallback(()=>{o.get("/notifications?limit=100").then(t=>n(t.data?.notifications??[])).catch(()=>n([])).finally(()=>p(!1))},[]);i.useEffect(()=>{c()},[c]);const g=t=>{t.read_at||(n(l=>l.map(a=>a.id===t.id?{...a,read_at:new Date().toISOString()}:a)),o.post(`/notifications/${t.id}/read`,{}).then(()=>window.dispatchEvent(new CustomEvent("msa:announcement-read"))).catch(()=>{})),t.link&&u(t.link)},f=async()=>{try{await o.post("/notifications/read-all",{});const t=new Date().toISOString();n(l=>l.map(a=>({...a,read_at:a.read_at??t}))),window.dispatchEvent(new CustomEvent("msa:announcement-read"))}catch{}},m=s.filter(t=>!t.read_at).length;return e.jsxs(b,{children:[e.jsxs("div",{className:"mb-6 flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Notifications"}),e.jsx("p",{className:"text-sm text-gray-900",children:"Payments, deletion requests and case study submissions as they happen."})]}),m>0&&e.jsxs(y,{variant:"outline",size:"sm",onClick:f,children:[e.jsx(k,{size:15,className:"mr-1.5"})," Mark all read (",m,")"]})]}),r&&e.jsx("div",{className:"space-y-2 max-w-2xl",children:[1,2,3].map(t=>e.jsx("div",{className:"h-16 animate-pulse rounded-xl bg-white"},t))}),!r&&s.length===0&&e.jsxs("div",{className:"max-w-2xl rounded-2xl border border-gray-200 bg-white px-6 py-16 text-center",children:[e.jsx(h,{size:30,className:"mx-auto mb-3 text-gray-900"}),e.jsx("p",{className:"font-medium text-gray-900",children:"Nothing yet"}),e.jsx("p",{className:"mx-auto mt-1 max-w-sm text-sm text-gray-900",children:"Payments, account deletion requests and case study submissions will appear here as students trigger them."})]}),!r&&s.length>0&&e.jsx("div",{className:"max-w-2xl space-y-2",children:s.map(t=>e.jsxs("button",{onClick:()=>g(t),className:`flex w-full items-start gap-3 rounded-xl border p-4 text-left transition ${t.read_at?"border-gray-200 bg-white":"border-indigo-100 bg-indigo-50/60"}`,children:[e.jsx("span",{className:"mt-0.5 flex-shrink-0",children:x[t.kind]??x.general}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:`text-gray-900 ${t.read_at?"font-medium":"font-semibold"}`,children:t.title_en}),t.body_en&&e.jsx("p",{className:"mt-0.5 text-sm text-gray-800",children:t.body_en}),e.jsx("p",{className:"mt-1 text-xs text-gray-800",children:new Date(t.created_at).toLocaleString("en-IN")})]}),!t.read_at&&e.jsx("span",{className:"mt-1.5 h-2 w-2 flex-shrink-0 rounded-full bg-indigo-500"})]},t.id))})]})}export{O 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.