Merge pull request #31 from nimbus-gui/hn.make-responsive-DeviceHealthCheck
Hn.make responsive device health check
This commit is contained in:
commit
4001c292a4
|
@ -11,9 +11,28 @@ import DeviceNetworkHealth from '../../components/Charts/DeviceNetworkHealth'
|
||||||
import { CloseCircleIcon } from '@status-im/icons'
|
import { CloseCircleIcon } from '@status-im/icons'
|
||||||
import { useSelector } from 'react-redux'
|
import { useSelector } from 'react-redux'
|
||||||
import { RootState } from '../../redux/store'
|
import { RootState } from '../../redux/store'
|
||||||
|
import { useEffect, useState } from 'react'
|
||||||
|
|
||||||
const DeviceHealthCheck = () => {
|
const DeviceHealthCheck = () => {
|
||||||
const deviceHealthState = useSelector((state: RootState) => state.deviceHealth)
|
const deviceHealthState = useSelector((state: RootState) => state.deviceHealth)
|
||||||
|
const [windowWidth, setWindowWidth] = useState(window.innerWidth)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const handleResize = () => {
|
||||||
|
setWindowWidth(window.innerWidth)
|
||||||
|
}
|
||||||
|
window.addEventListener('resize', handleResize)
|
||||||
|
|
||||||
|
return () => window.removeEventListener('resize', handleResize)
|
||||||
|
}, [])
|
||||||
|
const breakpoint = 768
|
||||||
|
|
||||||
|
const responsiveStyle = {
|
||||||
|
flexWrap: windowWidth <= breakpoint ? 'wrap' : 'nowrap',
|
||||||
|
flexDirection: windowWidth <= breakpoint ? 'column' : 'row',
|
||||||
|
alignItems: 'flex-start',
|
||||||
|
width: windowWidth <= breakpoint ? '200%' : '100%',
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageWrapperShadow rightImageSrc="./background-images/eye-background.png" imgHeight="100%">
|
<PageWrapperShadow rightImageSrc="./background-images/eye-background.png" imgHeight="100%">
|
||||||
|
@ -33,14 +52,14 @@ const DeviceHealthCheck = () => {
|
||||||
subtitle="Configure your device to start Staking on Nimbus"
|
subtitle="Configure your device to start Staking on Nimbus"
|
||||||
isAdvancedSettings={true}
|
isAdvancedSettings={true}
|
||||||
/>
|
/>
|
||||||
<XStack space={'$4'} width={'100%'}>
|
<XStack space={'$4'} style={responsiveStyle}>
|
||||||
<DeviceStorageHealth
|
<DeviceStorageHealth
|
||||||
storage={deviceHealthState.storage}
|
storage={deviceHealthState.storage}
|
||||||
maxStorage={deviceHealthState.maxMemory}
|
maxStorage={deviceHealthState.maxMemory}
|
||||||
/>
|
/>
|
||||||
<DeviceCPULoad load={deviceHealthState.cpuLoad} />
|
<DeviceCPULoad load={deviceHealthState.cpuLoad} />
|
||||||
</XStack>
|
</XStack>
|
||||||
<XStack space={'$4'} width={'100%'}>
|
<XStack space={'$4'} style={responsiveStyle}>
|
||||||
<DeviceMemory
|
<DeviceMemory
|
||||||
currentMemory={deviceHealthState.memory}
|
currentMemory={deviceHealthState.memory}
|
||||||
maxMemory={deviceHealthState.maxMemory}
|
maxMemory={deviceHealthState.maxMemory}
|
||||||
|
|
Loading…
Reference in New Issue