Skip to content

Commit cb2f6ca

Browse files
committed
chore(token/sell): add ~ to fee amount if not whole
Signed-off-by: Brandon McAnsh <[email protected]>
1 parent ccccc58 commit cb2f6ca

File tree

2 files changed

+12
-3
lines changed
  • apps/flipcash/features/tokens/src/main/kotlin/com/flipcash/app/tokens/internal
  • services/opencode/src/main/kotlin/com/getcode/opencode/model/financial

2 files changed

+12
-3
lines changed

apps/flipcash/features/tokens/src/main/kotlin/com/flipcash/app/tokens/internal/TokenSellReceiptScreen.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ private fun SellReceipt(
156156
ReceiptLineItem(
157157
modifier = Modifier.fillMaxWidth(),
158158
label = "${fee.roundToInt()}% Fee",
159-
amount = feeAmount.formatted(),
159+
amount = feeAmount.formatted(
160+
extraPrefix = if (feeAmount.decimalValue != 1.0) "~" else null,
161+
),
160162
)
161163
}
162164
}

services/opencode/src/main/kotlin/com/getcode/opencode/model/financial/Fiat.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ data class Fiat(
7373
fun formatted(
7474
rule: FormattingRule = FormattingRule.None,
7575
showPrefix: Boolean = true,
76+
extraPrefix: String? = null,
7677
includeCommas: Boolean = true,
7778
): String {
7879
val shouldTruncate = if (rule is FormattingRule.Truncated) {
@@ -103,8 +104,14 @@ data class Fiat(
103104
.takeIf { showPrefix }
104105
.orEmpty()
105106

106-
positivePrefix = prefix
107-
negativePrefix = prefix
107+
val fullPrefix = if (extraPrefix != null) {
108+
"$extraPrefix $prefix"
109+
} else {
110+
prefix
111+
}
112+
113+
positivePrefix = fullPrefix
114+
negativePrefix = fullPrefix
108115
isGroupingUsed = includeCommas
109116
}
110117

0 commit comments

Comments
 (0)