From 7cd6d57ccf39f8ef2f89c835487346685ead6da7 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Tue, 1 Nov 2022 11:52:01 +0100 Subject: [PATCH] use timestamp --- apps/remix-ide/src/app/plugins/notification.tsx | 4 ++-- libs/remix-ui/app/src/lib/remix-app/actions/modals.ts | 2 +- .../app/src/lib/remix-app/components/modals/dialogs.tsx | 2 +- libs/remix-ui/app/src/lib/remix-app/context/context.tsx | 4 ++-- libs/remix-ui/app/src/lib/remix-app/context/provider.tsx | 4 ++-- libs/remix-ui/app/src/lib/remix-app/interface/index.ts | 4 ++-- libs/remix-ui/app/src/lib/remix-app/state/modals.ts | 2 +- libs/remix-ui/toaster/src/lib/toaster.tsx | 4 ++-- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/apps/remix-ide/src/app/plugins/notification.tsx b/apps/remix-ide/src/app/plugins/notification.tsx index 2d5f0c95ba..83754e8b38 100644 --- a/apps/remix-ide/src/app/plugins/notification.tsx +++ b/apps/remix-ide/src/app/plugins/notification.tsx @@ -38,7 +38,7 @@ export class NotificationPlugin extends Plugin implements MethodApi { return ( <> - + ) } export default AppDialogs diff --git a/libs/remix-ui/app/src/lib/remix-app/context/context.tsx b/libs/remix-ui/app/src/lib/remix-app/context/context.tsx index be1cab9350..ca69771f80 100644 --- a/libs/remix-ui/app/src/lib/remix-app/context/context.tsx +++ b/libs/remix-ui/app/src/lib/remix-app/context/context.tsx @@ -6,7 +6,7 @@ export const AppContext = React.createContext(null) export interface dispatchModalInterface { modal: (data: AppModal) => void - toast: (message: string | JSX.Element, uid?:string | number) => void + toast: (message: string | JSX.Element) => void alert: (data: AlertModal) => void handleHideModal: () => void, handleToaster: () => void @@ -14,7 +14,7 @@ export interface dispatchModalInterface { export const dispatchModalContext = React.createContext({ modal: (data: AppModal) => { }, - toast: (message: string | JSX.Element, uid?:string | number) => {}, + toast: (message: string | JSX.Element) => {}, alert: (data: AlertModal) => {}, handleHideModal: () => {}, handleToaster: () => {} diff --git a/libs/remix-ui/app/src/lib/remix-app/context/provider.tsx b/libs/remix-ui/app/src/lib/remix-app/context/provider.tsx index b7c21c5389..635500a8b3 100644 --- a/libs/remix-ui/app/src/lib/remix-app/context/provider.tsx +++ b/libs/remix-ui/app/src/lib/remix-app/context/provider.tsx @@ -36,10 +36,10 @@ export const ModalProvider = ({ children = [], reducer = modalReducer, initialSt }) } - const toast = (message: string | JSX.Element, uid?: string | number) => { + const toast = (message: string | JSX.Element) => { dispatch({ type: modalActionTypes.setToast, - payload: { message, uid } + payload: { message, timestamp: Date.now() } }) } diff --git a/libs/remix-ui/app/src/lib/remix-app/interface/index.ts b/libs/remix-ui/app/src/lib/remix-app/interface/index.ts index 9c03109c11..69db40e679 100644 --- a/libs/remix-ui/app/src/lib/remix-app/interface/index.ts +++ b/libs/remix-ui/app/src/lib/remix-app/interface/index.ts @@ -33,7 +33,7 @@ export interface AlertModal { export interface ModalState { modals: AppModal[], - toasters: {message: (string | JSX.Element), uid: string | number }[], + toasters: {message: (string | JSX.Element), timestamp: number }[], focusModal: AppModal, - focusToaster: {message: (string | JSX.Element), uid: string | number } + focusToaster: {message: (string | JSX.Element), timestamp: number } } diff --git a/libs/remix-ui/app/src/lib/remix-app/state/modals.ts b/libs/remix-ui/app/src/lib/remix-app/state/modals.ts index 1a0d323265..3120766dac 100644 --- a/libs/remix-ui/app/src/lib/remix-app/state/modals.ts +++ b/libs/remix-ui/app/src/lib/remix-app/state/modals.ts @@ -14,5 +14,5 @@ export const ModalInitialState: ModalState = { cancelLabel: '', cancelFn: () => { } }, - focusToaster: { message: '', uid: 0 } + focusToaster: { message: '', timestamp: 0 } } diff --git a/libs/remix-ui/toaster/src/lib/toaster.tsx b/libs/remix-ui/toaster/src/lib/toaster.tsx index 2515def65e..97255cb4d2 100644 --- a/libs/remix-ui/toaster/src/lib/toaster.tsx +++ b/libs/remix-ui/toaster/src/lib/toaster.tsx @@ -8,7 +8,7 @@ export interface ToasterProps { message: string | JSX.Element timeOut?: number, handleHide?: () => void, - uid?: string | number + timestamp?: number } export const Toaster = (props: ToasterProps) => { @@ -50,7 +50,7 @@ export const Toaster = (props: ToasterProps) => { } }) } - }, [props.message, props.uid]) + }, [props.message, props.timestamp]) useEffect(() => { if (state.hiding) {