Fix CPU error handling

This commit is contained in:
Hristo Nedelkov 2023-08-14 11:33:54 +03:00
parent 6a18bc817a
commit cf2eb7efb6
2 changed files with 18 additions and 5 deletions

View File

@ -1,7 +1,7 @@
import StandartLineChart from './StandardLineChart'
import IconText from './IconText'
import { Paragraph, Separator, XStack, YStack } from 'tamagui'
import { Shadow } from '@status-im/components'
import { Shadow, Text } from '@status-im/components'
type DataPoint = {
x: number
@ -34,7 +34,16 @@ const DeviceCPULoad: React.FC<DeviceCPULoadProps> = ({ load }) => {
const message = currentLoad < 80 ? 'Good' : 'Poor'
return (
<Shadow variant="$2" style={{ width: '284px', height: '136px', borderRadius: '16px' }}>
<Shadow
variant="$2"
style={{
width: '284px',
height: '136px',
borderRadius: '16px',
border: message === 'Poor' ? '1px solid #D92344' : 'none',
backgroundColor: message === 'Poor' ? '#fefafa' : '#fff',
}}
>
<YStack>
<XStack
justifyContent="space-between"
@ -63,7 +72,11 @@ const DeviceCPULoad: React.FC<DeviceCPULoadProps> = ({ load }) => {
>
{message}
</IconText>
{/* <Text color={'#E95460'}>This is additional text</Text> */}
{message === 'Poor' && (
<Text size={13} color="#E95460">
{((currentLoad / 80) * 100).toFixed(0)}% Uttilization
</Text>
)}
</XStack>
</YStack>
</Shadow>

View File

@ -41,11 +41,11 @@ const DeviceHeanlthCheckContent = () => {
/>
<XStack space={'$4'}>
<DeviceStorageHealth storage={44} maxStorage={30} />
<DeviceCPULoad load={[12, 123, 4]} />
<DeviceCPULoad load={[12, 123, 4,90]} />
</XStack>
<XStack space={'$4'}>
<DeviceMemory currentMemory={[25, 31, 5, 14, 20,81]} maxMemory={38} />
<DeviceNetworkHealth uploadRate={[1, 4, 23, 11]} downloadRate={[20, 3, 40, 56]} />
<DeviceNetworkHealth uploadRate={[1, 4, 23, 55]} downloadRate={[20, 3, 40, 56]} />
</XStack>
<HealthInfoSection
usedStorage={120}