dsql-admin/dsql-app/.local_dist/server/pages/admin/[user_id].js

14 lines
5.5 KiB
JavaScript
Raw Normal View History

2025-01-13 08:00:21 +00:00
"use strict";(()=>{var e={};e.id=531,e.ids=[531],e.modules={65102:(e,t,s)=>{s.r(t),s.d(t,{config:()=>m,default:()=>o,getServerSideProps:()=>x,getStaticPaths:()=>u,getStaticProps:()=>c,reportWebVitals:()=>p,routeModule:()=>y,unstable_getServerProps:()=>j,unstable_getServerSideProps:()=>S,unstable_getStaticParams:()=>g,unstable_getStaticPaths:()=>b,unstable_getStaticProps:()=>h});var a=s(63865),r=s(9455),i=s(30671),n=s(5583),d=s(19796),l=s(3530);let o=(0,i.M)(l,"default"),c=(0,i.M)(l,"getStaticProps"),u=(0,i.M)(l,"getStaticPaths"),x=(0,i.M)(l,"getServerSideProps"),m=(0,i.M)(l,"config"),p=(0,i.M)(l,"reportWebVitals"),h=(0,i.M)(l,"unstable_getStaticProps"),b=(0,i.M)(l,"unstable_getStaticPaths"),g=(0,i.M)(l,"unstable_getStaticParams"),j=(0,i.M)(l,"unstable_getServerProps"),S=(0,i.M)(l,"unstable_getServerSideProps"),y=new a.PagesRouteModule({definition:{kind:r.A.PAGES,page:"/admin/[user_id]",pathname:"/admin/[user_id]",bundlePath:"",filename:""},components:{App:d.default,Document:n.default},userland:l})},71192:(e,t,s)=>{s.d(t,{A:()=>j});var a=s(8732),r=s(82015),i=s.n(r),n=s(3530),d=s(53926),l=s(66485),o=s(56331);function c(){let{databases:e,setTargetDatabase:t,user:s}=i().useContext(n.DashboardContext);return(0,a.jsx)(i().Fragment,{children:(0,a.jsx)(o.A,{databases:e,setTargetDatabase:t,title:"Recently added Databases",more:!0,user:s})})}var u=s(67274),x=s(34637),m=s(93213),p=s(83158);let h=(0,s(82544).A)("Key",[["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["path",{d:"m15.5 7.5 3 3L22 7l-3-3",key:"1rn1fs"}]]);function b({icon:e,metric:t,count:s,url:r}){return(0,a.jsxs)("a",{href:r,className:"card col w-full",children:[(0,a.jsx)("div",{className:"absolute top-4 right-4",children:e}),(0,a.jsxs)("div",{className:"content-block",children:[(0,a.jsx)("span",{className:"metric text-slate-800 dark:text-white",children:s}),(0,a.jsx)("span",{className:"text-sm text-slate-600 dark:text-slate-400",children:t})]})]})}function g(){let{databases:e,setTargetDatabase:t,metrics:s,user:r}=i().useContext(n.DashboardContext);return(0,a.jsx)("section",{className:"p-0",children:(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 w-full gap-6 items-stretch",children:[(0,a.jsx)(b,{metric:"Databases Created",count:s?.dbCount||0,icon:(0,a.jsx)(x.A,{size:20,className:"text-secondary2"}),url:`/admin/${r?.id}/databases`}),(0,a.jsx)(b,{metric:"Tables Created",count:s?.tablesCount||0,icon:(0,a.jsx)(m.A,{size:20,className:"text-primary"})}),(0,a.jsx)(b,{metric:"Media Added",count:s?.mediaCount||0,icon:(0,a.jsx)(p.A,{size:20,className:"text-slate-500"}),url:`/admin/${r?.id}/media`}),(0,a.jsx)(b,{metric:"API Keys",count:s?.apiKeysCount||0,icon:(0,a.jsx)(h,{size:20,className:"text-slate-900 dark:text-white"}),url:`/admin/${r?.id}/api-keys`})]})})}function j(){let{databases:e,user:t}=i().useContext(n.DashboardContext);return(0,a.jsxs)(i().Fragment,{children:[(0,a.jsxs)("div",{className:"flex-col items-start gap-0",children:[(0,a.jsx)("h1",{className:"text-3xl m-0",children:"Dashboard"}),(0,a.jsx)(d.A,{user:t})]}),t?.verification_status?.toString().match(/1/)?(0,a.jsxs)(i().Fragment,{children:[(0,a.jsx)(g,{}),(0,a.jsx)(c,{}),(0,a.jsx)(u.A,{user:t})]}):(0,a.jsx)(l.A,{})]})}},93213:(e,t,s)=>{s.d(t,{A:()=>a});let a=(0,s(82544).A)("Sheet",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["line",{x1:"3",x2:"21",y1:"9",y2:"9",key:"1vqk6q"}],["line",{x1:"3",x2:"21",y1:"15",y2:"15",key:"o2sbyz"}],["line",{x1:"9",x2:"9",y1:"9",y2:"21",key:"1ib60c"}],["line",{x1:"15",x2:"15",y1:"9",y2:"21",key:"1n26ft"}]])},3530:(e,t,s)=>{s.r(t),s.d(t,{DashboardContext:()=>u,default:()=>x,getServerSideProps:()=>m});var a=s(8732),r=s(82015),i=s.n(r),n=s(25562),d=s(92702),l=s(71192),o=s(70355),c=s(71934);let u=i().createContext({});function x({user:e,databases:t,metrics:s}){let r=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("title",{children:"User Dashboard | Datasquirel"}),(0,a.jsx)("meta",{name:"description",content:"Welcome to your data app"})]}),[d,c]=i().useState();return(0,a.jsx)(n.A,{head:
SELECT (
SELECT COUNT(id) FROM user_databases WHERE user_id=?
) AS dbCount,
(
SELECT COUNT(id) FROM user_database_tables WHERE user_id=?
) AS tablesCount,
(
SELECT COUNT(id) FROM user_media WHERE user_id=?
) AS mediaCount,
(
SELECT COUNT(id) FROM api_keys WHERE user_id=?
) AS apiKeysCount
`,[a.id,a.id,a.id,a.id]);return{props:{user:a,databases:r,metrics:i&&i[0]?i[0]:{}}}}},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")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")}};var t=require("../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),a=t.X(0,[883,9821,9796,5392,6160],()=>s(65102));module.exports=a})();