Skip to content

Commit 032da78

Browse files
committed
Add conditional rendering for resource availability in Hero component based on environment
1 parent cb8a02e commit 032da78

File tree

1 file changed

+35
-28
lines changed

1 file changed

+35
-28
lines changed

app/server-components/Nodes/Hero.tsx

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import HeroEpochCard from '@/components/Hero/HeroEpochCard';
2+
import config from '@/config';
23
import * as types from '@/typedefs/blockchain';
34
import { Skeleton } from '@heroui/skeleton';
45
import { round } from 'lodash';
@@ -23,34 +24,38 @@ export default async function Hero({
2324
<div className="flexible-row">
2425
<CardHorizontal label="Active Nodes" value={nodesTotalItems} isFlexible widthClasses="min-w-[196px]" />
2526

26-
<CardHorizontal
27-
label="CPU Cores Available"
28-
value={round(resourcesTotal.cpu_cores_avail, 1)}
29-
isFlexible
30-
widthClasses="min-w-[274px]"
31-
/>
27+
{config.environment === 'devnet' && (
28+
<>
29+
<CardHorizontal
30+
label="CPU Cores Available"
31+
value={round(resourcesTotal.cpu_cores_avail, 1)}
32+
isFlexible
33+
widthClasses="min-w-[274px]"
34+
/>
3235

33-
<CardHorizontal
34-
label="Memory Available"
35-
value={
36-
<div>
37-
{round(resourcesTotal.mem_avail, 1)} <span className="text-slate-500">GB</span>
38-
</div>
39-
}
40-
isFlexible
41-
widthClasses="min-w-[302px]"
42-
/>
36+
<CardHorizontal
37+
label="Memory Available"
38+
value={
39+
<div>
40+
{round(resourcesTotal.mem_avail, 1)} <span className="text-slate-500">GB</span>
41+
</div>
42+
}
43+
isFlexible
44+
widthClasses="min-w-[302px]"
45+
/>
4346

44-
<CardHorizontal
45-
label="Disk Available"
46-
value={
47-
<div>
48-
{round(resourcesTotal.disk_avail, 1)} <span className="text-slate-500">GB</span>
49-
</div>
50-
}
51-
isFlexible
52-
widthClasses="min-w-[282px]"
53-
/>
47+
<CardHorizontal
48+
label="Disk Available"
49+
value={
50+
<div>
51+
{round(resourcesTotal.disk_avail, 1)} <span className="text-slate-500">GB</span>
52+
</div>
53+
}
54+
isFlexible
55+
widthClasses="min-w-[282px]"
56+
/>
57+
</>
58+
)}
5459

5560
<CardHorizontal
5661
label={
@@ -60,10 +65,12 @@ export default async function Hero({
6065
}
6166
value={<R1TotalSupply />}
6267
isFlexible
63-
widthClasses="min-[420px]:min-w-[346px]"
68+
widthClasses="min-[420px]:min-w-[346px] md:max-w-[360px]"
6469
/>
6570

66-
<Suspense fallback={<Skeleton className="min-h-[76px] w-full rounded-xl md:max-w-[380px]" />}>
71+
<Suspense
72+
fallback={<Skeleton className="min-h-[76px] w-full min-w-[300px] flex-1 rounded-xl md:max-w-[380px]" />}
73+
>
6774
<CardHorizontal
6875
label={
6976
<div>

0 commit comments

Comments
 (0)