752 lines
37 KiB
JavaScript
752 lines
37 KiB
JavaScript
|
"use strict";
|
||
|
exports.id = 4858;
|
||
|
exports.ids = [4858];
|
||
|
exports.modules = {
|
||
|
|
||
|
/***/ 6355:
|
||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
|
||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||
|
/* harmony export */ "Z": () => (/* binding */ DiskUsageComponent)
|
||
|
/* 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_frontend_fetchApi__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(6729);
|
||
|
/* harmony import */ var _functions_frontend_updateDiskUsage__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(1069);
|
||
|
/* harmony import */ var _LoadingBlock__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5264);
|
||
|
/* harmony import */ var _mui_icons_material_CloudQueueRounded__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4008);
|
||
|
/* harmony import */ var _mui_icons_material_CloudQueueRounded__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_mui_icons_material_CloudQueueRounded__WEBPACK_IMPORTED_MODULE_3__);
|
||
|
/* harmony import */ var _mui_icons_material_RefreshRounded__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(36);
|
||
|
/* harmony import */ var _mui_icons_material_RefreshRounded__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_mui_icons_material_RefreshRounded__WEBPACK_IMPORTED_MODULE_4__);
|
||
|
/* harmony import */ var _mui_icons_material_CloudOffTwoTone__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(69);
|
||
|
/* harmony import */ var _mui_icons_material_CloudOffTwoTone__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_mui_icons_material_CloudOffTwoTone__WEBPACK_IMPORTED_MODULE_5__);
|
||
|
/* harmony import */ var lucide_react__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(2423);
|
||
|
/* harmony import */ var lucide_react__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lucide_react__WEBPACK_IMPORTED_MODULE_6__);
|
||
|
// @ts-check
|
||
|
/**
|
||
|
* ==============================================================================
|
||
|
* Imports
|
||
|
* ==============================================================================
|
||
|
*/
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||
|
* ==============================================================================
|
||
|
* Main Component { Functional }
|
||
|
* ==============================================================================
|
||
|
* @param {Object} props - Server props
|
||
|
*/ function DiskUsageComponent(props) {
|
||
|
/**
|
||
|
* Get Contexts
|
||
|
*
|
||
|
* @abstract { React.useContext }
|
||
|
*/ ////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
/**
|
||
|
* Javascript Variables
|
||
|
*
|
||
|
* @abstract Non hook variables and functions
|
||
|
*/ ////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
/**
|
||
|
* React Hooks
|
||
|
*
|
||
|
* @abstract { useState, useEffect, useRef, etc ... }
|
||
|
*/ const [loading, setLoading] = react__WEBPACK_IMPORTED_MODULE_1___default().useState(true);
|
||
|
/** @type {[ diskUsage: number, setDiskUsage: React.Dispatch<React.SetStateAction<number>> ]} */ // @ts-ignore
|
||
|
const [diskUsage, setDiskUsage] = react__WEBPACK_IMPORTED_MODULE_1___default().useState(0);
|
||
|
const [refresh, setRefresh] = react__WEBPACK_IMPORTED_MODULE_1___default().useState(0);
|
||
|
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(()=>{
|
||
|
if (diskUsage) return;
|
||
|
// if (localStorage.getItem("disk_usage")) {
|
||
|
// setDiskUsage(parseFloat(localStorage.getItem("disk_usage")));
|
||
|
// return;
|
||
|
// }
|
||
|
(0,_functions_frontend_fetchApi__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z)("/api/getDiskUsage").then((res)=>{
|
||
|
// console.log(res);
|
||
|
if (res?.total) {
|
||
|
setDiskUsage(res.total);
|
||
|
localStorage.setItem("disk_usage", res.total);
|
||
|
}
|
||
|
setLoading(false);
|
||
|
});
|
||
|
}, []);
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
/**
|
||
|
* Function Return
|
||
|
*
|
||
|
* @abstract Main Function Return
|
||
|
*/ if (loading) return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
|
||
|
className: "button ghost small-text",
|
||
|
style: {
|
||
|
height: "30px"
|
||
|
},
|
||
|
children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_LoadingBlock__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, {
|
||
|
width: "15px",
|
||
|
position: "relative"
|
||
|
})
|
||
|
});
|
||
|
return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((react__WEBPACK_IMPORTED_MODULE_1___default().Fragment), {
|
||
|
children: diskUsage ? /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
|
||
|
className: "button ghost small-text normal-weight p-0",
|
||
|
style: {
|
||
|
height: "30px",
|
||
|
padding: 0
|
||
|
},
|
||
|
onClick: (e)=>{
|
||
|
setLoading(true);
|
||
|
(0,_functions_frontend_updateDiskUsage__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z)().then(()=>{
|
||
|
setRefresh((prev)=>prev + 1);
|
||
|
setLoading(false);
|
||
|
});
|
||
|
},
|
||
|
children: [
|
||
|
loading && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_LoadingBlock__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, {
|
||
|
width: "15px"
|
||
|
}),
|
||
|
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(lucide_react__WEBPACK_IMPORTED_MODULE_6__.HardDrive, {
|
||
|
size: 20,
|
||
|
className: "text-slate-400 mr-[3px]"
|
||
|
}),
|
||
|
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
|
||
|
className: "font-bold text-slate-700 dark:text-white",
|
||
|
children: diskUsage && diskUsage.toFixed(2)
|
||
|
}),
|
||
|
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
|
||
|
className: "text-slate-500",
|
||
|
children: "mb"
|
||
|
}),
|
||
|
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(lucide_react__WEBPACK_IMPORTED_MODULE_6__.RotateCw, {
|
||
|
size: 17,
|
||
|
className: "text-slate-400",
|
||
|
strokeWidth: 2
|
||
|
})
|
||
|
]
|
||
|
}) : /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("span", {
|
||
|
className: "text-sm info gray font-normal w-auto",
|
||
|
children: [
|
||
|
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((_mui_icons_material_CloudOffTwoTone__WEBPACK_IMPORTED_MODULE_5___default()), {
|
||
|
color: "inherit",
|
||
|
className: "opacity-50 text-slate-500",
|
||
|
fontSize: "small"
|
||
|
}),
|
||
|
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
|
||
|
children: "No Disk Usage Data Available Yet"
|
||
|
})
|
||
|
]
|
||
|
})
|
||
|
});
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
|
||
|
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ 1069:
|
||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
|
||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||
|
/* harmony export */ "Z": () => (/* binding */ updateDiskUsage)
|
||
|
/* harmony export */ });
|
||
|
/* harmony import */ var _fetchApi__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6729);
|
||
|
// @ts-check
|
||
|
/**
|
||
|
* ==============================================================================
|
||
|
* Imports
|
||
|
* ==============================================================================
|
||
|
*/
|
||
|
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||
|
* ==============================================================================
|
||
|
* Auth user on client side
|
||
|
* ==============================================================================
|
||
|
*
|
||
|
* @requires search-field name attribute
|
||
|
*/ async function updateDiskUsage() {
|
||
|
/**
|
||
|
* Check for user in local storage
|
||
|
*
|
||
|
* @description Preventdefault, declare variables
|
||
|
*/ const res = await (0,_fetchApi__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)("/api/getDiskUsage");
|
||
|
localStorage.setItem("disk_usage", res.total);
|
||
|
} ////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
|
||
|
|
||
|
/***/ }),
|
||
|
|
||
|
/***/ 4858:
|
||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
|
||
|
|
||
|
// EXPORTS
|
||
|
__webpack_require__.d(__webpack_exports__, {
|
||
|
"Z": () => (/* binding */ AdminLayout)
|
||
|
});
|
||
|
|
||
|
// 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: external "next/head"
|
||
|
var head_ = __webpack_require__(968);
|
||
|
var head_default = /*#__PURE__*/__webpack_require__.n(head_);
|
||
|
// EXTERNAL MODULE: ./layouts/components/GeneralLayout/Footer.jsx
|
||
|
var Footer = __webpack_require__(5281);
|
||
|
// EXTERNAL MODULE: external "@mui/icons-material/DynamicFormTwoTone"
|
||
|
var DynamicFormTwoTone_ = __webpack_require__(8979);
|
||
|
// EXTERNAL MODULE: external "@mui/icons-material/CollectionsTwoTone"
|
||
|
var CollectionsTwoTone_ = __webpack_require__(7306);
|
||
|
// EXTERNAL MODULE: external "@mui/icons-material/PeopleOutlineTwoTone"
|
||
|
var PeopleOutlineTwoTone_ = __webpack_require__(9806);
|
||
|
// EXTERNAL MODULE: external "@mui/icons-material/SchemaTwoTone"
|
||
|
var SchemaTwoTone_ = __webpack_require__(1799);
|
||
|
// EXTERNAL MODULE: external "@mui/icons-material/LockTwoTone"
|
||
|
var LockTwoTone_ = __webpack_require__(2814);
|
||
|
// EXTERNAL MODULE: ./components/general/Logo.jsx
|
||
|
var Logo = __webpack_require__(4017);
|
||
|
// EXTERNAL MODULE: external "@mui/icons-material/AdminPanelSettingsTwoTone"
|
||
|
var AdminPanelSettingsTwoTone_ = __webpack_require__(4003);
|
||
|
var AdminPanelSettingsTwoTone_default = /*#__PURE__*/__webpack_require__.n(AdminPanelSettingsTwoTone_);
|
||
|
// EXTERNAL MODULE: external "@mui/icons-material/LanguageOutlined"
|
||
|
var LanguageOutlined_ = __webpack_require__(300);
|
||
|
// EXTERNAL MODULE: external "lucide-react"
|
||
|
var external_lucide_react_ = __webpack_require__(2423);
|
||
|
;// CONCATENATED MODULE: ./layouts/components/AdminLayout/Aside.jsx
|
||
|
// @ts-check
|
||
|
/**
|
||
|
* ==============================================================================
|
||
|
* Imports
|
||
|
* ==============================================================================
|
||
|
*/
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||
|
* ==============================================================================
|
||
|
* Main Component { Functional }
|
||
|
* ==============================================================================
|
||
|
* @param {object} props - React component props
|
||
|
* @param {import("@/package-shared/types").UserType} props.user
|
||
|
*/ function Aside({ user }) {
|
||
|
/**
|
||
|
* Get Contexts
|
||
|
*
|
||
|
* @abstract { React.useContext }
|
||
|
*/ ////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
/**
|
||
|
* Javascript Variables
|
||
|
*
|
||
|
* @abstract Non hook variables and functions
|
||
|
*/ ////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
/**
|
||
|
* React Hooks
|
||
|
*
|
||
|
* @abstract { useState, useEffect, useRef, etc ... }
|
||
|
*/ const [collapseAsideMobile, setCollapseAsideMobile] = external_react_default().useState(true);
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
/**
|
||
|
* Function Return
|
||
|
*
|
||
|
* @abstract Main Function Return
|
||
|
*/ return /*#__PURE__*/ (0,jsx_runtime_.jsxs)("aside", {
|
||
|
className: "aside" + (collapseAsideMobile ? " mobile-collapsed" : " mobile-expanded"),
|
||
|
children: [
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx(Logo/* default */.Z, {
|
||
|
adminAside: true,
|
||
|
collapseAsideMobile: collapseAsideMobile,
|
||
|
setCollapseAsideMobile: setCollapseAsideMobile
|
||
|
}),
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("hr", {
|
||
|
className: "opacity-0 mt-4"
|
||
|
}),
|
||
|
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
|
||
|
className: "main-links" + (collapseAsideMobile ? " hidden lg:flex" : " "),
|
||
|
children: [
|
||
|
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
|
||
|
href: "/admin",
|
||
|
"data-currentlink": "/admin",
|
||
|
"data-strictlink": "true",
|
||
|
children: [
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx(external_lucide_react_.CircleGauge, {
|
||
|
size: 20
|
||
|
}),
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("span", {
|
||
|
children: "Dashboard"
|
||
|
})
|
||
|
]
|
||
|
}),
|
||
|
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
|
||
|
href: `/admin/${user?.id}/databases`,
|
||
|
"data-currentlink": `/admin/${user?.id}/databases`,
|
||
|
children: [
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx(external_lucide_react_.Database, {
|
||
|
size: 20
|
||
|
}),
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("span", {
|
||
|
children: "Databases"
|
||
|
})
|
||
|
]
|
||
|
}),
|
||
|
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
|
||
|
href: `/admin/${user?.id}/media`,
|
||
|
"data-currentlink": `/admin/${user?.id}/media`,
|
||
|
children: [
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx(external_lucide_react_.Images, {
|
||
|
size: 20
|
||
|
}),
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("span", {
|
||
|
children: "Media"
|
||
|
})
|
||
|
]
|
||
|
}),
|
||
|
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
|
||
|
href: `/admin/${user?.id}/users`,
|
||
|
"data-currentlink": `/admin/${user?.id}/users`,
|
||
|
children: [
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx(external_lucide_react_.Users, {
|
||
|
size: 20
|
||
|
}),
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("span", {
|
||
|
children: "Users"
|
||
|
})
|
||
|
]
|
||
|
}),
|
||
|
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
|
||
|
href: `/admin/${user?.id}/schema`,
|
||
|
"data-currentlink": `/admin/${user?.id}/schema`,
|
||
|
children: [
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx(external_lucide_react_.BookText, {
|
||
|
size: 20
|
||
|
}),
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("span", {
|
||
|
children: "Schema"
|
||
|
})
|
||
|
]
|
||
|
}),
|
||
|
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
|
||
|
href: `/admin/${user?.id}/api-keys`,
|
||
|
"data-currentlink": `/admin/${user?.id}/api-keys`,
|
||
|
children: [
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx(external_lucide_react_.FileKey2, {
|
||
|
size: 20
|
||
|
}),
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("span", {
|
||
|
children: "API Keys"
|
||
|
})
|
||
|
]
|
||
|
}),
|
||
|
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
|
||
|
href: `/admin/${user?.id}/connect`,
|
||
|
"data-currentlink": `/admin/${user?.id}/connect`,
|
||
|
children: [
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx(external_lucide_react_.Globe, {
|
||
|
size: 20
|
||
|
}),
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("span", {
|
||
|
children: "Connect"
|
||
|
})
|
||
|
]
|
||
|
}),
|
||
|
true && user.id == 1 && /*#__PURE__*/ jsx_runtime_.jsx((external_react_default()).Fragment, {
|
||
|
children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
|
||
|
href: `/su`,
|
||
|
"data-currentlink": `/su`,
|
||
|
children: [
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx((AdminPanelSettingsTwoTone_default()), {
|
||
|
className: "text-slate-400"
|
||
|
}),
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("span", {
|
||
|
children: "Super Admin User"
|
||
|
})
|
||
|
]
|
||
|
})
|
||
|
}),
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("hr", {
|
||
|
className: "opacity-80"
|
||
|
}),
|
||
|
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
|
||
|
className: "flex-col gap-0 items-start w-full",
|
||
|
children: [
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("a", {
|
||
|
href: `/admin/${user?.id}/settings`,
|
||
|
"data-currentlink": `/admin/${user?.id}/settings`,
|
||
|
children: /*#__PURE__*/ jsx_runtime_.jsx("span", {
|
||
|
children: "Settings"
|
||
|
})
|
||
|
}),
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("a", {
|
||
|
href: "/docs",
|
||
|
"data-currentlink": "/docs",
|
||
|
target: "_blank",
|
||
|
children: /*#__PURE__*/ jsx_runtime_.jsx("span", {
|
||
|
children: "Documentation"
|
||
|
})
|
||
|
}),
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("a", {
|
||
|
href: "/logout",
|
||
|
"data-currentlink": "/logout",
|
||
|
children: /*#__PURE__*/ jsx_runtime_.jsx("span", {
|
||
|
children: "Logout"
|
||
|
})
|
||
|
})
|
||
|
]
|
||
|
})
|
||
|
]
|
||
|
})
|
||
|
]
|
||
|
});
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
}
|
||
|
|
||
|
// EXTERNAL MODULE: ./layouts/components/GeneralLayout/Header.jsx
|
||
|
var Header = __webpack_require__(7108);
|
||
|
// EXTERNAL MODULE: ./layouts/components/AdminLayout/AdminUserBlock.jsx + 1 modules
|
||
|
var AdminUserBlock = __webpack_require__(5484);
|
||
|
;// CONCATENATED MODULE: ./layouts/components/AdminLayout/AdminHeader.jsx
|
||
|
// @ts-check
|
||
|
/**
|
||
|
* ==============================================================================
|
||
|
* Imports
|
||
|
* ==============================================================================
|
||
|
*/
|
||
|
|
||
|
|
||
|
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||
|
* ==============================================================================
|
||
|
* Main Component { Functional }
|
||
|
* ==============================================================================
|
||
|
* @param {object} props - React component props
|
||
|
* @param {import("@/package-shared/types").UserType} props.user - Authenticated User
|
||
|
* @param {import("react").ReactNode} [props.extraHeaderContent] - Extra JSX content to be inserted in the header
|
||
|
*/ function AdminHeader({ user , extraHeaderContent }) {
|
||
|
/**
|
||
|
* Get Contexts
|
||
|
*
|
||
|
* @abstract { React.useContext }
|
||
|
*/ ////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
/**
|
||
|
* Javascript Variables
|
||
|
*
|
||
|
* @abstract Non hook variables and functions
|
||
|
*/ ////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
/**
|
||
|
* React Hooks
|
||
|
*
|
||
|
* @abstract { useState, useEffect, useRef, etc ... }
|
||
|
*/ const [activeUser, setActiveUser] = external_react_default().useState(user ? user : null);
|
||
|
external_react_default().useEffect(()=>{
|
||
|
if (user?.logged_in_status) {
|
||
|
setActiveUser(user ? user : null);
|
||
|
}
|
||
|
}, [
|
||
|
user
|
||
|
]);
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
/**
|
||
|
* Function Return
|
||
|
*
|
||
|
* @abstract Main Function Return
|
||
|
*/ return /*#__PURE__*/ jsx_runtime_.jsx("section", {
|
||
|
className: "overflow-visible w-full px-0 md:px-8 py-0 flex justify-center bg-white dark:bg-slate-800 shadow-lg gap-4 dark:shadow-black/10 z-50 shadow-slate-900/5",
|
||
|
style: {
|
||
|
zIndex: 700,
|
||
|
border: "none"
|
||
|
},
|
||
|
children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
|
||
|
className: "w-full items-center justify-between gap-4 md:gap-8",
|
||
|
children: [
|
||
|
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
|
||
|
className: "hidden xl:flex flex-col items-stretch grow fixed xl:static top-0 right-0 px-4 xl:px-0 shadow-xl xl:shadow-none h-screen xl:h-auto overflow-auto xl:overflow-visible w-screen sl:w-auto bg-white xl:bg-transparent pb-10 xl:pb-0",
|
||
|
id: "main-nav-content-wrapper",
|
||
|
children: [
|
||
|
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
|
||
|
className: "items-center mb-2 flex xl:hidden",
|
||
|
children: [
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("a", {
|
||
|
href: "/",
|
||
|
className: "hidden xl:flex",
|
||
|
children: /*#__PURE__*/ jsx_runtime_.jsx("img", {
|
||
|
src: "/images/logo-icon-alt-2.png",
|
||
|
alt: "Logo Icon",
|
||
|
width: 37
|
||
|
})
|
||
|
}),
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("button", {
|
||
|
className: "outlined gray ml-auto",
|
||
|
onClick: (e)=>{
|
||
|
const mainNavWrapper = document.getElementById("main-nav-content-wrapper");
|
||
|
mainNavWrapper?.classList.toggle("hidden");
|
||
|
},
|
||
|
style: {
|
||
|
border: "none"
|
||
|
},
|
||
|
children: /*#__PURE__*/ jsx_runtime_.jsx("span", {
|
||
|
className: "font-semibold text-4xl",
|
||
|
children: "✕"
|
||
|
})
|
||
|
})
|
||
|
]
|
||
|
}),
|
||
|
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
|
||
|
className: "flex items-center w-full gap-6 grow flex-col xl:flex-row justify-start xl:justify-between",
|
||
|
children: [
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("div", {
|
||
|
className: "gap-6",
|
||
|
children: extraHeaderContent
|
||
|
}),
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx(AdminUserBlock/* default */.Z, {
|
||
|
activeUser: activeUser
|
||
|
})
|
||
|
]
|
||
|
})
|
||
|
]
|
||
|
}),
|
||
|
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("button", {
|
||
|
className: "bg-transparent w-16 p-4 gap-1.5 flex xl:hidden flex-col hover:bg-transparent transition-all ml-auto",
|
||
|
onClick: (e)=>{
|
||
|
const mainNavWrapper = document.getElementById("main-nav-content-wrapper");
|
||
|
mainNavWrapper?.classList.toggle("hidden");
|
||
|
},
|
||
|
style: {
|
||
|
minWidth: "50px",
|
||
|
backgroundColor: "transparent"
|
||
|
},
|
||
|
id: "main-header-hamburger-button",
|
||
|
"aria-label": "Mobile Hambutget Button",
|
||
|
children: [
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("div", {
|
||
|
className: "w-full h-1 bg-slate-600 dark:bg-slate-400 rounded-full"
|
||
|
}),
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("div", {
|
||
|
className: "w-full h-1 bg-slate-600 dark:bg-slate-400 rounded-full"
|
||
|
}),
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("div", {
|
||
|
className: "w-full h-1 bg-slate-600 dark:bg-slate-400 rounded-full"
|
||
|
})
|
||
|
]
|
||
|
})
|
||
|
]
|
||
|
})
|
||
|
});
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
}
|
||
|
|
||
|
// EXTERNAL MODULE: ./functions/frontend/updateNavLinks.js
|
||
|
var updateNavLinks = __webpack_require__(9678);
|
||
|
// EXTERNAL MODULE: ./components/general/DiskUsageComponent.jsx
|
||
|
var DiskUsageComponent = __webpack_require__(6355);
|
||
|
// EXTERNAL MODULE: ./functions/frontend/fetchApi.js
|
||
|
var fetchApi = __webpack_require__(6729);
|
||
|
;// CONCATENATED MODULE: ./layouts/AdminLayout.jsx
|
||
|
// @ts-check
|
||
|
/**
|
||
|
* ==============================================================================
|
||
|
* Imports
|
||
|
* ==============================================================================
|
||
|
*/
|
||
|
|
||
|
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
// import updateNavLinks from '../functions/frontend/updateNavLinks';
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||
|
* ==============================================================================
|
||
|
* Main Component { Functional }
|
||
|
* ==============================================================================
|
||
|
* @param {{
|
||
|
* children: import("react").ReactNode,
|
||
|
* head?: import("react").ReactNode,
|
||
|
* user: import("@/package-shared/types").UserType,
|
||
|
* productionEnvironment?: string,
|
||
|
* extraHeaderContent?: import("react").ReactNode,
|
||
|
* aceEditor?: boolean,
|
||
|
* }} props - children component
|
||
|
*/ function AdminLayout({ children , head , user , productionEnvironment , extraHeaderContent , aceEditor , }) {
|
||
|
/**
|
||
|
* Get Contexts
|
||
|
*
|
||
|
* @abstract { React.useContext }
|
||
|
*/ ////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
/**
|
||
|
* Javascript Variables
|
||
|
*
|
||
|
* @abstract Non hook variables and functions
|
||
|
*/ if (!extraHeaderContent) extraHeaderContent = /*#__PURE__*/ jsx_runtime_.jsx(DiskUsageComponent/* default */.Z, {});
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
/**
|
||
|
* React Hooks
|
||
|
*
|
||
|
* @abstract { useState, useEffect, useRef, etc ... }
|
||
|
*/ external_react_default().useEffect(()=>{
|
||
|
/** @type {NodeListOf<HTMLAnchorElement>} */ const links = document.querySelectorAll("aside .main-links a");
|
||
|
(0,updateNavLinks/* default */.Z)({
|
||
|
links: links
|
||
|
});
|
||
|
if (document.cookie.match(/user_refresh=1/)) {
|
||
|
(0,fetchApi/* default */.Z)("/api/reAuthenticateUser", {
|
||
|
method: "post",
|
||
|
body: {}
|
||
|
}, true).then((/** @type {import("@/pages/api/reAuthenticateUser").reAuthenticateUserResponse} */ res)=>{
|
||
|
if (res.status && res.user) {
|
||
|
document.cookie = "user_refresh=0;max-age=0";
|
||
|
localStorage.setItem("csrf", res.user.csrf_k);
|
||
|
localStorage.setItem("user", JSON.stringify(res.user));
|
||
|
window.location.reload();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}, []);
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
/**
|
||
|
* Function Return
|
||
|
*
|
||
|
* @abstract Main Function Return
|
||
|
*/ return /*#__PURE__*/ (0,jsx_runtime_.jsxs)((external_react_default()).Fragment, {
|
||
|
children: [
|
||
|
/*#__PURE__*/ (0,jsx_runtime_.jsxs)((head_default()), {
|
||
|
children: [
|
||
|
head,
|
||
|
/*#__PURE__*/ (0,jsx_runtime_.jsxs)((external_react_default()).Fragment, {
|
||
|
children: [
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("script", {
|
||
|
src: "https://cdnjs.cloudflare.com/ajax/libs/ace/1.22.0/ace.min.js",
|
||
|
integrity: "sha512-q6CTB0jS+VuJnSct82rVcWlI06LGzNjaG3CWenHWVUncRvc4UQMFkA3a5Ip880xr+lBx38FcHDclOxPdSg+sBw==",
|
||
|
crossOrigin: "anonymous",
|
||
|
referrerPolicy: "no-referrer"
|
||
|
}),
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("script", {
|
||
|
src: "https://cdnjs.cloudflare.com/ajax/libs/ace/1.22.0/ext-language_tools.min.js",
|
||
|
integrity: "sha512-6g6cvocV7eT/J8L44lL8gJKqq9onqQeYGgJO0DmrsYFcCfRl6wYkYA/KHS768r4QVTB4JxsCcMQ9gIezxpTCZw==",
|
||
|
crossOrigin: "anonymous",
|
||
|
referrerPolicy: "no-referrer"
|
||
|
})
|
||
|
]
|
||
|
})
|
||
|
]
|
||
|
}),
|
||
|
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
|
||
|
className: "admin w-full flex items-start gap-0",
|
||
|
children: [
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx(Aside, {
|
||
|
user: user
|
||
|
}),
|
||
|
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("main", {
|
||
|
className: "relative",
|
||
|
children: [
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx(AdminHeader, {
|
||
|
user: user,
|
||
|
extraHeaderContent: extraHeaderContent
|
||
|
}),
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("div", {
|
||
|
className: "admin-content",
|
||
|
children: children
|
||
|
}),
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("footer", {
|
||
|
className: "flex justify-center w-full items-center p-4",
|
||
|
children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
|
||
|
className: "max-w-6xl w-full justify-center flex-wrap",
|
||
|
children: [
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("div", {
|
||
|
className: "flex items-center gap-2 scale-75",
|
||
|
children: /*#__PURE__*/ jsx_runtime_.jsx(Logo/* default */.Z, {})
|
||
|
}),
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("span", {
|
||
|
className: "opacity-25",
|
||
|
children: "|"
|
||
|
}),
|
||
|
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("span", {
|
||
|
className: "text-sm text-slate-400 dark:text-slate-600 text-center",
|
||
|
children: [
|
||
|
new Date().getFullYear(),
|
||
|
" \xa9 Datasquirel. All rights reserved."
|
||
|
]
|
||
|
}),
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("span", {
|
||
|
className: "opacity-25",
|
||
|
children: "|"
|
||
|
}),
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("a", {
|
||
|
href: "/docs",
|
||
|
children: "Docs"
|
||
|
}),
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("span", {
|
||
|
className: "opacity-25",
|
||
|
children: "|"
|
||
|
}),
|
||
|
/*#__PURE__*/ jsx_runtime_.jsx("a", {
|
||
|
href: "/terms",
|
||
|
children: "Terms"
|
||
|
})
|
||
|
]
|
||
|
})
|
||
|
})
|
||
|
]
|
||
|
})
|
||
|
]
|
||
|
})
|
||
|
]
|
||
|
});
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
}
|
||
|
|
||
|
|
||
|
/***/ })
|
||
|
|
||
|
};
|
||
|
;
|