1import{r as n,j as e}from"./react-vendor-DUhHROXo.js";import{P as f}from"./PortalLayout-BUxGSFei.js";import{C as j,b as y,c as N,d as g,a as v}from"./card-9IoFUltb.js";import{B as w}from"./badge-BsE4KYIf.js";import{J as b,U as C,O as S,aH as _}from"./index-BLtzf0SR.js";import{s as L}from"./client-DTel1CZI.js";import{I as E}from"./input-RFokm5kN.js";import{S as I,a as O,b as A,c as F,d as T}from"./select-CMAo_7oa.js";import{F as B}from"./filter-Cq5B9N9E.js";import{C as M}from"./clock-DK72Hop1.js";import{A as l}from"./activity-CwFToTs3.js";import{S as Q}from"./settings-Baim_Eei.js";import{f as k}from"./format-DGzj7MEM.js";import"./AdminLayout-4AAuHeAU.js";import"./router-vendor-Dz9PdDzH.js";import"./NavLink-CsyG-eHO.js";import"./scroll-area-BdyOmc9o.js";import"./index-BdQq_4o_.js";import"./collapsible-BAD8kbtc.js";import"./index-CMI-ZfmW.js";import"./arrow-left-CRb8P6iH.js";import"./globe-CQ83QW2m.js";import"./users-CIwSfVhi.js";import"./list-todo-BR3jv1RJ.js";import"./calendar-BDETTnfZ.js";import"./users-round-CCw5yxW7.js";import"./radio-BQgeDg5T.js";import"./clapperboard-BvstouST.js";import"./clipboard-list-CQJ-vJ2y.js";import"./image-arBWrt3y.js";import"./folder-open-CIWhCFhy.js";import"./pencil-C2cyk8cg.js";import"./message-square-BDdDilNB.js";import"./ticket-l9bl0kcm.js";import"./megaphone-DpQsxotQ.js";import"./package-DKB1lvtO.js";import"./circle-user-BeB3uaA1.js";import"./folder-kanban-B8jlMC6s.js";import"./briefcase-CdSp4ViD.js";import"./chart-line-ohAz7u_s.js";import"./HostOwnerLayout-PM2-LrXf.js";import"./layers-CvbkNa7J.js";import"./dollar-sign-D3lTBfQm.js";import"./index-O12prPmO.js";import"./chevron-up-B89bkR-F.js";import"./en-US-Bfz1jvxT.js";import"./differenceInCalendarDays-D4nmWE3G.js";import"./getTimezoneOffsetInMilliseconds-DsfBWtEI.js";const c={create:S,update:Q,delete:l,login:_,default:l},d={user:"bg-blue-500/10 text-blue-600",article:"bg-green-500/10 text-green-600",podcast:"bg-purple-500/10 text-purple-600",video:"bg-red-500/10 text-red-600",default:"bg-gray-500/10 text-gray-600"};function Fe(){const[r,p]=n.useState(""),[i,x]=n.useState("all"),{data:s,isLoading:u}=b({queryKey:["operations-log"],queryFn:async()=>{const{data:t,error:a}=await L.from("operations_log").select("*").order("created_at",{ascending:!1}).limit(100);if(a)throw a;return t}}),h=["all",...new Set(s==null?void 0:s.map(t=>t.entity_type).filter(Boolean))],o=s==null?void 0:s.filter(t=>{const a=t.action.toLowerCase().includes(r.toLowerCase())||t.entity_type.toLowerCase().includes(r.toLowerCase()),m=i==="all"||t.entity_type===i;return a&&m});return e.jsx(f,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-display font-bold",children:"Operations Log"}),e.jsx("p",{className:"text-muted-foreground",children:"Track all system activities and changes"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"relative flex-1 max-w-sm",children:e.jsx(E,{placeholder:"Search logs...",value:r,onChange:t=>p(t.target.value)})}),e.jsxs(I,{value:i,onValueChange:x,children:[e.jsxs(O,{className:"w-40",children:[e.jsx(B,{className:"h-4 w-4 mr-2"}),e.jsx(A,{placeholder:"Entity"})]}),e.jsx(F,{children:h.map(t=>e.jsx(T,{value:t,children:t==="all"?"All Entities":t},t))})]})]}),e.jsxs(j,{children:[e.jsxs(y,{children:[e.jsx(N,{children:"Recent Activity"}),e.jsx(g,{children:"Last 100 operations"})]}),e.jsx(v,{children:u?e.jsx("div",{className:"space-y-4",children:[1,2,3,4,5].map(t=>e.jsxs("div",{className:"flex items-center gap-4 animate-pulse",children:[e.jsx("div",{className:"h-10 w-10 bg-muted rounded-full"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-4 bg-muted rounded w-1/2 mb-2"}),e.jsx("div",{className:"h-3 bg-muted rounded w-1/4"})]})]},t))}):o&&o.length>0?e.jsx("div",{className:"space-y-4",children:o.map(t=>{const a=c[t.action]||c.default,m=d[t.entity_type]||d.default;return e.jsxs("div",{className:"flex items-start gap-4 p-3 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsx("div",{className:"p-2 rounded-full bg-muted",children:e.jsx(a,{className:"h-4 w-4 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-medium capitalize",children:t.action}),e.jsx(w,{className:m,children:t.entity_type}),t.entity_id&&e.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:[t.entity_id.slice(0,8),"..."]})]}),t.details&&typeof t.details=="object"&&e.jsxs("p",{className:"text-sm text-muted-foreground mt-1 truncate",children:[JSON.stringify(t.details).slice(0,100),"..."]}),e.jsxs("div",{className:"flex items-center gap-3 mt-1 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(M,{className:"h-3 w-3"}),k(new Date(t.created_at),"MMM d, yyyy h:mm a")]}),t.user_id&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(C,{className:"h-3 w-3"}),t.user_id.slice(0,8),"..."]}),t.ip_address&&e.jsx("span",{className:"font-mono",children:t.ip_address})]})]})]},t.id)})}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(l,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"No activity logged"}),e.jsx("p",{className:"text-muted-foreground",children:"Operations will appear here as they occur"})]})})]})]})})}export{Fe 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.