diff --git a/src/dashboard/ui/App.tsx b/src/dashboard/ui/App.tsx index f1dace9..47f7629 100644 --- a/src/dashboard/ui/App.tsx +++ b/src/dashboard/ui/App.tsx @@ -13,6 +13,7 @@ import DashboardTitle from './components/DashboardTitle' import WalletInfo from './components/WalletInfo' import UpdateProgress from './components/UpdateProgress' import DefaultLoader from './components/DefaultLoader' +import NodeRestartAlert from './components/NodeRestartAlert' import Typography from '@mui/material/Typography' export default function App() { @@ -234,6 +235,7 @@ export default function App() { + } - buttonLabel="Check Status" - isLoading={isLoading || isNodeUpdating || isFirefoxUpdating} + buttonLabel="Restart Node" + isLoading={ + isLoading || isNodeUpdating || isFirefoxUpdating || !!nodeVersion + } version={nodeVersion} /> diff --git a/src/dashboard/ui/components/NodeRestartAlert.tsx b/src/dashboard/ui/components/NodeRestartAlert.tsx new file mode 100644 index 0000000..cd38d3c --- /dev/null +++ b/src/dashboard/ui/components/NodeRestartAlert.tsx @@ -0,0 +1,34 @@ +import { useState, ReactEventHandler, useEffect } from 'react' +import Alert from '@mui/material/Alert' +import Typography from '@mui/material/Typography' + +const NodeRestartAlert = ({ isNodeRunning }: { isNodeRunning: boolean }) => { + const [showAlert, setShowAlert] = useState(false) + + useEffect(() => { + setShowAlert(!isNodeRunning) + }, [isNodeRunning]) + + const handleCloseAlert: ReactEventHandler = () => setShowAlert(false) + + return showAlert ? ( + + Point Node is not running + + Try restarting the Point Node by clicking the 'Restart Node' button + + + ) : null +} + +export default NodeRestartAlert