Skip to content

Commit 0eb3539

Browse files
committed
fix(tokens/discovery): abbreviated() returns -X for negative values; dont append another
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent e31286f commit 0eb3539

1 file changed

Lines changed: 24 additions & 8 deletions

File tree

  • apps/flipcash/features/discovery/src/main/kotlin/com/flipcash/app/discovery/internal/components

apps/flipcash/features/discovery/src/main/kotlin/com/flipcash/app/discovery/internal/components/TokenMetricsRow.kt

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ internal fun TokenMetricsRow(
7676
) {
7777
Text(
7878
text = token.name,
79-
modifier = Modifier.weight(1f, fill = false).alignByBaseline(),
79+
modifier = Modifier
80+
.weight(1f, fill = false)
81+
.alignByBaseline(),
8082
color = CodeTheme.colors.textMain,
8183
style = CodeTheme.typography.screenTitle,
8284
overflow = TextOverflow.Ellipsis,
@@ -108,7 +110,7 @@ internal fun TokenMetricsRow(
108110
val change = if (metricsDelta >= 0) LineTrend.Up else LineTrend.Down
109111
val deltaForWindow = buildString {
110112
when (change) {
111-
LineTrend.Down -> append("-")
113+
LineTrend.Down -> Unit // negative carried over from abbreviated
112114
LineTrend.Up -> append("+")
113115
}
114116
append(metricsDelta.abbreviated())
@@ -135,7 +137,11 @@ internal fun TokenMetricsRow(
135137
}
136138

137139
@Composable
138-
fun RankBadge(rank: Int, modifier: Modifier = Modifier, color: Color = CodeTheme.colors.textMain) {
140+
fun RankBadge(
141+
rank: Int,
142+
modifier: Modifier = Modifier,
143+
color: Color = CodeTheme.colors.textMain
144+
) {
139145
val textMeasurer = rememberTextMeasurer()
140146
val density = LocalDensity.current
141147
val style = CodeTheme.typography.screenTitle
@@ -171,20 +177,30 @@ internal fun SkeletonRankedTokenMetricsRow(rank: Int, modifier: Modifier = Modif
171177
RankBadge(rank, color = Color.White.copy(alpha = shimmerAlpha))
172178
Spacer(Modifier.width(2.dp))
173179
// Icon placeholder
174-
Box(Modifier.size(CodeTheme.dimens.grid.x9).shimmer(CircleShape))
180+
Box(Modifier
181+
.size(CodeTheme.dimens.grid.x9)
182+
.shimmer(CircleShape))
175183
Spacer(Modifier.width(CodeTheme.dimens.grid.x2))
176184
Row(
177185
modifier = Modifier.weight(1f),
178186
horizontalArrangement = Arrangement.SpaceBetween,
179187
verticalAlignment = Alignment.CenterVertically,
180188
) {
181189
Column {
182-
Box(Modifier.size(width = 80.dp, height = 14.dp).shimmer()) // name
183-
Box(Modifier.size(width = 50.dp, height = 12.dp).shimmer()) // market cap
190+
Box(Modifier
191+
.size(width = 80.dp, height = 14.dp)
192+
.shimmer()) // name
193+
Box(Modifier
194+
.size(width = 50.dp, height = 12.dp)
195+
.shimmer()) // market cap
184196
}
185197
Column(horizontalAlignment = Alignment.End) {
186-
Box(Modifier.size(width = 60.dp, height = 14.dp).shimmer()) // holders
187-
Box(Modifier.size(width = 40.dp, height = 12.dp).shimmer()) // delta
198+
Box(Modifier
199+
.size(width = 60.dp, height = 14.dp)
200+
.shimmer()) // holders
201+
Box(Modifier
202+
.size(width = 40.dp, height = 12.dp)
203+
.shimmer()) // delta
188204
}
189205
}
190206
}

0 commit comments

Comments
 (0)