@@ -3,13 +3,15 @@ import { createPortal } from 'react-dom'
33import { RouteComponentProps } from 'react-router-dom'
44import { useTranslation } from 'react-i18next'
55import { Stack , MessageBar , MessageBarType , IconButton , Panel , PanelType , Text } from 'office-ui-fabric-react'
6+ import { openExternal } from 'services/remote'
67import { NeuronWalletContext } from 'states/stateProvider'
78import { StateWithDispatch , StateDispatch } from 'states/stateProvider/reducer'
89import {
910 toggleAllNotificationVisibility ,
1011 toggleTopAlertVisibility ,
1112 dismissNotification ,
1213} from 'states/stateProvider/actionCreators'
14+ import { ErrorCode , RUN_NODE_GUIDE_URL } from 'utils/const'
1315import styles from './Notification.module.scss'
1416
1517const notificationType = ( type : 'success' | 'warning' | 'alert' ) => {
@@ -81,6 +83,10 @@ export const NoticeContent = ({ dispatch }: React.PropsWithoutRef<StateWithDispa
8183 [ dispatch ]
8284 )
8385
86+ const onGuideLinkClick = useCallback ( ( ) => {
87+ openExternal ( RUN_NODE_GUIDE_URL )
88+ } , [ ] )
89+
8490 return (
8591 < div >
8692 { showTopAlert && notification ? (
@@ -102,6 +108,11 @@ export const NoticeContent = ({ dispatch }: React.PropsWithoutRef<StateWithDispa
102108 { notification . code
103109 ? t ( `messages.codes.${ notification . code } ` , notification . meta )
104110 : notification . content || t ( 'messages.unknown-error' ) }
111+ { notification . code === ErrorCode . NodeDisconnected ? (
112+ < Text as = "span" variant = "xSmall" className = { styles . guide } onClick = { onGuideLinkClick } >
113+ { t ( 'messages.run-ckb-guide' ) }
114+ </ Text >
115+ ) : null }
105116 </ MessageBar >
106117 ) : null }
107118
0 commit comments