PageSourceSearch

https://scoop.live/_next/static/chunks/641-7bbac2e7f5af2938.js

js scoop.live collected 2026-10-02 02:00:30 UTC 9,590 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[641],{3449:(e,t,s)=>{s.d(t,{A:()=>r});var l=s(5272),n=s(324),a=s(3187);let r=()=>{let[e,t]=(0,n.useState)([]),[s,r]=(0,n.useState)(!0),[c,i]=(0,n.useState)(""),[o,d]=(0,n.useState)([]),[u,m]=(0,n.useState)(!1),[h,b]=(0,n.useState)(null),[x,j]=(0,n.useState)("");(0,n.useEffect)(()=>{setTimeout(()=>{t(Array.from({length:15}).map((e,t)=>({id:"user-".concat(t),username:"user".concat(t),email:"user".concat(t,"@example.com"),role:0===t?"admin":"user",status:t%5==0?"inactive":"active",lastLogin:new Date(Date.now()-1e10*Math.random()).toISOString(),createdAt:new Date(Date.now()-2e10*Math.random()).toISOString()}))),r(!1)},1e3)},[]);let p=e=>{o.includes(e)?d(o.filter(t=>t!==e)):d([...o,e])},v=e=>{b(e),m(!0)},f=e.filter(e=>e.username.toLowerCase().includes(c.toLowerCase())||e.email.toLowerCase().includes(c.toLowerCase()));return(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"text-2xl font-bold mb-6",children:"User Management"}),x&&(0,l.jsxs)("div",{className:"alert alert-success mb-4",children:[(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"stroke-current shrink-0 h-6 w-6",fill:"none",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,l.jsx)("span",{children:x})]}),(0,l.jsxs)("div",{className:"flex flex-col md:flex-row gap-4 mb-6",children:[(0,l.jsx)("div",{className:"form-control flex-1",children:(0,l.jsxs)("div",{className:"input-group",children:[(0,l.jsx)("input",{type:"text",placeholder:"Search username or email...",className:"input input-bordered w-full",value:c,onChange:e=>i(e.target.value)}),(0,l.jsx)("button",{type:"button",className:"btn btn-square",children:(0,l.jsx)(a.KSO,{})})]})}),(0,l.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,l.jsxs)("button",{type:"button",className:"btn btn-primary",onClick:()=>{b(null),m(!0)},children:[(0,l.jsx)(a.NPy,{className:"mr-1"}),"Add User"]}),(0,l.jsxs)("button",{type:"button",className:"btn btn-error bt
1n-outline",onClick:()=>{0!==o.length&&confirm("Are you sure you want to delete ".concat(o.length," selected users?"))&&(t(e.filter(e=>!o.includes(e.id))),d([]),j("Successfully deleted ".concat(o.length," users")),setTimeout(()=>j(""),3e3))},disabled:0===o.length,children:[(0,l.jsx)(a.F$6,{className:"mr-1"}),"Delete Selected"]})]})]}),s?(0,l.jsx)("div",{className:"flex justify-center my-12",children:(0,l.jsx)("span",{className:"loading loading-spinner loading-lg"})}):(0,l.jsx)("div",{className:"overflow-x-auto",children:(0,l.jsxs)("table",{className:"table table-zebra",children:[(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:(0,l.jsx)("label",{children:(0,l.jsx)("input",{type:"checkbox",className:"checkbox",onChange:t=>{t.target.checked?d(e.map(e=>e.id)):d([])},checked:o.length===e.length&&e.length>0})})}),(0,l.jsx)("th",{children:"Username"}),(0,l.jsx)("th",{children:"Email"}),(0,l.jsx)("th",{children:"Role"}),(0,l.jsx)("th",{children:"Status"}),(0,l.jsx)("th",{children:"Last Login"}),(0,l.jsx)("th",{children:"Created At"}),(0,l.jsx)("th",{children:"Actions"})]})}),(0,l.jsx)("tbody",{children:f.map(e=>(0,l.jsxs)("tr",{children:[(0,l.jsx)("td",{children:(0,l.jsx)("label",{children:(0,l.jsx)("input",{type:"checkbox",className:"checkbox",checked:o.includes(e.id),onChange:()=>p(e.id)})})}),(0,l.jsx)("td",{children:e.username}),(0,l.jsx)("td",{children:e.email}),(0,l.jsx)("td",{children:(0,l.jsx)("div",{className:"badge ".concat("admin"===e.role?"badge-primary":"badge-ghost"),children:"admin"===e.role?"Admin":"Regular User"})}),(0,l.jsx)("td",{children:(0,l.jsx)("div",{className:"badge ".concat("active"===e.status?"badge-success":"badge-error"),children:"active"===e.status?"Active":"Inactive"})}),(0,l.jsx)("td",{children:new Date(e.lastLogin).toLocaleString()}),(0,l.jsx)("td",{children:new Date(e.createdAt).toLocaleString()}),(0,l.jsx)("td",{children:(0,l.jsx)("button",{type:"button",className:"btn btn-xs btn-ghost",onClick:()=>v(e),children:(0,l.jsx)(a.xvZ,{})})})]},e.id))})]})}),(0,l.jsxs)("div",{className:"flex justify-between items-center mt-4",children:[(0,l.jsx)("div",{children:o.length>0&&(0,l.jsxs)("span",{className:"text-sm",children:[o.length," items selected"]})}),(0,l.jsxs)("div",{className:"join",children:[(0,l.jsx)("button",{type:"button",className:"join-item btn",children:"\xab"}),(0,l.jsx)("button",{type:"button",className:"join-item btn btn-active",children:"1"}),(0,l.jsx)("button",{type:"button",className:"join-item btn",children:"2"}),(0,l.jsx)("button",{type:"button",className:"join-item btn",children:"\xbb"})]})]}),(0,l.jsxs)("dialog",{className:"modal ".concat(u?"modal-open":""),children:[(0,l.jsxs)("div",{className:"modal-box",children:[(0,l.jsx)("h3",{className:"font-bold text-lg",children:h?"Edit User: ".concat(h.username):"Add New User"}),(0,l.jsxs)("form",{onSubmit:e=>{e.preventDefault(),m(!1),h?j("User ".concat(h.username," has been updated")):j("New user has been added"),setTimeout(()=>j(""),3e3)},children:[(0,l.jsxs)("div",{className:"form-control mt-4",children:[(0,l.jsx)("label",{className:"label",children:(0,l.jsx)("span",{className:"label-text",children:"Username"})}),(0,l.jsx)("input",{type:"text",className:"input input-bordered",defaultValue:(null==h?void 0:h.username)||"",required:!0})]}),(0,l.jsxs)("div",{className:"form-control mt-2",children:[(0,l.jsx)("label",{className:"label",children:(0,l.jsx)("span",{className:"label-text",children:"Email"})}),(0,l.jsx)("input",{type:"email",className:"input input-bordered",defaultValue:(null==h?void 0:h.email)||"",required:!0})]}),(0,l.jsxs)("div",{className:"form-control mt-2",children:[(0,l.jsx)("label",{className:"label",children:(0,l.jsx)("span",{className:"label-text",children:"Role"})}),(0,l.jsxs)("select",{className:"select select-bordered",defaultValue:(null==h?void 0:h.role)||"user",children:[(0,l.jsx)("option",{value:"user",children:"Regular User"}),(0,l.jsx)("option",{value:"admin",children:"Administrator"})]})]}),(0,l.jsxs)("div",{className:"form-control mt-2",children:[(0,l.jsx)("label",{className:"label",children:(0,l.jsx)("span",{className:"label-text",children:"Status"})}),(0,l.jsxs)("select",{className:"select select-bordered",defaultValue:(null==h?void 0:h.status)||"active",children:[(0,l.jsx)("option",{value:"active",children:"Active"}),(0,l.jsx)("option",{value:"inactive",children:"Inactive"})]})]}),!h&&(0,l.jsxs)("div",{className:"form-control mt-2",children:[(0,l.jsx)("label",{className:"label",children:(0,l.jsx)("span",{className:"label-text",children:"Password"})}),(0,l.jsx)("input",{type:"password",className:"input input-bordered",required:!h})]}),(0,l.jsxs)("div",{className:"modal-action",children:[(0,l.jsx)("button",{type:"button",className:"btn",onClick:()=>m(!1),children:"Cancel"}),(0,l.jsx)("button",{type:"submit",className:"btn btn-primary",children:"Save"})]})]})]}),(0,l.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,l.jsx)("button",{type:"button",onClick:()=>m(!1),children:"Close"})})]})]})}},3737:(e,t,s)=>{s.d(t,{k5:()=>d});var l=s(324),n={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},a=l.createContext&&l.createContext(n),r=["attr","size","title"];function c(){return(c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var l in s)Object.prototype.hasOwnProperty.call(s,l)&&(e[l]=s[l])}return e}).apply(this,arguments)}function i(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,l)}return s}function o(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};
1t%2?i(Object(s),!0).forEach(function(t){var l,n;l=t,n=s[t],(l=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var l=s.call(e,t||"default");if("object"!=typeof l)return l;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(l))in e?Object.defineProperty(e,l,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[l]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):i(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))})}return e}function d(e){return t=>l.createElement(u,c({attr:o({},e.attr)},t),function e(t){return t&&t.map((t,s)=>l.createElement(t.tag,o({key:s},t.attr),e(t.child)))}(e.child))}function u(e){var t=t=>{var s,{attr:n,size:a,title:i}=e,d=function(e,t){if(null==e)return{};var s,l,n=function(e,t){if(null==e)return{};var s={};for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)){if(t.indexOf(l)>=0)continue;s[l]=e[l]}return s}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(l=0;l<a.length;l++)s=a[l],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}(e,r),u=a||t.size||"1em";return t.className&&(s=t.className),e.className&&(s=(s?s+" ":"")+e.className),l.createElement("svg",c({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,n,d,{className:s,style:o(o({color:e.color||t.color},t.style),e.style),height:u,width:u,xmlns:"http://www.w3.org/2000/svg"}),i&&l.createElement("title",null,i),e.children)};return void 0!==a?l.createElement(a.Consumer,null,e=>t(e)):t(n)}}}]);

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.