From 3766c3d938997dea85ebf8a882afb47ee615fc30 Mon Sep 17 00:00:00 2001 From: Dave Richer Date: Thu, 27 Feb 2025 13:30:18 -0500 Subject: [PATCH] feature/IO-3096-GlobalNotifications - Adjust the Global Placement for notificationContext.jsx, removed adjustments to said location and duration to socket --- client/src/components/eula/eula.component.jsx | 4 +--- .../components/update-alert/update-alert.component.jsx | 5 ++--- client/src/contexts/Notifications/notificationContext.jsx | 8 +++++--- client/src/contexts/SocketIO/socketContext.jsx | 7 +------ client/src/pages/manage/manage.page.component.jsx | 1 - 5 files changed, 9 insertions(+), 16 deletions(-) diff --git a/client/src/components/eula/eula.component.jsx b/client/src/components/eula/eula.component.jsx index 389911961..ae503b09a 100644 --- a/client/src/components/eula/eula.component.jsx +++ b/client/src/components/eula/eula.component.jsx @@ -78,9 +78,7 @@ const Eula = ({ currentEula, currentUser, acceptEula }) => { } catch (err) { notification.error({ message: t("eula.errors.acceptance.message"), - description: t("eula.errors.acceptance.description"), - placement: "bottomRight", - duration: 5000 + description: t("eula.errors.acceptance.description") }); console.log(`${t("eula.errors.acceptance.message")}`); console.dir({ diff --git a/client/src/components/update-alert/update-alert.component.jsx b/client/src/components/update-alert/update-alert.component.jsx index 22b290a5c..e3273ded6 100644 --- a/client/src/components/update-alert/update-alert.component.jsx +++ b/client/src/components/update-alert/update-alert.component.jsx @@ -1,7 +1,7 @@ import { AlertOutlined } from "@ant-design/icons"; import { Alert, Button, Col, Row, Space } from "antd"; import i18n from "i18next"; -import React, { useCallback, useEffect, useState } from "react"; +import { useCallback, useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -81,8 +81,7 @@ export function UpdateAlert({ updateAvailable }) { imex: "$t(titles.imexonline)", rome: "$t(titles.romeonline)" }) - }), - placement: "bottomRight" + }) }); } if (needRefresh && timerStarted && timeLeft <= 0) { diff --git a/client/src/contexts/Notifications/notificationContext.jsx b/client/src/contexts/Notifications/notificationContext.jsx index 59bcdf4fe..52fd4eeeb 100644 --- a/client/src/contexts/Notifications/notificationContext.jsx +++ b/client/src/contexts/Notifications/notificationContext.jsx @@ -1,5 +1,4 @@ -// NotificationProvider.jsx -import React, { createContext, useContext } from "react"; +import { createContext, useContext } from "react"; import { notification } from "antd"; /** @@ -22,7 +21,10 @@ export const useNotification = () => { * - Provide `api` via the NotificationContext. */ export const NotificationProvider = ({ children }) => { - const [api, contextHolder] = notification.useNotification(); + const [api, contextHolder] = notification.useNotification({ + placement: "bottomRight", + showProgress: true + }); return ( diff --git a/client/src/contexts/SocketIO/socketContext.jsx b/client/src/contexts/SocketIO/socketContext.jsx index 572c67bf7..ff2f60561 100644 --- a/client/src/contexts/SocketIO/socketContext.jsx +++ b/client/src/contexts/SocketIO/socketContext.jsx @@ -18,9 +18,6 @@ const SocketContext = createContext(null); // This is how many notifications the database will populate on load, and the increment for load more export const INITIAL_NOTIFICATIONS = 10; -export const SCENARIO_NOTIFICATION_LOCATION = "bottomRight"; -export const SCENARIO_NOTIFICATION_DURATION = 15; // Seconds - export const SocketProvider = ({ children, bodyshop, navigate }) => { const socketRef = useRef(null); const [clientId, setClientId] = useState(null); @@ -298,9 +295,7 @@ export const SocketProvider = ({ children, bodyshop, navigate }) => { ))} - ), - placement: SCENARIO_NOTIFICATION_LOCATION, - duration: SCENARIO_NOTIFICATION_DURATION + ) }); } catch (error) { console.error(`Something went wrong handling a new notification: ${error?.message || ""}`); diff --git a/client/src/pages/manage/manage.page.component.jsx b/client/src/pages/manage/manage.page.component.jsx index 5edc33584..2d7e0b471 100644 --- a/client/src/pages/manage/manage.page.component.jsx +++ b/client/src/pages/manage/manage.page.component.jsx @@ -167,7 +167,6 @@ export function Manage({ conflict, bodyshop, alerts, setAlerts }) { description: alert.description, type: alert.type || "info", duration: 0, - placement: "bottomRight", closable: true, onClose: () => { // When the notification is closed, update displayed alerts state and localStorage