use timestamp

pull/5370/head
filip mertens 2 years ago committed by Aniket
parent fffdabed60
commit 7cd6d57ccf
  1. 4
      apps/remix-ide/src/app/plugins/notification.tsx
  2. 2
      libs/remix-ui/app/src/lib/remix-app/actions/modals.ts
  3. 2
      libs/remix-ui/app/src/lib/remix-app/components/modals/dialogs.tsx
  4. 4
      libs/remix-ui/app/src/lib/remix-app/context/context.tsx
  5. 4
      libs/remix-ui/app/src/lib/remix-app/context/provider.tsx
  6. 4
      libs/remix-ui/app/src/lib/remix-app/interface/index.ts
  7. 2
      libs/remix-ui/app/src/lib/remix-app/state/modals.ts
  8. 4
      libs/remix-ui/toaster/src/lib/toaster.tsx

@ -38,7 +38,7 @@ export class NotificationPlugin extends Plugin implements MethodApi<INotificatio
return this.dispatcher.alert(args)
}
async toast (message: string | JSX.Element, uid?: string | number) {
this.dispatcher.toast(message, uid)
async toast (message: string | JSX.Element) {
this.dispatcher.toast(message)
}
}

@ -22,7 +22,7 @@ export const enum modalActionTypes {
type ModalPayload = {
[modalActionTypes.setModal]: AppModal
[modalActionTypes.handleHideModal]: any
[modalActionTypes.setToast]: { message: string | JSX.Element, uid: string | number }
[modalActionTypes.setToast]: { message: string | JSX.Element, timestamp: number }
[modalActionTypes.handleToaster]: any,
[modalActionTypes.processQueue]: any
}

@ -10,7 +10,7 @@ const AppDialogs = () => {
return (
<>
<ModalWrapper {...focusModal} handleHide={handleHideModal}></ModalWrapper>
<Toaster message={focusToaster.message} uid={focusToaster.uid} handleHide={handleToaster} />
<Toaster message={focusToaster.message} timestamp={focusToaster.timestamp} handleHide={handleToaster} />
</>)
}
export default AppDialogs

@ -6,7 +6,7 @@ export const AppContext = React.createContext<any>(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<dispatchModalInterface>({
modal: (data: AppModal) => { },
toast: (message: string | JSX.Element, uid?:string | number) => {},
toast: (message: string | JSX.Element) => {},
alert: (data: AlertModal) => {},
handleHideModal: () => {},
handleToaster: () => {}

@ -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() }
})
}

@ -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 }
}

@ -14,5 +14,5 @@ export const ModalInitialState: ModalState = {
cancelLabel: '',
cancelFn: () => { }
},
focusToaster: { message: '', uid: 0 }
focusToaster: { message: '', timestamp: 0 }
}

@ -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) {

Loading…
Cancel
Save