1 line
6.2 KiB
JavaScript
1 line
6.2 KiB
JavaScript
"use strict";(()=>{var e={};e.id=99,e.ids=[99],e.modules={94572:(e,t,s)=>{s.r(t),s.d(t,{config:()=>S,default:()=>g,getServerSideProps:()=>v,getStaticPaths:()=>j,getStaticProps:()=>f,reportWebVitals:()=>b,routeModule:()=>k,unstable_getServerProps:()=>N,unstable_getServerSideProps:()=>_,unstable_getStaticParams:()=>y,unstable_getStaticPaths:()=>P,unstable_getStaticProps:()=>w});var a={};s.r(a),s.d(a,{default:()=>h,getServerSideProps:()=>x});var r=s(63865),i=s(9455),l=s(30671),n=s(5583),o=s(19796),d=s(8732);s(82015);var c=s(61197),u=s(40778),p=s(93035),m=s(71934);function h({user:e,data:t}){let s=(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("title",{children:"User Dashboard | Datasquirel"}),(0,d.jsx)("meta",{name:"description",content:"Welcome to your data app"})]});return(0,d.jsx)(u.A,{head:s,user:e,children:(0,d.jsx)(p.A,{data:t})})}async function x({req:e,res:t,query:s}){let a=await (0,c.A)(e);return a?.logged_in_status?{props:{user:a,data:{docPages:await (0,m.A)("SELECT * FROM docs_pages WHERE level=1 ORDER BY page_order ASC"),env:"dev_dev"}}}:{redirect:{destination:"/su/login",permanent:!1}}}let g=(0,l.M)(a,"default"),f=(0,l.M)(a,"getStaticProps"),j=(0,l.M)(a,"getStaticPaths"),v=(0,l.M)(a,"getServerSideProps"),S=(0,l.M)(a,"config"),b=(0,l.M)(a,"reportWebVitals"),w=(0,l.M)(a,"unstable_getStaticProps"),P=(0,l.M)(a,"unstable_getStaticPaths"),y=(0,l.M)(a,"unstable_getStaticParams"),N=(0,l.M)(a,"unstable_getServerProps"),_=(0,l.M)(a,"unstable_getServerSideProps"),k=new r.PagesRouteModule({definition:{kind:i.A.PAGES,page:"/su/docs/pages",pathname:"/su/docs/pages",bundlePath:"",filename:""},components:{App:o.default,Document:n.default},userland:a})},55904:(e,t,s)=>{s.d(t,{A:()=>l});var a=s(8732),r=s(82015),i=s.n(r);function l({children:e,column:t,className:s}){let r=i().useRef();return(0,a.jsx)("div",{className:"items-stretch gap-0"+(t?" flex-col":" flex-wrap xl:flex-nowrap")+(s?" "+s:""),ref:r,children:e})}},93035:(e,t,s)=>{s.d(t,{A:()=>m});var a=s(8732),r=s(82015),i=s.n(r),l=s(46169),n=s(16757),o=s(82544);let d=(0,o.A)("Newspaper",[["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",key:"7pis2x"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M10 6h8v4h-8V6Z",key:"smlsk5"}]]),c=(0,o.A)("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);function u({docPageObject:e}){let[t,s]=i().useState(!1),[r,o]=i().useState([]);return(0,a.jsxs)("div",{className:"card col relative cursor-pointer",onClick:t=>{t.target?.closest(".cancel-link")?t.preventDefault():window.location.pathname=`/su/docs/pages/${e.id}`},children:[t&&(0,a.jsx)(n.A,{width:"20px"}),(0,a.jsxs)("div",{className:"w-full items-start",children:[(0,a.jsx)(d,{}),(0,a.jsxs)("div",{className:"flex-col items-start gap-0 relative z-10",children:[(0,a.jsx)("span",{className:"title",children:e.title}),(0,a.jsx)("span",{className:"-my-3",dangerouslySetInnerHTML:{__html:e.description||""}})]}),(0,a.jsxs)("div",{className:"ml-auto cancel-link",children:[(0,a.jsx)("button",{onClick:()=>{window.location.href=`/su/docs/edit-page?id=${e.id}`},className:"outlined small-text light-gray",children:"Edit Page"}),(0,a.jsx)("button",{onClick:()=>{window.confirm("Delete this page?")&&(s(!0),(0,l.A)("/api/admin/docs/delete-page",{method:"post",body:e}).then(e=>{e.success&&window.location.reload(),setTimeout(()=>{s(!1)},1e3)}))},className:"outlined small-text light-gray",children:"Delete Page"})]})]}),r&&(0,a.jsxs)("div",{className:"-mt-[40px] pt-[40px] ml-[10px] pl-[20px] border-0 border-l border-slate-200 border-solid w-full flex-col items-start cancel-link",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(c,{}),(0,a.jsx)("span",{className:"text-slate-300 font-semibold",children:"Children Pages"})]}),r.map((e,t)=>(0,a.jsxs)("div",{className:"card w-full",onClick:()=>{window.location.pathname=`/su/docs/pages/${e.id}`},children:[(0,a.jsx)(d,{}),(0,a.jsx)("span",{children:e.title})]},t))]})]})}var p=s(55904);function m({data:e}){let{env:t}=e,s=e.docPages,[r,o]=i().useState(!1);function d(e){window.confirm(e?"Update Docs DB from JSON file?":"Update docs json file?")&&(o(!0),(0,l.A)("/api/admin/docs/persist",{method:"post",body:{pull:e}}).then(t=>{t.success?window.alert(e?"Docs database table Updated Sucessfully!":"JSON data written Successfully!"):window.alert("Operation failed!"),setTimeout(()=>{o(!1)},1e3)}).catch(e=>{setTimeout(()=>{o(!1)},1e3)}))}return(0,a.jsxs)(i().Fragment,{children:[r&&(0,a.jsx)(n.A,{}),(0,a.jsxs)("section",{className:"items-start justify-start p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between w-full mb-6",children:[(0,a.jsx)("h2",{className:"text-xl m-0",children:"Documentation Pages"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("a",{href:"/su/docs/create-page",className:"button",children:"Create Page"}),(0,a.jsxs)(p.A,{children:[(0,a.jsx)("button",{className:"outlined gray",onClick:()=>{d(!1)},children:"Push"}),(0,a.jsx)("button",{className:"outlined gray",onClick:()=>{d(!0)},children:"Pull"})]})]})]}),(0,a.jsx)("div",{className:"paper flex-col items-stretch gap-10 w-full",children:s.map((e,t)=>(0,a.jsx)(u,{docPageObject:e},t))})]})]})}},71934:(e,t,s)=>{s.d(t,{A:()=>a});async function a(...e){let t=global.DSQL_DB_CONN;try{if(!t)throw Error("No Connection provided to DB_HANDLER function!");let s=await t.query(...e);return JSON.parse(JSON.stringify(s))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await t?.end()}}},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")},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,6622],()=>s(94572));module.exports=a})(); |