Skip to content

Commit

Permalink
Prefer node update (#905)
Browse files Browse the repository at this point in the history
* Prefer node update over client update

* Fix toggling node/remote node connection

Set truncated to long texts
  • Loading branch information
aidenaio authored Mar 30, 2023
1 parent 53a5cca commit 5007284
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion renderer/screens/home/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ export function ActivateMiningSwitch({isOnline, isDelegator, onShow}) {
h="8"
px={3}
>
<FormLabel htmlFor="mining" fontWeight="normal" mb={0}>
<FormLabel htmlFor="mining" fontWeight="normal" mb={0} noOfLines={1}>
{isDelegator ? t('Delegation') : t('Mining')}
</FormLabel>
<Stack direction="row" align="center">
Expand Down
2 changes: 1 addition & 1 deletion renderer/screens/oracles/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion renderer/screens/validation/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ export function clearValidationState() {
persistState('validation2', null)
}

// TODO: add tests
export function shouldStartValidation(epoch, identity) {
const isValidationRunning =
epoch &&
Expand Down
4 changes: 2 additions & 2 deletions renderer/shared/components/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ function StatusContent(props) {

// eslint-disable-next-line react/display-name
const StatusText = React.forwardRef((props, ref) => (
<Text ref={ref} fontWeight={500} {...props} />
<Text ref={ref} fontWeight={500} noOfLines={1} {...props} />
))

function ConnectionBandwidth() {
Expand Down Expand Up @@ -801,7 +801,7 @@ export function Version({
</VersionText>
</Stack>
<Stack>
{!clientUpdating && canUpdateClient && (
{!canUpdateNode && !clientUpdating && canUpdateClient && (
<UpdateButton
version={uiRemoteVersion}
onClick={() => {
Expand Down
17 changes: 11 additions & 6 deletions renderer/shared/providers/settings-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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 (
<SettingsStateContext.Provider value={state}>
<SettingsDispatchContext.Provider
Expand All @@ -166,14 +173,12 @@ export function SettingsProvider({children}) {
toggleUseExternalNode,
toggleRunInternalNode,
changeLanguage,
setConnectionDetails({url, apiKey}) {
dispatch({type: SET_CONNECTION_DETAILS, url, apiKey})
},
setConnectionDetails,
toggleAutoActivateMining,
}),
[
changeLanguage,
dispatch,
setConnectionDetails,
toggleAutoActivateMining,
toggleRunInternalNode,
toggleUseExternalNode,
Expand Down

0 comments on commit 5007284

Please sign in to comment.