"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5667],{10312:function(e,t,s){s.d(t,{Z:function(){return a}});const a=(0,s(45711).Z)("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"}]])},37359:function(e,t,s){s.d(t,{Z:function(){return b}});var a=s(85893),n=s(67294),r=s(41457),i=s(424),c=s(97946),d=(s(68744),s(96891));function l(e){var t=n.useContext(r.DashboardContext),s=t.databases,i=t.setTargetDatabase,c=t.user;return(0,a.jsx)(n.Fragment,{children:(0,a.jsx)(d.Z,{databases:s,setTargetDatabase:i,title:"Recently added Databases",more:!0,user:c})})}var o=s(55592),u=s(33587),x=s(10312),m=s(78107);const h=(0,s(45711).Z)("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){var t=e.icon,s=e.metric,n=e.count,r=e.url;return(0,a.jsxs)("a",{href:r,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:n}),(0,a.jsx)("span",{className:"text-sm text-slate-600 dark:text-slate-400",children:s})]})]})}function v(e){var t=n.useContext(r.DashboardContext),s=(t.databases,t.setTargetDatabase,t.metrics),i=t.user;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?void 0:s.dbCount)||0,icon:(0,a.jsx)(u.Z,{size:20,className:"text-secondary2"}),url:"/admin/".concat(null===i||void 0===i?void 0:i.id,"/databases")}),(0,a.jsx)(j,{metric:"Tables Created",count:(null===s||void 0===s?void 0:s.tablesCount)||0,icon:(0,a.jsx)(x.Z,{size:20,className:"text-primary"})}),(0,a.jsx)(j,{metric:"Media Added",count:(null===s||void 0===s?void 0:s.mediaCount)||0,icon:(0,a.jsx)(m.Z,{size:20,className:"text-slate-500"}),url:"/admin/".concat(null===i||void 0===i?void 0:i.id,"/media")}),(0,a.jsx)(j,{metric:"API Keys",count:(null===s||void 0===s?void 0:s.apiKeysCount)||0,icon:(0,a.jsx)(h,{size:20,className:"text-slate-900 dark:text-white"}),url:"/admin/".concat(null===i||void 0===i?void 0:i.id,"/api-keys")})]})})}function b(e){var t,s=n.useContext(r.DashboardContext),d=(s.databases,s.user);return(0,a.jsxs)(n.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)(i.Z,{user:d})]}),(null===d||void 0===d||null===(t=d.verification_status)||void 0===t?void 0:t.toString().match(/1/))?(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(v,{}),(0,a.jsx)(l,{}),(0,a.jsx)(o.Z,{user:d})]}):(0,a.jsx)(c.Z,{})]})}},41457:function(e,t,s){s.r(t),s.d(t,{DashboardContext:function(){return u},__N_SSP:function(){return o},default:function(){return x}});var a=s(828),n=s(85893),r=s(67294),i=s(54858),c=s(37359),d=s(85012),l={},o=!0,u=r.createContext(l);function x(e){var t=e.user,s=e.databases,l=e.metrics,o=(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("title",{children:"User Dashboard | Datasquirel"}),(0,n.jsx)("meta",{name:"description",content:"Welcome to your data app"})]}),x=r.useState(null),m=(0,a.Z)(x,2),h=m[0],j=m[1];return(0,n.jsx)(i.Z,{head:o,user:t,children:(0,n.jsxs)(u.Provider,{value:{user:t,databases:s,targetDatabase:h,setTargetDatabase:j,metrics:l},children:[(0,n.jsx)(c.Z,{}),(0,n.jsx)(d.Z,{targetDatabase:h})]})})}}}]);