Skip to content

Commit 2658271

Browse files
jamesarichclaude
andauthored
fix(node): stop metric-card trailing values crushing to one-char-per-line (#6374)
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 99d5d1a commit 2658271

3 files changed

Lines changed: 37 additions & 8 deletions

File tree

feature/node/src/commonMain/kotlin/org/meshtastic/feature/node/metrics/DeviceMetrics.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package org.meshtastic.feature.node.metrics
2020

2121
import androidx.compose.foundation.layout.Arrangement
2222
import androidx.compose.foundation.layout.Column
23+
import androidx.compose.foundation.layout.FlowRow
2324
import androidx.compose.foundation.layout.Row
2425
import androidx.compose.foundation.layout.Spacer
2526
import androidx.compose.foundation.layout.fillMaxHeight
@@ -444,8 +445,15 @@ private fun DeviceMetricsCard(
444445

445446
Spacer(modifier = Modifier.height(8.dp))
446447

447-
/* Channel Utilization and Air Utilization Tx */
448-
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) {
448+
/* Channel Utilization / Air Utilization Tx, and Uptime */
449+
// FlowRow(SpaceBetween) so the uptime stays pinned right when it fits and drops onto its own line when the
450+
// (localized) labels don't fit, instead of being crushed and wrapped one character per line.
451+
FlowRow(
452+
modifier = Modifier.fillMaxWidth(),
453+
horizontalArrangement = Arrangement.SpaceBetween,
454+
verticalArrangement = Arrangement.spacedBy(4.dp),
455+
itemVerticalAlignment = Alignment.CenterVertically,
456+
) {
449457
Row(verticalAlignment = Alignment.CenterVertically) {
450458
if (deviceMetrics?.channel_utilization != null) {
451459
MetricValueRow(

feature/node/src/commonMain/kotlin/org/meshtastic/feature/node/metrics/PositionLogComponents.kt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package org.meshtastic.feature.node.metrics
2020

2121
import androidx.compose.foundation.layout.Arrangement
2222
import androidx.compose.foundation.layout.Column
23+
import androidx.compose.foundation.layout.FlowRow
2324
import androidx.compose.foundation.layout.Row
2425
import androidx.compose.foundation.layout.Spacer
2526
import androidx.compose.foundation.layout.fillMaxWidth
@@ -82,10 +83,13 @@ fun PositionCard(
8283
Spacer(modifier = Modifier.height(8.dp))
8384

8485
/* Coordinates */
85-
Row(
86+
// FlowRow(SpaceBetween) so "Sats" stays pinned right when it fits and drops onto its own line when the
87+
// (localized) coordinate labels don't fit, instead of being crushed and wrapped one character per line.
88+
FlowRow(
8689
modifier = Modifier.fillMaxWidth(),
8790
horizontalArrangement = Arrangement.SpaceBetween,
88-
verticalAlignment = Alignment.CenterVertically,
91+
verticalArrangement = Arrangement.spacedBy(4.dp),
92+
itemVerticalAlignment = Alignment.CenterVertically,
8993
) {
9094
Row(verticalAlignment = Alignment.CenterVertically) {
9195
MetricValueRow(color = GraphColors.Blue, text = "${stringResource(Res.string.latitude)}: $latitude")
@@ -105,10 +109,13 @@ fun PositionCard(
105109
Spacer(modifier = Modifier.height(4.dp))
106110

107111
/* Alt, Speed, Heading */
108-
Row(
112+
// FlowRow(SpaceBetween) so "Heading" stays pinned right when it fits and drops onto its own line when the
113+
// (localized) labels don't fit, instead of being crushed and wrapped one character per line.
114+
FlowRow(
109115
modifier = Modifier.fillMaxWidth(),
110116
horizontalArrangement = Arrangement.SpaceBetween,
111-
verticalAlignment = Alignment.CenterVertically,
117+
verticalArrangement = Arrangement.spacedBy(4.dp),
118+
itemVerticalAlignment = Alignment.CenterVertically,
112119
) {
113120
Row(verticalAlignment = Alignment.CenterVertically) {
114121
MetricValueRow(

feature/node/src/commonMain/kotlin/org/meshtastic/feature/node/metrics/SignalMetrics.kt

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,14 @@ private fun LocalStatsCard(telemetry: Telemetry, isSelected: Boolean, onClick: (
482482

483483
Spacer(modifier = Modifier.height(8.dp))
484484

485-
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) {
485+
// FlowRow(SpaceBetween): the relays stat wraps to its own line when the traffic label is too long,
486+
// instead of being crushed and wrapped one character per line.
487+
FlowRow(
488+
modifier = Modifier.fillMaxWidth(),
489+
horizontalArrangement = Arrangement.SpaceBetween,
490+
verticalArrangement = Arrangement.spacedBy(4.dp),
491+
itemVerticalAlignment = Alignment.CenterVertically,
492+
) {
486493
Text(
487494
text =
488495
stringResource(
@@ -506,7 +513,14 @@ private fun LocalStatsCard(telemetry: Telemetry, isSelected: Boolean, onClick: (
506513

507514
Spacer(modifier = Modifier.height(4.dp))
508515

509-
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) {
516+
// FlowRow(SpaceBetween): the uptime stat wraps to its own line when the nodes label is too long,
517+
// instead of being crushed and wrapped one character per line.
518+
FlowRow(
519+
modifier = Modifier.fillMaxWidth(),
520+
horizontalArrangement = Arrangement.SpaceBetween,
521+
verticalArrangement = Arrangement.spacedBy(4.dp),
522+
itemVerticalAlignment = Alignment.CenterVertically,
523+
) {
510524
Text(
511525
text =
512526
stringResource(

0 commit comments

Comments
 (0)