From 9309a15be48c489922727c9d40f94b8e7aa11fd8 Mon Sep 17 00:00:00 2001 From: kekefreedog <70959083+kekefreedog@users.noreply.github.com> Date: Wed, 20 Nov 2024 22:35:02 +0100 Subject: [PATCH] Fix error page --- package.json | 1 + resources/Environment/Page/Error/index.ts | 58 +++++++++++++--- resources/Environment/Page/Error/template.hbs | 3 +- src/Front/Library/Crazylanguage.ts | 25 +++++-- src/Front/Library/Utility/Form.ts | 68 +++++++++++++++++++ 5 files changed, 141 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 1041664..4b7632b 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ }, "dependencies": { "@material/material-color-utilities": "^0.3.0", + "@simonwep/pickr": "^1.9.1", "maska": "^3.0.2", "tom-select": "^2.3.1" } diff --git a/resources/Environment/Page/Error/index.ts b/resources/Environment/Page/Error/index.ts index d3d0cb8..5be6b7a 100644 --- a/resources/Environment/Page/Error/index.ts +++ b/resources/Environment/Page/Error/index.ts @@ -5,16 +5,16 @@ * * @package kzarshenas/crazyphp * @author kekefreedog - * @copyright 2022-2024 Kévin Zarshenas + * @copyright 2022-2023 Kévin Zarshenas */ /** * Dependances */ const css = require("!!css-loader!sass-loader!./style.scss"); -import {Carousel} from "@materializecss/materialize"; +import {Carousel, M} from "@materializecss/materialize"; +import {Crazypage, LoaderPage} from "crazyphp"; const html = require("./template.hbs"); -import {Crazypage} from "crazyphp"; require("./style.scss"); /** @@ -24,7 +24,7 @@ require("./style.scss"); * * @package kzarshenas/crazyphp * @author kekefreedog - * @copyright 2022-2024 Kévin Zarshenas + * @copyright 2022-2023 Kévin Zarshenas */ export default class Home extends Crazypage { @@ -71,7 +71,7 @@ export default class Home extends Crazypage { /** * On Ready * - * @return void + * @returns {void} */ public onReady = ():void => { @@ -80,14 +80,17 @@ export default class Home extends Crazypage { // Init carousel this.initCarousel(); + // Init Index Button + this.initIndexBtn(); + } /** * Init Carousel * - * @return void + * @returns {void} */ - private initCarousel = () => { + private initCarousel = ():void => { // Get error-carousel let errorCarouselEl = document.getElementById("crazy-root"); @@ -96,7 +99,7 @@ export default class Home extends Crazypage { if(errorCarouselEl !== null) // New carousel instance - this.carouselInstance = new Carousel( + this.carouselInstance = new M.Carousel( errorCarouselEl, { fullWidth: true, @@ -107,6 +110,45 @@ export default class Home extends Crazypage { } + /** + * Init Index Btn + * + * @returns {void} + */ + private initIndexBtn = ():void => { + + // Get btn el + let btnEl = document.getElementById("root-btn"); + + // Check el + if(btnEl !== null) + + // Add event on click + btnEl.addEventListener( + "click", + e => { + + e.preventDefault(); + + // Set option + let options:LoaderPageOptions = { + name: "Index", + }; + + // Check ctrl or cmd pressed + if(e.ctrlKey || e.metaKey) + + // Add openInNewTab in options + options["openInNewTab"] = true; + + // Load page (redirection) + new LoaderPage(options); + + } + ); + + } + } /** diff --git a/resources/Environment/Page/Error/template.hbs b/resources/Environment/Page/Error/template.hbs index cb754d1..b85436a 100644 --- a/resources/Environment/Page/Error/template.hbs +++ b/resources/Environment/Page/Error/template.hbs @@ -7,7 +7,7 @@ ! ! @package kzarshenas/crazyphp ! @author kekefreedog - ! @copyright 2022-2024 Kévin Zarshenas + ! @copyright 2022-2023 Kévin Zarshenas !--}} {{!-- Root --}} @@ -16,6 +16,7 @@ {{!-- Static btn --}}