2025-01-28 18:43:16 +00:00
|
|
|
"use strict";(()=>{var e={};e.id=5516,e.ids=[5516],e.modules={84231:(e,s,r)=>{r.r(s),r.d(s,{config:()=>j,default:()=>b,getServerSideProps:()=>N,getStaticPaths:()=>L,getStaticProps:()=>f,reportWebVitals:()=>P,routeModule:()=>Q,unstable_getServerProps:()=>E,unstable_getServerSideProps:()=>w,unstable_getStaticParams:()=>B,unstable_getStaticPaths:()=>O,unstable_getStaticProps:()=>A});var t={};r.r(t),r.d(t,{default:()=>g,getServerSideProps:()=>v});var a=r(63865),o=r(9455),n=r(30671),l=r(5583),i=r(19796),c=r(8732),u=r(82015),d=r.n(u),p=r(61197),S=r(40778),_=r(46169),m=r(16757),D=r(1360);function h({data:e}){Object.keys(e.users[0]);let[s,r]=d().useState(null),[t,a]=d().useState(0),[o,n]=d().useState(!1);return console.log(typeof s),(0,c.jsx)(d().Fragment,{children:(0,c.jsxs)("div",{className:"items-stretch gap-10 w-full",children:[(0,c.jsxs)("section",{className:"paper w-full",children:[(0,c.jsx)("h2",{className:"text-xl m-0 mb-6",children:"Users"}),(0,c.jsx)("div",{className:"flex-col items-stretch gap-10",children:e.users.map((e,s)=>(0,c.jsx)(D.A,{userObject:e},s+1))})]}),(0,c.jsxs)("section",{className:"paper",children:[(0,c.jsxs)("div",{className:"w-full justify-between",children:[(0,c.jsx)("h2",{className:"text-xl m-0",children:"Error Logs"}),(0,c.jsx)("div",{children:(0,c.jsxs)("button",{onClick:e=>{window.confirm("Clear Error Logs?")&&(n(!0),(0,_.A)("/api/admin/clearErrorLogs",{method:"POST"}).then(e=>{a(e=>e+1)}),setTimeout(()=>{n(!1)},2e3))},className:"outlined gray relative",children:[o&&(0,c.jsx)(m.A,{width:"20px"}),"Clear Error Log"]})})]}),s&&(0,c.jsx)("p",{dangerouslySetInnerHTML:{__html:s||"No Log"}}),"string"!=typeof s&&(0,c.jsx)(m.A,{position:"relative",width:"25px"})]})]})})}var x=r(71934);function g({user:e,data:s}){let r=(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("title",{children:"User Dashboard | Datasquirel"}),(0,c.jsx)("meta",{name:"description",content:"Welcome to your data app"})]});return(0,c.jsx)(S.A,{head:r,user:e,children:(0,c.jsx)(h,{data:s})})}async function v({req:e,res:s,query:r}){let t=await (0,p.A)(e);return t?.logged_in_status?{props:{user:t,data:{users:await (0,x.A)("SELECT * FROM users ORDER BY id DESC")}}}:{redirect:{destination:"/su/login",permanent:!1}}}let b=(0,n.M)(t,"default"),f=(0,n.M)(t,"getStaticProps"),L=(0,n.M)(t,"getStaticPaths"),N=(0,n.M)(t,"getServerSideProps"),j=(0,n.M)(t,"config"),P=(0,n.M)(t,"reportWebVitals"),A=(0,n.M)(t,"unstable_getStaticProps"),O=(0,n.M)(t,"unstable_getStaticPaths"),B=(0,n.M)(t,"unstable_getStaticParams"),E=(0,n.M)(t,"unstable_getServerProps"),w=(0,n.M)(t,"unstable_getServerSideProps"),Q=new a.PagesRouteModule({definition:{kind:o.A.PAGES,page:"/su",pathname:"/su",bundlePath:"",filename:""},components:{App:i.default,Document:l.default},userland:t})},1360:(e,s,r)=>{r.d(s,{A:()=>n});var t=r(8732),a=r(82015),o=r.n(a);function n({userObject:e,userPage:s}){let r=Object.keys(e),[a,n]=o().useState(!1),[l,i]=o().useState(0),[c,u]=o().useState(!s);return(0,t.jsxs)("div",{className:"card col green w-full overflow-hidden"+(c?s?" h-[100px]":" h-[85px]":" "),children:[(0,t.jsxs)("div",{className:"items-center w-full",children:[(0,t.jsx)("img",{src:e.image_thumbnail,alt:"",className:"rounded-full object-cover"+(s?" w-16 h-16":" w-12 h-12")}),!s&&(0,t.jsxs)("h3",{className:"m-0 text-xl",children:[e.first_name," ",e.last_name," "]}),(0,t.jsxs)("div",{className:"ml-auto",children:[(0,t.jsx)("button",{className:"outlined gray small-text",onClick:e=>{c?u(!1):u(!0)},children:c?"More Details":"Collapse"}),!s&&(0,t.jsx)("a",{href:`/su/users/${e.id}`,className:"button outlined gray small-text",children:"View User"})]})]}),(0,t.jsx)("div",{className:"card no-hover col w-full light-gray-bg",children:r.map((s,a)=>(0,t.jsxs)(o().Fragment,{children:[(0,t.jsx)("div",{children:(0,t.jsxs)("span",{style:{wordBreak:"break-all"},children:[s,":"," ",(0,t.jsx)("b",{children:e[s]})]})}),a<r.length-1&&(0,t.jsx)("hr",{})]},a+1))}),(0,t.jsx)("button",{className:"outlined gray small-text w-full",onClick:e=>{u(!0)},children:"Collapse"})]})}},71934:(e,s,r)=>{r.d(s,{A:()=>a});var t=r(51779);asyn
|