From 55b5c1e71334397a91ed70c59fed1da0cfcfd1b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Thu, 10 Oct 2024 01:16:50 +0200 Subject: [PATCH 01/11] types react apparently needed? --- package-lock.json | 23 +++++++++++++++++++++++ package.json | 3 ++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index d9d24565a..c5b9488c5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -51,6 +51,7 @@ }, "devDependencies": { "@stylistic/stylelint-plugin": "^3.1.1", + "@types/react": "^18.3.11", "eslint": "^9.12.0", "eslint-plugin-jest": "^28.8.3", "eslint-plugin-react": "^7.37.1", @@ -3125,6 +3126,22 @@ "undici-types": "~6.13.0" } }, + "node_modules/@types/prop-types": { + "version": "15.7.13", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.13.tgz", + "integrity": "sha512-hCZTSvwbzWGvhqxp/RqVqwU999pBf2vp7hzIjiYOsl8wqOmUxkQ6ddw1cV3l8811+kdUFus/q4d1Y3E3SyEifA==", + "dev": true + }, + "node_modules/@types/react": { + "version": "18.3.11", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.11.tgz", + "integrity": "sha512-r6QZ069rFTjrEYgFdOck1gK7FLVsgJE7tTz0pQBczlBNUhBNk0MQH4UbnFSwjpQLMkLzgqvBBa+qGpLje16eTQ==", + "dev": true, + "dependencies": { + "@types/prop-types": "*", + "csstype": "^3.0.2" + } + }, "node_modules/@types/stack-utils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", @@ -5138,6 +5155,12 @@ "node": ">=4" } }, + "node_modules/csstype": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", + "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", + "dev": true + }, "node_modules/dash-ast": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/dash-ast/-/dash-ast-1.0.0.tgz", diff --git a/package.json b/package.json index bc0b9fea2..39d0d47ce 100644 --- a/package.json +++ b/package.json @@ -127,6 +127,7 @@ }, "devDependencies": { "@stylistic/stylelint-plugin": "^3.1.1", + "@types/react": "^18.3.11", "eslint": "^9.12.0", "eslint-plugin-jest": "^28.8.3", "eslint-plugin-react": "^7.37.1", @@ -139,4 +140,4 @@ "stylelint-config-recommended": "^14.0.1", "supertest": "^7.0.0" } -} \ No newline at end of file +} From 656c9399ef4228d3a04105f3b0c48c76439e0aec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Thu, 10 Oct 2024 02:06:00 +0200 Subject: [PATCH 02/11] initial commit --- .../notificationAdd/notificationAdd.jsx | 2 +- .../notificationLookup/notificationLookup.jsx | 6 +- client/components/dialog.jsx | 29 ++++--- .../notificationPopup/notificationPopup.jsx | 77 ++++++++++++------- .../notificationPopup/notificationPopup.less | 5 +- server/admin.api.js | 2 + 6 files changed, 78 insertions(+), 43 deletions(-) diff --git a/client/admin/notificationUtils/notificationAdd/notificationAdd.jsx b/client/admin/notificationUtils/notificationAdd/notificationAdd.jsx index 5a8ebf5d0..0cca1047e 100644 --- a/client/admin/notificationUtils/notificationAdd/notificationAdd.jsx +++ b/client/admin/notificationUtils/notificationAdd/notificationAdd.jsx @@ -66,7 +66,7 @@ const NotificationAdd = ()=>{ diff --git a/client/admin/notificationUtils/notificationLookup/notificationLookup.jsx b/client/admin/notificationUtils/notificationLookup/notificationLookup.jsx index 71f8da59c..05f81b776 100644 --- a/client/admin/notificationUtils/notificationLookup/notificationLookup.jsx +++ b/client/admin/notificationUtils/notificationLookup/notificationLookup.jsx @@ -14,9 +14,6 @@ const NotificationDetail = ({ notification, onDelete })=>(
Title
{notification.title || 'No Title'}
-
Text
-
{notification.text || 'No Text'}
-
Created
{Moment(notification.createdAt).format('LLLL')}
@@ -25,6 +22,9 @@ const NotificationDetail = ({ notification, onDelete })=>(
Stop
{Moment(notification.stopAt).format('LLLL') || 'No End Time'}
+ +
Text
+
{notification.text || 'No Text'}
diff --git a/client/components/dialog.jsx b/client/components/dialog.jsx index 2057ecb87..bf3dabaed 100644 --- a/client/components/dialog.jsx +++ b/client/components/dialog.jsx @@ -1,22 +1,29 @@ // Dialog box, for popups and modal blocking messages -const React = require('react'); -const { useRef, useEffect } = React; +import React from "react"; // Correct the import statement +const { useRef, useEffect } = React; // Use React instead of react -function Dialog({ dismissKey, closeText = 'Close', blocking = false, ...rest }) { +function Dialog({ dismissKeys, closeText = 'Close', blocking = false, ...rest }) { const dialogRef = useRef(null); useEffect(()=>{ - if(!dismissKey || !localStorage.getItem(dismissKey)) { - blocking ? dialogRef.current?.showModal() : dialogRef.current?.show(); - } - }, []); + blocking ? dialogRef.current?.showModal() : dialogRef.current?.show(); + }, [dialogRef.current]); - const dismiss = ()=>{ - dismissKey && localStorage.setItem(dismissKey, true); + console.log(dismissKeys); + if (dismissKeys.length === 0) { + return null; + } + + const dismiss = () => { + dismissKeys.forEach(key => { + if (key) { + localStorage.setItem(key, 'true'); + } + }); dialogRef.current?.close(); }; - - return ( + console.log('rendering'); + return ( {rest.children}