1 line
5.1 KiB
JavaScript
1 line
5.1 KiB
JavaScript
"use strict";(()=>{var e={};e.id=5109,e.ids=[5109],e.modules={9591:(e,s,r)=>{r.r(s),r.d(s,{config:()=>j,default:()=>v,getServerSideProps:()=>b,getStaticPaths:()=>f,getStaticProps:()=>g,reportWebVitals:()=>N,routeModule:()=>B,unstable_getServerProps:()=>w,unstable_getServerSideProps:()=>O,unstable_getStaticParams:()=>A,unstable_getStaticPaths:()=>P,unstable_getStaticProps:()=>L});var t={};r.r(t),r.d(t,{default:()=>x,getServerSideProps:()=>D});var a=r(63865),n=r(9455),l=r(30671),o=r(5583),i=r(19796),c=r(8732),u=r(82015),d=r.n(u),p=r(61197),S=r(40778),_=r(1360);function m({data:e}){return(0,c.jsx)(d().Fragment,{children:(0,c.jsxs)("section",{className:"items-start justify-start p-6",children:[(0,c.jsxs)("div",{className:"flex flex-row items-center w-full gap-20 mb-6 justify-between",children:[(0,c.jsx)("h2",{className:"text-xl m-0",children:"Users"}),(0,c.jsx)("a",{href:"/su/users/new",className:"button",children:"Add User"})]}),(0,c.jsx)("div",{className:"flex-col items-stretch gap-10 w-full",children:e.users.map((e,s)=>(0,c.jsx)(_.A,{userObject:e},s+1))})]})})}var h=r(71934);function x({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)(m,{data:s})})}async function D({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,h.A)("SELECT * FROM users")).reverse()}}}:{redirect:{destination:"/su/login",permanent:!1}}}let v=(0,l.M)(t,"default"),g=(0,l.M)(t,"getStaticProps"),f=(0,l.M)(t,"getStaticPaths"),b=(0,l.M)(t,"getServerSideProps"),j=(0,l.M)(t,"config"),N=(0,l.M)(t,"reportWebVitals"),L=(0,l.M)(t,"unstable_getStaticProps"),P=(0,l.M)(t,"unstable_getStaticPaths"),A=(0,l.M)(t,"unstable_getStaticParams"),w=(0,l.M)(t,"unstable_getServerProps"),O=(0,l.M)(t,"unstable_getServerSideProps"),B=new a.PagesRouteModule({definition:{kind:n.A.PAGES,page:"/su/users",pathname:"/su/users",bundlePath:"",filename:""},components:{App:i.default,Document:o.default},userland:t})},1360:(e,s,r)=>{r.d(s,{A:()=>l});var t=r(8732),a=r(82015),n=r.n(a);function l({userObject:e,userPage:s}){let r=Object.keys(e),[a,l]=n().useState(!1),[o,i]=n().useState(0),[c,u]=n().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)(n().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);async function a(...e){let s=(0,t.A)();try{if(!s)throw Error("No Connection provided to DB_HANDLER function!");let r=await s.query(...e);return JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await s?.end()}}},51779:(e,s,r)=>{r.d(s,{A:()=>n});var t=r(9973),a=r.n(t);function n(e){return e?.ro?DSQL_READ_ONLY_DB_CONN||a()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):e?.fa?global.DSQL_FULL_ACCESS_DB_CONN||a()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_FULL_ACCESS_USERNAME,password:process.env.DSQL_DB_FULL_ACCESS_PASSWORD,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):global.DSQL_DB_CONN||a()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:e?.noDb?void 0:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}})}},13893:e=>{e.exports=require("@moduletrace/datasquirel/dist/client/fetch")},40361:e=>{e.exports=require("next/dist/compiled/next-server/pages.runtime.prod.js")},27912:e=>{e.exports=require("next/head")},82015:e=>{e.exports=require("react")},22326:e=>{e.exports=require("react-dom")},8732:e=>{e.exports=require("react/jsx-runtime")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},33873:e=>{e.exports=require("path")}};var s=require("../../webpack-runtime.js");s.C(e);var r=e=>s(s.s=e),t=s.X(0,[883,9821,9796,6622],()=>r(9591));module.exports=t})(); |