dsql-admin/dsql-app/.local_dist/server/pages/su.js

1 line
5.3 KiB
JavaScript
Raw Permalink Normal View History

2024-12-09 09:39:09 +00:00
"use strict";(()=>{var e={};e.id=5516,e.ids=[5516],e.modules={42452:(e,s,t)=>{t.r(s),t.d(s,{config:()=>_,default:()=>j,getServerSideProps:()=>b,getStaticPaths:()=>v,getStaticProps:()=>f,reportWebVitals:()=>w,routeModule:()=>q,unstable_getServerProps:()=>D,unstable_getServerSideProps:()=>M,unstable_getStaticParams:()=>y,unstable_getStaticPaths:()=>P,unstable_getStaticProps:()=>N});var r={};t.r(r),t.d(r,{default:()=>g,getServerSideProps:()=>S});var a=t(63865),l=t(9455),n=t(30671),i=t(49407),o=t(89600),c=t(8732);t(82015);var u=t(93615),d=t.n(u),p=t(49888),x=t(36299),m=t(67216),h=t.n(m);function g({user:e,data:s}){let t=(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)(p.A,{head:t,user:e,children:(0,c.jsx)(x.A,{data:s})})}async function S({req:e,res:s,query:t}){let r=await d()(e);return r?.logged_in_status?{props:{user:r,data:{users:await h()("SELECT * FROM users ORDER BY id DESC")}}}:{redirect:{destination:"/su/login",permanent:!1}}}let j=(0,n.M)(r,"default"),f=(0,n.M)(r,"getStaticProps"),v=(0,n.M)(r,"getStaticPaths"),b=(0,n.M)(r,"getServerSideProps"),_=(0,n.M)(r,"config"),w=(0,n.M)(r,"reportWebVitals"),N=(0,n.M)(r,"unstable_getStaticProps"),P=(0,n.M)(r,"unstable_getStaticPaths"),y=(0,n.M)(r,"unstable_getStaticParams"),D=(0,n.M)(r,"unstable_getServerProps"),M=(0,n.M)(r,"unstable_getServerSideProps"),q=new a.PagesRouteModule({definition:{kind:l.A.PAGES,page:"/su",pathname:"/su",bundlePath:"",filename:""},components:{App:o.default,Document:i.default},userland:r})},36299:(e,s,t)=>{t.d(s,{A:()=>c});var r=t(8732),a=t(82015),l=t.n(a),n=t(63715),i=t(32415),o=t(21498);function c({data:e}){Object.keys(e.users[0]);let[s,t]=l().useState(null),[a,c]=l().useState(0),[u,d]=l().useState(!1);return console.log(typeof s),(0,r.jsx)(l().Fragment,{children:(0,r.jsxs)("div",{className:"items-stretch gap-10 w-full",children:[(0,r.jsxs)("section",{className:"paper w-full",children:[(0,r.jsx)("h2",{className:"text-xl m-0 mb-6",children:"Users"}),(0,r.jsx)("div",{className:"flex-col items-stretch gap-10",children:e.users.map((e,s)=>(0,r.jsx)(o.A,{userObject:e},s+1))})]}),(0,r.jsxs)("section",{className:"paper",children:[(0,r.jsxs)("div",{className:"w-full justify-between",children:[(0,r.jsx)("h2",{className:"text-xl m-0",children:"Error Logs"}),(0,r.jsx)("div",{children:(0,r.jsxs)("button",{onClick:e=>{window.confirm("Clear Error Logs?")&&(d(!0),(0,n.A)("/api/admin/clearErrorLogs","post").then(e=>{c(e=>e+1)}),setTimeout(()=>{d(!1)},2e3))},className:"outlined gray relative",children:[u&&(0,r.jsx)(i.A,{width:"20px"}),"Clear Error Log"]})})]}),s&&(0,r.jsx)("p",{dangerouslySetInnerHTML:{__html:s||"No Log"}}),"string"!=typeof s&&(0,r.jsx)(i.A,{position:"relative",width:"25px"})]})]})})}},21498:(e,s,t)=>{t.d(s,{A:()=>n});var r=t(8732),a=t(82015),l=t.n(a);function n({userObject:e,userPage:s}){let t=Object.keys(e),[a,n]=l().useState(!1),[i,o]=l().useState(0),[c,u]=l().useState(!s);return(0,r.jsxs)("div",{className:"card col green w-full overflow-hidden"+(c?s?" h-[100px]":" h-[85px]":" "),children:[(0,r.jsxs)("div",{className:"items-center w-full",children:[(0,r.jsx)("img",{src:e.image_thumbnail,alt:"",className:"rounded-full object-cover"+(s?" w-16 h-16":" w-12 h-12")}),!s&&(0,r.jsxs)("h3",{className:"m-0 text-xl",children:[e.first_name," ",e.last_name," "]}),(0,r.jsxs)("div",{className:"ml-auto",children:[(0,r.jsx)("button",{className:"outlined gray small-text",onClick:e=>{c?u(!1):u(!0)},children:c?"More Details":"Collapse"}),!s&&(0,r.jsx)("a",{href:`/su/users/${e.id}`,className:"button outlined gray small-text",children:"View User"})]})]}),(0,r.jsx)("div",{className:"card no-hover col w-full light-gray-bg",children:t.map((s,a)=>(0,r.jsxs)(l().Fragment,{children:[(0,r.jsx)("div",{children:(0,r.jsxs)("span",{style:{wordBreak:"break-all"},children:[s,":"," ",(0,r.jsx)("b",{children:e[s]})]})}),a<t.length-1&&(0,r.jsx)("hr",{})]},a+1))}),(0,r.jsx)("button",{className:"outlined gray small-text w-full",onClick:e=>{u(!0)},chil