Fix Network error handling

This commit is contained in:
Hristo Nedelkov 2023-08-14 11:29:04 +03:00
parent e6b505f612
commit 6a18bc817a
3 changed files with 19 additions and 6 deletions

View File

@ -35,7 +35,7 @@ const DeviceMemory = ({ currentMemory, maxMemory }: DeviceMemoryProps) => {
const currentLoad =
chartData[0].data.length > 0 ? chartData[0].data[chartData[0].data.length - 1].y : 0
const message = currentLoad < 80 ? 'Good' : 'Poor'
const message = currentLoad < maxMemory ? 'Good' : 'Poor'
return (
<ShadowBox

View File

@ -1,7 +1,7 @@
import StandartLineChart from './StandardLineChart'
import IconText from './IconText'
import { Paragraph, Separator, XStack, YStack } from 'tamagui'
import { Shadow as ShadowBox } from '@status-im/components'
import { Shadow as ShadowBox, Text } from '@status-im/components'
type DataPoint = {
x: number
@ -40,10 +40,19 @@ const DeviceNetworkHealth = ({ uploadRate, downloadRate }: DeviceNetworkHealthPr
const currentLoad =
chartData[0].data.length > 0 ? chartData[0].data[chartData[0].data.length - 1].y : 0
const message = currentLoad < 80 ? 'Good' : 'Poor'
const message = currentLoad > 60 ? 'Good' : 'Poor'
return (
<ShadowBox variant="$2" style={{ width: '284px', height: '136px', borderRadius: '16px' }}>
<ShadowBox
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"
@ -69,7 +78,11 @@ const DeviceNetworkHealth = ({ uploadRate, downloadRate }: DeviceNetworkHealthPr
<IconText icon={message === 'Good' ? '/icons/check-circle.png' : '/icons/alert.png'}>
{message}
</IconText>
{/* <Text color={'#E95460'}>This is additional text</Text> */}
{message === 'Poor' && (
<Text size={13} color="#E95460">
{((currentLoad / 60) * 100).toFixed(0)}% Uttilization
</Text>
)}
</XStack>
</YStack>
</ShadowBox>

View File

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