355 lines
12 KiB
JavaScript
355 lines
12 KiB
JavaScript
"use strict";
|
|
(() => {
|
|
var exports = {};
|
|
exports.id = 6881;
|
|
exports.ids = [6881];
|
|
exports.modules = {
|
|
|
|
/***/ 2948:
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
// ESM COMPAT FLAG
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
"default": () => (/* binding */ UsersPage),
|
|
"getServerSideProps": () => (/* binding */ getServerSideProps)
|
|
});
|
|
|
|
// EXTERNAL MODULE: external "react/jsx-runtime"
|
|
var jsx_runtime_ = __webpack_require__(997);
|
|
// EXTERNAL MODULE: external "react"
|
|
var external_react_ = __webpack_require__(6689);
|
|
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
|
|
// EXTERNAL MODULE: ./functions/backend/suAdminUserAuth.js
|
|
var suAdminUserAuth = __webpack_require__(1503);
|
|
var suAdminUserAuth_default = /*#__PURE__*/__webpack_require__.n(suAdminUserAuth);
|
|
// EXTERNAL MODULE: ./layouts/SuAdminLayout.jsx + 2 modules
|
|
var SuAdminLayout = __webpack_require__(8282);
|
|
// EXTERNAL MODULE: ./components/su/components/UserCard.jsx
|
|
var UserCard = __webpack_require__(1336);
|
|
;// CONCATENATED MODULE: ./components/su/SuUsersContent.jsx
|
|
// @ts-check
|
|
/**
|
|
* ==============================================================================
|
|
* Imports
|
|
* ==============================================================================
|
|
*/
|
|
|
|
|
|
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
|
* ==============================================================================
|
|
* Main Component { Functional }
|
|
* ==============================================================================
|
|
* @param {Object} props - Server props
|
|
* @param {any} props.data
|
|
*/ function SuUsersContent({ data }) {
|
|
/**
|
|
* Get Contexts
|
|
*
|
|
* @abstract { React.useContext }
|
|
*/ ////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
/**
|
|
* Javascript Variables
|
|
*
|
|
* @abstract Non hook variables and functions
|
|
*/ ////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
/**
|
|
* React Hooks
|
|
*
|
|
* @abstract { useState, useEffect, useRef, etc ... }
|
|
*/ ////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
/**
|
|
* Function Return
|
|
*
|
|
* @abstract Main Function Return
|
|
*/ return /*#__PURE__*/ jsx_runtime_.jsx((external_react_default()).Fragment, {
|
|
children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("section", {
|
|
className: "items-start justify-start p-6",
|
|
children: [
|
|
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
|
|
className: "flex flex-row items-center w-full gap-20 mb-6 justify-between",
|
|
children: [
|
|
/*#__PURE__*/ jsx_runtime_.jsx("h2", {
|
|
className: "text-xl m-0",
|
|
children: "Users"
|
|
}),
|
|
/*#__PURE__*/ jsx_runtime_.jsx("a", {
|
|
href: "/su/users/new",
|
|
className: "button",
|
|
children: "Add User"
|
|
})
|
|
]
|
|
}),
|
|
/*#__PURE__*/ jsx_runtime_.jsx("div", {
|
|
className: "flex-col items-stretch gap-10 w-full",
|
|
children: data.users.map((/** @type {import("@/package-shared/types").UserType} */ userObject, /** @type {Number} */ index)=>{
|
|
return /*#__PURE__*/ jsx_runtime_.jsx(UserCard/* default */.Z, {
|
|
userObject: userObject
|
|
}, index + 1);
|
|
})
|
|
})
|
|
]
|
|
})
|
|
});
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
|
|
|
|
// EXTERNAL MODULE: ./package-shared/utils/backend/global-db/DB_HANDLER.js
|
|
var DB_HANDLER = __webpack_require__(9395);
|
|
var DB_HANDLER_default = /*#__PURE__*/__webpack_require__.n(DB_HANDLER);
|
|
;// CONCATENATED MODULE: ./pages/su/users/index.jsx
|
|
// @ts-check
|
|
/**
|
|
* ==============================================================================
|
|
* Imports
|
|
* ==============================================================================
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
|
* ==============================================================================
|
|
* Main Component { Functional }
|
|
* ==============================================================================
|
|
* @param {Object} props - Server props
|
|
* @param {import("@/package-shared/types").UserType} props.user
|
|
* @param {any} props.data
|
|
*/ function UsersPage({ user , data }) {
|
|
/**
|
|
* Get Contexts
|
|
*
|
|
* @abstract { React.useContext }
|
|
*/ ////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
/**
|
|
* Javascript Variables
|
|
*
|
|
* @abstract Non hook variables and functions
|
|
*/ const pageTitle = "User Dashboard | Datasquirel";
|
|
const pageDescription = "Welcome to your data app";
|
|
let head = /*#__PURE__*/ (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
|
|
children: [
|
|
/*#__PURE__*/ jsx_runtime_.jsx("title", {
|
|
children: pageTitle
|
|
}),
|
|
/*#__PURE__*/ jsx_runtime_.jsx("meta", {
|
|
name: "description",
|
|
content: pageDescription
|
|
})
|
|
]
|
|
});
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
/**
|
|
* React Hooks
|
|
*
|
|
* @abstract { useState, useEffect, useRef, etc ... }
|
|
*/ ////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
/**
|
|
* Function Return
|
|
*
|
|
* @abstract Main Function Return
|
|
*/ return /*#__PURE__*/ jsx_runtime_.jsx(SuAdminLayout/* default */.Z, {
|
|
head: head,
|
|
user: user,
|
|
children: /*#__PURE__*/ jsx_runtime_.jsx(SuUsersContent, {
|
|
data: data
|
|
})
|
|
});
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
}
|
|
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
|
* ==============================================================================
|
|
* Server Side Props or Static Props
|
|
* ==============================================================================
|
|
* @type {import("next").GetServerSideProps}
|
|
*/ async function getServerSideProps({ req , res , query }) {
|
|
/**
|
|
* User Auth
|
|
*
|
|
* @description User Auth
|
|
*/ const suAdminUser = await suAdminUserAuth_default()(req);
|
|
if (!suAdminUser?.logged_in_status) {
|
|
return {
|
|
redirect: {
|
|
destination: `/su/login`,
|
|
permanent: false
|
|
}
|
|
};
|
|
}
|
|
/**
|
|
* Page/Site Data Data Fetching
|
|
*
|
|
* @description Fetch data on the server before returning
|
|
*/ const users = await DB_HANDLER_default()(`SELECT * FROM users`);
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
/**
|
|
* Server props return
|
|
*
|
|
* @description Return data fetched on the server side
|
|
*/ return {
|
|
props: {
|
|
user: suAdminUser,
|
|
data: {
|
|
users: users.reverse()
|
|
}
|
|
}
|
|
};
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 9318:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("@mui/icons-material/BackupTwoTone");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 386:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("@mui/icons-material/CottageTwoTone");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6817:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("@mui/icons-material/DocumentScannerTwoTone");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6094:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("@mui/icons-material/ErrorTwoTone");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6547:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("@mui/icons-material/LockPersonTwoTone");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 5557:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("@mui/icons-material/MenuBookTwoTone");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 8245:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("@mui/icons-material/PeopleAltTwoTone");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 415:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("@mui/icons-material/TerminalTwoTone");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2423:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("lucide-react");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 968:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("next/head");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6689:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("react");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 997:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("react/jsx-runtime");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2261:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("serverless-mysql");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 4300:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("buffer");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6113:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("crypto");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 7147:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("fs");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 3685:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("http");
|
|
|
|
/***/ })
|
|
|
|
};
|
|
;
|
|
|
|
// load runtime
|
|
var __webpack_require__ = require("../../webpack-runtime.js");
|
|
__webpack_require__.C(exports);
|
|
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
|
var __webpack_exports__ = __webpack_require__.X(0, [4017,8313,4480,1503,5313,1336], () => (__webpack_exec__(2948)));
|
|
module.exports = __webpack_exports__;
|
|
|
|
})(); |