From 5007284004339bc2200b5d3ef08e63700d898bfc Mon Sep 17 00:00:00 2001 From: aidenaio <50833934+aidenaio@users.noreply.github.com> Date: Thu, 30 Mar 2023 18:10:50 +0500 Subject: [PATCH] Prefer node update (#905) * Prefer node update over client update * Fix toggling node/remote node connection Set truncated to long texts --- renderer/screens/home/components.js | 2 +- renderer/screens/oracles/components.js | 2 +- renderer/screens/validation/utils.js | 1 - renderer/shared/components/sidebar.js | 4 ++-- renderer/shared/providers/settings-context.js | 17 +++++++++++------ 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/renderer/screens/home/components.js b/renderer/screens/home/components.js index 227017476..c3ef92e0b 100644 --- a/renderer/screens/home/components.js +++ b/renderer/screens/home/components.js @@ -463,7 +463,7 @@ export function ActivateMiningSwitch({isOnline, isDelegator, onShow}) { h="8" px={3} > - + {isDelegator ? t('Delegation') : t('Mining')} diff --git a/renderer/screens/oracles/components.js b/renderer/screens/oracles/components.js index 98ffa27a5..c51eaf4c3 100644 --- a/renderer/screens/oracles/components.js +++ b/renderer/screens/oracles/components.js @@ -505,7 +505,7 @@ export function ScrollToTop({scrollableRef, ...props}) { display="inline-flex" alignItems="center" justifyContent="center" - position="absolute" + position="fixed" bottom={4} right={4} borderRadius="lg" diff --git a/renderer/screens/validation/utils.js b/renderer/screens/validation/utils.js index 75b566485..97d5c95f4 100644 --- a/renderer/screens/validation/utils.js +++ b/renderer/screens/validation/utils.js @@ -128,7 +128,6 @@ export function clearValidationState() { persistState('validation2', null) } -// TODO: add tests export function shouldStartValidation(epoch, identity) { const isValidationRunning = epoch && diff --git a/renderer/shared/components/sidebar.js b/renderer/shared/components/sidebar.js index ba2bcb860..2168e0c2c 100644 --- a/renderer/shared/components/sidebar.js +++ b/renderer/shared/components/sidebar.js @@ -200,7 +200,7 @@ function StatusContent(props) { // eslint-disable-next-line react/display-name const StatusText = React.forwardRef((props, ref) => ( - + )) function ConnectionBandwidth() { @@ -801,7 +801,7 @@ export function Version({ - {!clientUpdating && canUpdateClient && ( + {!canUpdateNode && !clientUpdating && canUpdateClient && ( { diff --git a/renderer/shared/providers/settings-context.js b/renderer/shared/providers/settings-context.js index 0c0741339..351ab95b3 100644 --- a/renderer/shared/providers/settings-context.js +++ b/renderer/shared/providers/settings-context.js @@ -136,14 +136,14 @@ export function SettingsProvider({children}) { }) const toggleUseExternalNode = useCallback( - () => (enable) => { + (enable) => { dispatch({type: TOGGLE_USE_EXTERNAL_NODE, data: enable}) }, [dispatch] ) const toggleRunInternalNode = useCallback( - () => (run) => { + (run) => { dispatch({type: TOGGLE_RUN_INTERNAL_NODE, data: run}) }, [dispatch] @@ -158,6 +158,13 @@ export function SettingsProvider({children}) { dispatch({type: TOGGLE_AUTO_ACTIVATE_MINING}) }, [dispatch]) + const setConnectionDetails = useCallback( + ({url, apiKey}) => { + dispatch({type: SET_CONNECTION_DETAILS, url, apiKey}) + }, + [dispatch] + ) + return (