dsql-admin/dsql-app/.local_dist/server/chunks/8313.js

175 lines
8.7 KiB
JavaScript
Raw Normal View History

2024-11-05 11:12:42 +00:00
"use strict";
exports.id = 8313;
exports.ids = [8313];
exports.modules = {
/***/ 4981:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ ThemeSelector)
/* 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__);
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {object} props - React component props
*/ function ThemeSelector(props) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ const [theme, setTheme] = react__WEBPACK_IMPORTED_MODULE_1___default().useState("Light Mode");
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(()=>{
let existingTheme = localStorage.getItem("theme");
if (existingTheme?.match(/dark/)) {
setTheme("Dark Mode");
}
}, []);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
className: "",
id: "theme-selector-wrapper",
onClick: ()=>{
const graphicWrapper = document.getElementById("theme-selector-graphic-wrapper");
let existingTheme = localStorage.getItem("theme");
const sunIcon = graphicWrapper?.querySelector("img.sun");
const moonIcon = graphicWrapper?.querySelector("img.moon");
////////////////////////////////////////
if (!existingTheme || existingTheme?.match(/light/)) {
document.documentElement.className = "dark";
localStorage.setItem("theme", "dark");
existingTheme = "dark";
////////////////////////////////////////
sunIcon?.classList.add("hidden");
moonIcon?.classList.remove("hidden");
// @ts-ignore
graphicWrapper?.firstChild?.classList.add("ml-auto");
////////////////////////////////////////
setTheme("Dark Mode");
////////////////////////////////////////
} else if (existingTheme?.match(/dark/)) {
document.documentElement.className = "light";
localStorage.setItem("theme", "light");
existingTheme = "light";
////////////////////////////////////////
moonIcon?.classList.add("hidden");
sunIcon?.classList.remove("hidden");
// @ts-ignore
graphicWrapper?.firstChild?.classList.remove("ml-auto");
////////////////////////////////////////
setTheme("Light Mode");
////////////////////////////////////////
}
////////////////////////////////////////
},
children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
className: "p-1 rounded-full w-12 transition-all",
id: "theme-selector-graphic-wrapper",
children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "pointer-events-none transition-all dark:ml-auto",
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("img", {
src: "/images/sun.png",
alt: "Sun Icon",
width: 18,
className: "sun dark:hidden"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("img", {
src: "/images/new-moon.png",
alt: "Sun Icon",
width: 18,
className: "moon hidden dark:flex"
})
]
})
})
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
/***/ }),
/***/ 9678:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ updateNavLinks)
/* harmony export */ });
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
*
* @param {object} param0
* @param {HTMLAnchorElement[] | NodeListOf<HTMLAnchorElement>} [param0.links]
*/ async function updateNavLinks({ links }) {
/** @type {NodeListOf<HTMLAnchorElement> | HTMLAnchorElement[]} */ let navLinks = links ? links : document.querySelectorAll("nav a");
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
if (navLinks) {
navLinks.forEach((link)=>{
if (link.dataset.currentlink === window.location.pathname) {
link.classList.add("active");
} else if (window.location.pathname.match(new RegExp(`${link.dataset.currentlink}\\/.*`)) && !link.dataset.strictlink) {
link.classList.add("active");
}
});
}
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
const isDbPathValid = window.location.pathname.match(/\/databases\/.*/);
if (isDbPathValid) {
const links1 = document.querySelectorAll("a");
if (links1 && window.location.search.match(/delegated=true/)) {
links1.forEach((link, index)=>{
if (!link?.pathname?.match(/databases/)) return;
link.href = link.pathname + window.location.search;
});
}
}
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ })
};
;