(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[531],{1889:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/[user_id]",function(){return s(4852)}])},8190:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(5737).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"}]])},4852:(e,t,s)=>{"use strict";s.r(t),s.d(t,{DashboardContext:()=>k,__N_SSP:()=>N,default:()=>p});var a=s(4848),i=s(6540),n=s(4725),l=s(3647),r=s(18),c=s(2992);function d(){let{databases:e,setTargetDatabase:t,user:s}=i.useContext(k);return(0,a.jsx)(i.Fragment,{children:(0,a.jsx)(c.A,{databases:e,setTargetDatabase:t,title:"Recently added Databases",more:!0,user:s})})}var o=s(4435),x=s(9140),u=s(8190),m=s(1915);let h=(0,s(5737).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 j(e){let{icon:t,metric:s,count:i,url:n}=e;return(0,a.jsxs)("a",{href:n,className:"card col w-full",children:[(0,a.jsx)("div",{className:"absolute top-4 right-4",children:t}),(0,a.jsxs)("div",{className:"content-block",children:[(0,a.jsx)("span",{className:"metric text-slate-800 dark:text-white",children:i}),(0,a.jsx)("span",{className:"text-sm text-slate-600 dark:text-slate-400",children:s})]})]})}function y(){let{databases:e,setTargetDatabase:t,metrics:s,user:n}=i.useContext(k);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)(j,{metric:"Databases Created",count:(null==s?void 0:s.dbCount)||0,icon:(0,a.jsx)(x.A,{size:20,className:"text-secondary2"}),url:"/admin/".concat(null==n?void 0:n.id,"/databases")}),(0,a.jsx)(j,{metric:"Tables Created",count:(null==s?void 0:s.tablesCount)||0,icon:(0,a.jsx)(u.A,{size:20,className:"text-primary"})}),(0,a.jsx)(j,{metric:"Media Added",count:(null==s?void 0:s.mediaCount)||0,icon:(0,a.jsx)(m.A,{size:20,className:"text-slate-500"}),url:"/admin/".concat(null==n?void 0:n.id,"/media")}),(0,a.jsx)(j,{metric:"API Keys",count:(null==s?void 0:s.apiKeysCount)||0,icon:(0,a.jsx)(h,{size:20,className:"text-slate-900 dark:text-white"}),url:"/admin/".concat(null==n?void 0:n.id,"/api-keys")})]})})}function v(){var e;let{databases:t,user:s}=i.useContext(k);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)(l.A,{user:s})]}),(null==s?void 0:null===(e=s.verification_status)||void 0===e?void 0:e.toString().match(/1/))?(0,a.jsxs)(i.Fragment,{children:[(0,a.jsx)(y,{}),(0,a.jsx)(d,{}),(0,a.jsx)(o.A,{user:s})]}):(0,a.jsx)(r.A,{})]})}var b=s(1670),N=!0;let k=i.createContext({});function p(e){let{user:t,databases:s,metrics:l}=e,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"})]}),[c,d]=i.useState();return(0,a.jsx)(n.A,{head:r,children:(0,a.jsxs)(k.Provider,{value:{user:t,databases:s,targetDatabase:c,setTargetDatabase:d,metrics:l},children:[(0,a.jsx)(v,{}),(0,a.jsx)(b.A,{targetDatabase:c})]})})}}},e=>{var t=t=>e(e.s=t);e.O(0,[1335,3348,4725,1840,636,6593,8792],()=>t(1889)),_N_E=e.O()}]);