From 04fc065706dc7bd2257f21254346179a073eadca Mon Sep 17 00:00:00 2001 From: Fisico Date: Sat, 28 Dec 2024 20:04:29 +0100 Subject: [PATCH] added red glassContainer and style Timezone warning --- src/Pages/LinkButton.jsx | 42 +++++++++++++------ .../GlassContainer/glassContainer.scss | 9 ++++ 2 files changed, 38 insertions(+), 13 deletions(-) diff --git a/src/Pages/LinkButton.jsx b/src/Pages/LinkButton.jsx index 5734ebb..6de51df 100644 --- a/src/Pages/LinkButton.jsx +++ b/src/Pages/LinkButton.jsx @@ -1,7 +1,7 @@ import axios from "axios"; import { toast } from "react-hot-toast"; - -import { IoIosWarning } from "react-icons/io"; +import { Link } from "react-router-dom"; +import { useEffect, useState } from "react"; import GlassContainer from "../components/GlassContainer/GlassContainer"; import PageContent from "../components/PageContent/PageContent"; @@ -11,6 +11,21 @@ import CardGrid from "../components/CardGrid/CardGrid"; export default function LinkButton({ HOST_IP, API_KEY }) { //console.log(API_KEY) + const [configTimezone, setConfigTimezone] = useState(""); + const clientTimezone = new Date().toString().match(/\(([^\)]+)\)$/)[1]; + + useEffect(() => { + axios + .get(`${HOST_IP}/api/${API_KEY}/config`) + .then((response) => { + const { timezone } = response.data; + setConfigTimezone(timezone); + }) + .catch((error) => { + console.error("Error fetching config: ", error); + }); + }, [HOST_IP, API_KEY]); + const pushLinkButton = () => { axios .get(`${HOST_IP}/api/${API_KEY}/config`) @@ -36,17 +51,18 @@ export default function LinkButton({ HOST_IP, API_KEY }) { return (
- - -
- - Caution - -
-

CheckTimeZone before pressing Link Button

-
-
- + + +
+ Caution! +
+

CheckTimeZone before pressing Link Button

+
+

Timezone in config: {configTimezone}

+

Your Timezone: {clientTimezone}

+ +
+
Link Button
diff --git a/src/components/GlassContainer/glassContainer.scss b/src/components/GlassContainer/glassContainer.scss index fbb5b7a..ebc2c88 100644 --- a/src/components/GlassContainer/glassContainer.scss +++ b/src/components/GlassContainer/glassContainer.scss @@ -15,6 +15,15 @@ width: fit-content; min-width: 380px; + &.red { + background: linear-gradient( + 45deg, + rgba(255, 0, 0, 0.04) 0%, + rgba(255, 0, 0, 0.15) 100% + ); + border: 1px solid rgba(255, 0, 0, 0.05); + } + &.spacer { margin-bottom: 40px; }