Files
cosmos-explorer/src/Utils/NotificationConsoleUtils.ts
asier-isayas 0fc6647627 Upgrade Cosmos SDK to v4.3 (#2137)
* Upgrade Cosmos SDK to v4.3

* push pkg lock

* fix tests

* fix package-lock.json

* fix package-lock

* fix package-lock.json

* fix package-lock.json

* log console warning when RU limit is reached

* fix tests

* fix format

* fix tests

* added description to RU limit message

* show warning icon on tab header

---------

Co-authored-by: Asier Isayas <aisayas@microsoft.com>
2025-05-29 11:35:06 -04:00

30 lines
1003 B
TypeScript

import * as _ from "underscore";
import { ConsoleDataType } from "../Explorer/Menus/NotificationConsole/ConsoleData";
import { useNotificationConsole } from "../hooks/useNotificationConsole";
function log(type: ConsoleDataType, message: string): () => void {
const id = _.uniqueId();
const date = new Intl.DateTimeFormat("en-EN", {
hour12: true,
hour: "numeric",
minute: "numeric",
}).format(new Date());
useNotificationConsole.getState().setNotificationConsoleData({ type, date, message, id });
return () => useNotificationConsole.getState().setInProgressConsoleDataIdToBeDeleted(id);
}
export const logConsoleProgress = (msg: string): (() => void) => log(ConsoleDataType.InProgress, msg);
export const logConsoleError = (msg: string): void => {
log(ConsoleDataType.Error, msg);
};
export const logConsoleInfo = (msg: string): void => {
log(ConsoleDataType.Info, msg);
};
export const logConsoleWarning = (msg: string): void => {
log(ConsoleDataType.Warning, msg);
};