dsql-admin/dsql-app/.local_dist/server/pages/su/docs/edit-page.js
2024-11-06 13:57:20 +01:00

384 lines
11 KiB
JavaScript

"use strict";
(() => {
var exports = {};
exports.id = 3412;
exports.ids = [3412];
exports.modules = {
/***/ 6046:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ UpdatePage),
/* harmony export */ "getServerSideProps": () => (/* binding */ getServerSideProps)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(997);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6689);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _functions_backend_suAdminUserAuth__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1503);
/* harmony import */ var _functions_backend_suAdminUserAuth__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_suAdminUserAuth__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _layouts_SuAdminLayout__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8282);
/* harmony import */ var _components_su_docs_CreatePageContent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2378);
/* harmony import */ var _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9395);
/* harmony import */ var _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_5__);
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {Object} props - Server props
* @param {import("@/package-shared/types").UserType} props.user
* @param {any} props.data
*/ function UpdatePage({ 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,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("title", {
children: pageTitle
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("meta", {
name: "description",
content: pageDescription
})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_layouts_SuAdminLayout__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, {
head: head,
user: user,
children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_su_docs_CreatePageContent__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
data: data,
user: user
})
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Server Side Props or Static Props
* ==============================================================================
* @type {import("next").GetServerSideProps}
*/ async function getServerSideProps({ req , res , query }) {
/**
* User Auth
*
* @description User Auth
*/ const suAdminUser = await _functions_backend_suAdminUserAuth__WEBPACK_IMPORTED_MODULE_2___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 targetDocPage = await _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_5___default()(`SELECT * FROM docs_pages WHERE id=?`, [
query.id
]);
if (!targetDocPage || !Array.isArray(targetDocPage) || !targetDocPage[0]) {
return {
redirect: {
destination: `/su/docs`,
permanent: false
}
};
}
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Server props return
*
* @description Return data fetched on the server side
*/ return {
props: {
user: suAdminUser,
data: targetDocPage[0]
}
};
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
/***/ }),
/***/ 371:
/***/ ((module) => {
module.exports = require("@mui/icons-material/AdsClickTwoTone");
/***/ }),
/***/ 3257:
/***/ ((module) => {
module.exports = require("@mui/icons-material/ArrowBackIosRounded");
/***/ }),
/***/ 9318:
/***/ ((module) => {
module.exports = require("@mui/icons-material/BackupTwoTone");
/***/ }),
/***/ 4173:
/***/ ((module) => {
module.exports = require("@mui/icons-material/Close");
/***/ }),
/***/ 386:
/***/ ((module) => {
module.exports = require("@mui/icons-material/CottageTwoTone");
/***/ }),
/***/ 6502:
/***/ ((module) => {
module.exports = require("@mui/icons-material/DeleteTwoTone");
/***/ }),
/***/ 930:
/***/ ((module) => {
module.exports = require("@mui/icons-material/DifferenceTwoTone");
/***/ }),
/***/ 9361:
/***/ ((module) => {
module.exports = require("@mui/icons-material/DoDisturbAltTwoTone");
/***/ }),
/***/ 6817:
/***/ ((module) => {
module.exports = require("@mui/icons-material/DocumentScannerTwoTone");
/***/ }),
/***/ 6094:
/***/ ((module) => {
module.exports = require("@mui/icons-material/ErrorTwoTone");
/***/ }),
/***/ 328:
/***/ ((module) => {
module.exports = require("@mui/icons-material/HighlightAltTwoTone");
/***/ }),
/***/ 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");
/***/ }),
/***/ 282:
/***/ ((module) => {
module.exports = require("@mui/icons-material/SkipNextTwoTone");
/***/ }),
/***/ 3729:
/***/ ((module) => {
module.exports = require("@mui/icons-material/SkipPreviousTwoTone");
/***/ }),
/***/ 723:
/***/ ((module) => {
module.exports = require("@mui/icons-material/StyleTwoTone");
/***/ }),
/***/ 415:
/***/ ((module) => {
module.exports = require("@mui/icons-material/TerminalTwoTone");
/***/ }),
/***/ 1358:
/***/ ((module) => {
module.exports = require("@mui/icons-material/TextRotateUpTwoTone");
/***/ }),
/***/ 4864:
/***/ ((module) => {
module.exports = require("@mui/icons-material/TextRotateVerticalTwoTone");
/***/ }),
/***/ 5139:
/***/ ((module) => {
module.exports = require("@mui/icons-material/ViewTimelineTwoTone");
/***/ }),
/***/ 5692:
/***/ ((module) => {
module.exports = require("@mui/material");
/***/ }),
/***/ 6451:
/***/ ((module) => {
module.exports = require("@tinymce/tinymce-react");
/***/ }),
/***/ 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,5264,6729,5449,4480,424,1781,7901,4114,1503,5313,2378], () => (__webpack_exec__(6046)));
module.exports = __webpack_exports__;
})();