Skip to content

Commit 16133db

Browse files
committed
Enhance Network components with dark mode support and dynamic sizing
- Updated NetworkEdge and NetworkNode components to improve dark mode compatibility with appropriate color adjustments. - Implemented dynamic sizing for NetworkNode based on content measurement, enhancing layout flexibility. - Refactored IP address handling in NetworkView to normalize IPv6 addresses for better comparison. - Improved helper functions for device name and data retrieval to account for IPv6 variations.
1 parent fc95995 commit 16133db

File tree

5 files changed

+366
-204
lines changed

5 files changed

+366
-204
lines changed

frontend/src/components/NetworkEdge.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,46 +166,46 @@ const NetworkEdge = memo<EdgeProps>(({
166166
}}
167167
className="nodrag nopan"
168168
>
169-
<div className="bg-white/95 backdrop-blur-sm border border-gray-200 rounded-lg shadow-lg p-3 min-w-[120px]">
169+
<div className="bg-white/95 dark:bg-gray-800/95 backdrop-blur-sm border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg p-3 min-w-[120px]">
170170
{/* Main traffic info */}
171171
<div className="flex items-center justify-between mb-2">
172172
<span className="font-bold text-sm" style={{ color: edgeStyle.color }}>
173173
{formattedData.bytes}
174174
</span>
175-
<span className="text-xs text-gray-500">
175+
<span className="text-xs text-gray-500 dark:text-gray-400">
176176
{trafficTypeProps.icon}
177177
</span>
178178
</div>
179179

180180
{/* Traffic type and protocol */}
181-
<div className="flex items-center justify-between text-xs text-gray-600 mb-2">
181+
<div className="flex items-center justify-between text-xs text-gray-600 dark:text-gray-400 mb-2">
182182
<span className="font-medium">{formattedData.protocol}</span>
183183
<span>{trafficTypeProps.label}</span>
184184
</div>
185185

186186
{/* Packet count */}
187187
{formattedData.packets !== '0' && (
188-
<div className="text-xs text-gray-500 mb-2">
188+
<div className="text-xs text-gray-500 dark:text-gray-400 mb-2">
189189
📦 {formattedData.packets} packets
190190
</div>
191191
)}
192192

193193
{/* Traffic direction indicator */}
194194
{(data as NetworkLinkData).txBytes > 0 || (data as NetworkLinkData).rxBytes > 0 ? (
195195
<div className="space-y-1">
196-
<div className="text-xs text-gray-500">Traffic Flow:</div>
196+
<div className="text-xs text-gray-500 dark:text-gray-400">Traffic Flow:</div>
197197
<div className="flex items-center gap-1 text-xs">
198-
<span className="text-blue-600">
198+
<span className="text-blue-600 dark:text-blue-400">
199199
{formatBytes((data as NetworkLinkData).txBytes)}
200200
</span>
201-
<span className="text-gray-400">|</span>
202-
<span className="text-green-600">
201+
<span className="text-gray-400 dark:text-gray-500">|</span>
202+
<span className="text-green-600 dark:text-green-400">
203203
{formatBytes((data as NetworkLinkData).rxBytes)}
204204
</span>
205205
</div>
206206

207207
{/* Visual traffic ratio bar */}
208-
<div className="flex h-1 bg-gray-200 rounded-full overflow-hidden">
208+
<div className="flex h-1 bg-gray-200 dark:bg-gray-600 rounded-full overflow-hidden">
209209
<div
210210
className="bg-blue-500"
211211
style={{ width: `${formattedData.txPercentage}%` }}

0 commit comments

Comments
 (0)