PageSourceSearch

https://plant4growthuk-production-a1cd.up.railway.app/static/js/337.1a252f6f.chunk.js

js plant4growthuk-production-a1cd.up.railway.app collected 2026-10-03 12:14:41 UTC 5,250 bytes, 3 lines download raw bytes

1/*! For license information please see 337.1a252f6f.chunk.js.LICENSE.txt */
2"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[337],{337(e,t,s){s.r(t),s.d(t,{default:()=>j});var a=s(5043),l=s(9970),i=s(1140),r=s(5949),n=s(3390),c=s(2264),d=s(6328),x=s(2580),o=s(2024),m=s(4537),u=s(516),h=s(4980),p=s(579);const g={login:"bg-green-100 text-green-700 border-green-200",login_failed:"bg-red-100 text-red-700 border-red-200",open_course:"bg-blue-100 text-blue-700 border-blue-200",open_module:"bg-sky-100 text-sky-700 border-sky-200",submit_assignment:"bg-emerald-100 text-emerald-700 border-emerald-200",resubmit_assignment:"bg-amber-100 text-amber-700 border-amber-200",download_file:"bg-slate-100 text-slate-700 border-slate-200"},v=e=>{if(!e)return"\u2014";try{return new Date(e).toLocaleString("en-GB",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch(t){return e}},j=()=>{const[e,t]=(0,a.useState)([]),[s,j]=(0,a.useState)(0),[b,y]=(0,a.useState)(!0),[N,f]=(0,a.useState)(""),[_,w]=(0,a.useState)(""),k=(0,a.useCallback)(async()=>{y(!0);try{const e={limit:200};N.trim()&&(e.user_id=N.trim()),_.trim()&&(e.event=_.trim());const s=await h.Er.getUserActivity(e);t(s.data.entries||[]),j(s.data.total_matching||0)}catch(a){var e,s;d.oR.error((null===(e=a.response)||void 0===e||null===(s=e.data)||void 0===s?void 0:s.detail)||"Failed to load activity log")}finally{y(!1)}},[N,_]);return(0,a.useEffect)(()=>{k()},[k]),(0,p.jsx)(l.NI,{children:(0,p.jsxs)("div",{className:"space-y-6","data-testid":"admin-user-activity-page",children:[(0,p.jsxs)("div",{className:"flex items-center justify-between",children:[(0,p.jsxs)("div",{children:[(0,p.jsxs)("h1",{className:"text-3xl font-bold text-[#0D1B2A] flex items-center gap-2",children:[(0,p.jsx)(m.A,{className:"w-7 h-7 text-blue-500"}),"User Activity Log"]}),(0,p.jsx)("p",{className:"text-sm text-slate-500 mt-1",children:'Every delegate action \u2014 login, opening a course, submitting an assignment \u2014 is recorded here. Use it to investigate support tickets ("I can\'t open X\u2026") without guessing.'})]}),(0,p.jsxs)(n.$,{variant:"outline",onClick:k,disabled:b,"data-testid":"activity-refresh",children:[(0,p.jsx)(u.A,{className:"w-4 h-4 mr-2 ".concat(b?"animate-spin":"")}),"Refresh"]})]}),(0,p.jsx)(i.Zp,{className:"border-slate-100",children:(0,p.jsxs)(i.Wu,{className:"flex flex-wrap gap-4 items-center py-4",children:[(0,p.jsxs)("div",{className:"flex items-center gap-2 text-sm text-slate-600",children:[(0,p.jsx)(x.A,{className:"w-4 h-4"}),"Filter:"]}),(0,p.jsx)(c.p,{placeholder:"User ID (e.g. user_xxxxx)",className:"w-64",value:N,onChange:e=>f(e.target.value),"data-testid":"activity-filter-user"}),(0,p.jsx)(c.p,{placeholder:"Event (login, open_course\u2026)",className:"w-56",value:_,onChange:e=>w(e.target.value),"data-testid":"activity-filter-event"}),(0,p.jsx)("div",{className:"ml-auto text-sm text-slate-500",children:b?"Loading\u2026":"".concat(e.length," of ").concat(s," events")})]})}),b&&0===e.length?(0,p.jsx)("div",{className:"flex justify-center py-16",children:(0,p.jsx)(o.A,{className:"w-8 h-8 animate-spin text-slate-300"})}):0===e.length?(0,p.jsx)(i.Zp,{className:"border-slate-100",children:(0,p.jsx)(i.Wu,{className:"py-16 text-center text-slate-500",children:"No activity events yet."})}):(0,p.jsx)("div",{className:"space-y-2",children:e.map(e=>(0,p.jsx)(i.Zp,{className:"border-slate-100","data-testid":"activity-entry-".concat(e.event_id),children:(0,p.jsx)(i.Wu,{className:"p-3",children:(0,p.jsxs)("div",{className:"flex items-start gap-3",children:[(0,p.jsx)(r.E,{className:g[e.event]||"bg-slate-100 text-slate-700",children:e.event.replace(/_/g," ")}),(0,p.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,p.jsxs)("p",{className:"text-sm text-[#0D1B2A]",children:[(0,p.jsx)("span",{className:"font-medium",children:e.user_name||e.user_email||"Unknown"}),e.user_email&&e.user_name?(0,p.jsxs)("span",{className:"text-slate-400",children:[" (",e.user_email,")"]}):null,e.resource_id&&(0,p.jsxs)("span",{className:"text-xs text-slate-400 ml-2",children:["\u2192 ",e.resource_type,":",e.resource_id]})]}),e.context&&Object.keys(e.context).length>0&&(0,p.jsx)("p",{className:"text-xs text-slate-500 mt-0.5 truncate",children:Object.entries(e.context).map(e=>{let[t,s]=e;return"".concat(t,": ").concat(s)}).join(" \xb7 ")}),(0,p.jsxs)("p",{className:"text-xs text-slate-400 mt-0.5",children:[e.ip||"\u2014"," \xb7 ",(e.user_agent||"").split(" ")[0]||"\u2014"]})]}),(0,p.jsx)("div",{className:"text-xs text-slate-400 whitespace-nowrap",children:v(e.timestamp)})]})})},e.event_id))})]})})}},516(e,t,s){s.d(t,{A:()=>a});const a=(0,s(7784).A)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},2580(e,t,s){s.d(t,{A:()=>a});const a=(0,s(7784).A)("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]])}}]);
3//# sourceMappingURL=337.1a252f6f.chunk.js.map

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.