@@ -64,11 +73,15 @@ const DeviceMemory = ({ currentMemory, maxMemory }: DeviceMemoryProps) => {
{message}
- {/* This is additional text */}
+ {message === 'Poor' && (
+
+ {((currentLoad / maxMemory || 0) * 100).toFixed(0)}% Utilization
+
+ )}
)
}
-export default DeviceMemory
+export default DeviceMemoryHealth
diff --git a/src/components/DeviceNetworkHealth.stories.tsx b/src/components/DeviceNetworkHealth.stories.tsx
new file mode 100644
index 00000000..79def3fc
--- /dev/null
+++ b/src/components/DeviceNetworkHealth.stories.tsx
@@ -0,0 +1,36 @@
+import type { Meta, StoryObj } from '@storybook/react'
+
+import DeviceNetworkHealth from './DeviceNetworkHealth'
+
+const meta = {
+ title: 'Device Health/DeviceNetworkHealth',
+ component: DeviceNetworkHealth,
+ parameters: {
+ layout: 'centered',
+ },
+ tags: ['autodocs'],
+} satisfies Meta
+
+export default meta
+type Story = StoryObj
+
+export const GoodStats: Story = {
+ args: {
+ uploadRate: [1, 4, 23, 61, 34],
+ downloadRate: [20, 3, 40, 56, 32],
+ },
+}
+
+export const BadStats: Story = {
+ args: {
+ uploadRate: [1, 4, 23, 55],
+ downloadRate: [20, 3, 40, 56, 80],
+ },
+}
+
+export const NoStats: Story = {
+ args: {
+ uploadRate: [],
+ downloadRate: [],
+ },
+}
diff --git a/src/components/DeviceNetworkHealth.tsx b/src/components/DeviceNetworkHealth.tsx
index da33dc33..38b36d02 100644
--- a/src/components/DeviceNetworkHealth.tsx
+++ b/src/components/DeviceNetworkHealth.tsx
@@ -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 (
-
+
{message}
- {/* This is additional text */}
+ {message === 'Poor' && (
+
+ {((currentLoad / 60) * 100).toFixed(0)}% Utilization
+
+ )}
diff --git a/src/components/DeviceStorageHealth.stories.tsx b/src/components/DeviceStorageHealth.stories.tsx
new file mode 100644
index 00000000..0a27f60e
--- /dev/null
+++ b/src/components/DeviceStorageHealth.stories.tsx
@@ -0,0 +1,36 @@
+import type { Meta, StoryObj } from '@storybook/react'
+
+import DeviceStorageHealth from './DeviceStorageHealth'
+
+const meta = {
+ title: 'Device Health/DeviceStorageHealth',
+ component: DeviceStorageHealth,
+ parameters: {
+ layout: 'centered',
+ },
+ tags: ['autodocs'],
+} satisfies Meta
+
+export default meta
+type Story = StoryObj
+
+export const GoodStats: Story = {
+ args: {
+ storage: 10,
+ maxStorage: 20,
+ },
+}
+
+export const BadStats: Story = {
+ args: {
+ storage: 20,
+ maxStorage: 20,
+ },
+}
+
+export const NoStats: Story = {
+ args: {
+ storage: 0,
+ maxStorage: 0,
+ },
+}
diff --git a/src/components/DeviceStorageHealth.tsx b/src/components/DeviceStorageHealth.tsx
index bad50d2e..71440ae8 100644
--- a/src/components/DeviceStorageHealth.tsx
+++ b/src/components/DeviceStorageHealth.tsx
@@ -1,22 +1,22 @@
import IconText from './IconText'
import { Paragraph, Separator, XStack, YStack } from 'tamagui'
import StandardGauge from './StandardGauge'
-import { Shadow } from '@status-im/components'
+import { Shadow, Text } from '@status-im/components'
interface DeviceStorageHealthProps {
storage: number
maxStorage: number
}
const DeviceStorageHealth: React.FC = ({ storage, maxStorage }) => {
const message = storage < maxStorage ? 'Good' : 'Poor'
- const data = (storage: number, maxStorage: number) => {
- const used = storage
- const free = maxStorage - storage
+ const free = maxStorage - storage
+ const utilization = (storage / (maxStorage || 1)) * 100
+ const data = (free: number) => {
return [
{
id: 'storage',
label: 'Used',
- value: used,
+ value: storage,
color: '#E95460',
},
{
@@ -27,8 +27,18 @@ const DeviceStorageHealth: React.FC = ({ storage, maxS
},
]
}
+
return (
-
+
= ({ storage, maxS
height: '75px',
}}
>
-
+
@@ -58,10 +68,17 @@ const DeviceStorageHealth: React.FC = ({ storage, maxS