2024-12-09 09:39:09 +00:00
|
|
|
"use strict";(()=>{var e={};e.id=189,e.ids=[189],e.modules={19881:(e,t,s)=>{s.r(t),s.d(t,{config:()=>U,default:()=>E,getServerSideProps:()=>D,getStaticPaths:()=>C,getStaticProps:()=>R,reportWebVitals:()=>I,routeModule:()=>k,unstable_getServerProps:()=>O,unstable_getServerSideProps:()=>W,unstable_getStaticParams:()=>H,unstable_getStaticPaths:()=>F,unstable_getStaticProps:()=>L});var a={};s.r(a),s.d(a,{SettingsContext:()=>A,default:()=>q,getServerSideProps:()=>M});var r=s(63865),i=s(9455),l=s(30671),n=s(49407),o=s(89600),c=s(8732),u=s(82015),d=s.n(u),m=s(95222),p=s(20048),g=s.n(p);s(26295);var h=s(58548),x=s(70045),f=s(79100),j=s(55158),S=s(62506);function w({user:e,image:t,setImage:s}){let a=d().useRef();return(0,c.jsxs)("div",{className:"paper w-full items-center",children:[(0,c.jsx)("h2",{className:"m-0 text-xl",children:"User Image"}),(0,c.jsx)("div",{className:"bg-white rounded-full overflow-hidden w-24 h-24",children:(0,c.jsx)("img",{src:t?"string"==typeof t?t:t.imageBase64Full:"/images/database-placeholder.png",alt:"User Image",width:100,className:"w-full h-full object-cover",ref:a,"data-imagepreview":"image"})}),(0,c.jsxs)("div",{className:"w-full flex-col",id:"upload-user-image-options",children:[(0,c.jsxs)(S.A,{column:!0,className:"w-full",children:[(0,c.jsx)("button",{className:"outlined gray w-full whitespace-normal",onClick:e=>{(0,j.PB)("user-media-popup")},children:"Choose image From your Uploads"}),(0,c.jsx)("button",{className:"secondary w-full whitespace-normal",onClick:e=>{let t=e.target;t.closest("#upload-user-image-options")?.querySelector("input")?.click()},children:(0,c.jsx)("span",{children:"Choose image From your Computer"})})]}),(0,c.jsx)("input",{type:"file",accept:".png,.jpg,.jpeg,.webp",placeholder:"Choose Image",className:"hidden",onChange:async e=>{let t=e.target,a=t?.files?.[0];a&&s(await (0,f.A)({imageInputFile:a,maxWidth:400}))}})]})]})}function v(e){let{user:t,image:s,setImage:a,activeUser:r}=d().useContext(A),[i,l]=d().useState(!1);return(0,c.jsxs)(d().Fragment,{children:[(0,c.jsxs)("div",{className:"flex-col items-start gap-0 w-full",children:[(0,c.jsxs)("div",{className:"w-full flex items-center justify-between",children:[(0,c.jsx)("h1",{className:"text-3xl m-0",children:"Settings"}),(0,c.jsx)("div",{children:!t?.social_login&&(0,c.jsx)("a",{href:"/send-password-reset-link",className:"button outlined",children:"Reset Password"})})]}),(0,c.jsx)(h.A,{user:t})]}),(0,c.jsx)("section",{className:"p-0",children:(0,c.jsxs)("div",{className:"w-full grid grid-cols-1 xl:grid-cols-2 gap-8 items-stretch",children:[(0,c.jsxs)("div",{className:"paper w-full",children:[(0,c.jsx)("h2",{className:"m-0 text-xl",children:"Account Information"}),(0,c.jsxs)("div",{className:"flex flex-row w-full",children:[(0,c.jsx)("span",{children:"USER ID"}),(0,c.jsx)("b",{className:"info w-auto",children:t.id})]}),(0,c.jsx)(x.A,{user:r,image:s})]}),(0,c.jsx)("div",{className:"items-stretch",children:(0,c.jsx)(w,{image:s,setImage:a})})]})}),!1]})}s(32415);var b=s(42105),N=s(41658),_=s.n(N),y=s(67216),P=s.n(y);let A=d().createContext({});function q({user:e,databases:t,activeUser:s}){let a=(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"})]}),[r,i]=d().useState(s.image);return(0,c.jsx)(m.A,{head:a,user:e,children:(0,c.jsxs)(A.Provider,{value:{user:e,image:r,setImage:i,activeUser:s},children:[(0,c.jsx)(v,{}),(0,c.jsx)(b.A,{setDbImage:i})]})})}async function M({req:e,res:t,query:s}){let a=await g()(e,t);if(!a?.logged_in_status)return{redirect:{destination:"/login",permanent:!1}};let r=await _()(`SELECT SCHEMA_NAME AS dbFullName FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME LIKE 'user_${a.id}%'`),i=await P()(`SELECT first_name,last_name,username,email,image,image_thumbnail FROM users WHERE id='${a.id}'`);return{props:{user:a,databases:r,activeUser:i[0]}}}let E=(0,l.M)(a,"default"),R=(0,l.M)(a,"getStaticProps"),C=(0,l.M)(a,"getStaticPaths"),D=(0,l.M)(a,"getServerSideProps"),U=(0,l.M)(a,"config"),I=(0,l.M)(
|