feature/IO-3096-GlobalNotifications - Adjust the Global Placement for notificationContext.jsx, removed adjustments to said location and duration to socket
This commit is contained in:
@@ -78,9 +78,7 @@ const Eula = ({ currentEula, currentUser, acceptEula }) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
notification.error({
|
notification.error({
|
||||||
message: t("eula.errors.acceptance.message"),
|
message: t("eula.errors.acceptance.message"),
|
||||||
description: t("eula.errors.acceptance.description"),
|
description: t("eula.errors.acceptance.description")
|
||||||
placement: "bottomRight",
|
|
||||||
duration: 5000
|
|
||||||
});
|
});
|
||||||
console.log(`${t("eula.errors.acceptance.message")}`);
|
console.log(`${t("eula.errors.acceptance.message")}`);
|
||||||
console.dir({
|
console.dir({
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { AlertOutlined } from "@ant-design/icons";
|
import { AlertOutlined } from "@ant-design/icons";
|
||||||
import { Alert, Button, Col, Row, Space } from "antd";
|
import { Alert, Button, Col, Row, Space } from "antd";
|
||||||
import i18n from "i18next";
|
import i18n from "i18next";
|
||||||
import React, { useCallback, useEffect, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
@@ -81,8 +81,7 @@ export function UpdateAlert({ updateAvailable }) {
|
|||||||
imex: "$t(titles.imexonline)",
|
imex: "$t(titles.imexonline)",
|
||||||
rome: "$t(titles.romeonline)"
|
rome: "$t(titles.romeonline)"
|
||||||
})
|
})
|
||||||
}),
|
})
|
||||||
placement: "bottomRight"
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (needRefresh && timerStarted && timeLeft <= 0) {
|
if (needRefresh && timerStarted && timeLeft <= 0) {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// NotificationProvider.jsx
|
import { createContext, useContext } from "react";
|
||||||
import React, { createContext, useContext } from "react";
|
|
||||||
import { notification } from "antd";
|
import { notification } from "antd";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -22,7 +21,10 @@ export const useNotification = () => {
|
|||||||
* - Provide `api` via the NotificationContext.
|
* - Provide `api` via the NotificationContext.
|
||||||
*/
|
*/
|
||||||
export const NotificationProvider = ({ children }) => {
|
export const NotificationProvider = ({ children }) => {
|
||||||
const [api, contextHolder] = notification.useNotification();
|
const [api, contextHolder] = notification.useNotification({
|
||||||
|
placement: "bottomRight",
|
||||||
|
showProgress: true
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NotificationContext.Provider value={api}>
|
<NotificationContext.Provider value={api}>
|
||||||
|
|||||||
@@ -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
|
// This is how many notifications the database will populate on load, and the increment for load more
|
||||||
export const INITIAL_NOTIFICATIONS = 10;
|
export const INITIAL_NOTIFICATIONS = 10;
|
||||||
|
|
||||||
export const SCENARIO_NOTIFICATION_LOCATION = "bottomRight";
|
|
||||||
export const SCENARIO_NOTIFICATION_DURATION = 15; // Seconds
|
|
||||||
|
|
||||||
export const SocketProvider = ({ children, bodyshop, navigate }) => {
|
export const SocketProvider = ({ children, bodyshop, navigate }) => {
|
||||||
const socketRef = useRef(null);
|
const socketRef = useRef(null);
|
||||||
const [clientId, setClientId] = useState(null);
|
const [clientId, setClientId] = useState(null);
|
||||||
@@ -298,9 +295,7 @@ export const SocketProvider = ({ children, bodyshop, navigate }) => {
|
|||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
),
|
)
|
||||||
placement: SCENARIO_NOTIFICATION_LOCATION,
|
|
||||||
duration: SCENARIO_NOTIFICATION_DURATION
|
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Something went wrong handling a new notification: ${error?.message || ""}`);
|
console.error(`Something went wrong handling a new notification: ${error?.message || ""}`);
|
||||||
|
|||||||
@@ -167,7 +167,6 @@ export function Manage({ conflict, bodyshop, alerts, setAlerts }) {
|
|||||||
description: alert.description,
|
description: alert.description,
|
||||||
type: alert.type || "info",
|
type: alert.type || "info",
|
||||||
duration: 0,
|
duration: 0,
|
||||||
placement: "bottomRight",
|
|
||||||
closable: true,
|
closable: true,
|
||||||
onClose: () => {
|
onClose: () => {
|
||||||
// When the notification is closed, update displayed alerts state and localStorage
|
// When the notification is closed, update displayed alerts state and localStorage
|
||||||
|
|||||||
Reference in New Issue
Block a user