From 161c219d600de2abb8ffe3a0f71f654f453e3cde Mon Sep 17 00:00:00 2001 From: Terry Yiu Date: Thu, 10 Sep 2026 10:14:05 +0300 Subject: [PATCH] Rename rate labels, style them like other amount fields "1 BTC to USD" -> "BTC to USD", "1 to Sats" -> " to Sats" (the "1 " was redundant with the field itself now carrying the label). Compose: the BTC-to-currency rate and currency-to-sats value are now OutlinedTextFields (read-only, matching the enabled/disabled styling of the Currencies section's fields) instead of plain Text, with the label folded into the field itself rather than a separate heading. The manual-source rate field's label changes from generic "Rate" to the same "BTC to ". iOS/macOS: dropped the Section's "1 BTC to " header; the label now sits directly on the rate row (label left, value right), matching the existing Sats/BTC/currency field rows and the already-matching " to Sats" row below it. rate_label is now unused and removed. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01FXcrACM5sok3M1KQJ8kByy --- iosApp/iosApp/ContentView.swift | 17 ++++---- .../xyz/tyiu/satsprice/ui/PriceScreen.kt | 42 +++++++++---------- .../moko-resources/base/strings.xml | 5 +-- 3 files changed, 29 insertions(+), 35 deletions(-) diff --git a/iosApp/iosApp/ContentView.swift b/iosApp/iosApp/ContentView.swift index 53ed6eb..fc5ebe3 100644 --- a/iosApp/iosApp/ContentView.swift +++ b/iosApp/iosApp/ContentView.swift @@ -55,10 +55,6 @@ struct ContentView: View { private func form(for state: IosConverterState) -> some View { Form { Section( - header: Text(IosLocalizationKt.localizedFormattedString( - resource: MR.strings.shared.btc_to_currency, - args: [state.defaultCurrencyCode] - )), footer: Group { if !state.statusLine.isEmpty { Text(state.statusLine) @@ -78,19 +74,22 @@ struct ContentView: View { } HStack { + Text(IosLocalizationKt.localizedFormattedString( + resource: MR.strings.shared.btc_to_currency, + args: [state.defaultCurrencyCode] + )) + Spacer() if state.isManualSource { NumericField( - placeholder: IosLocalizationKt.localizedString(resource: MR.strings.shared.rate_label), + placeholder: "", value: state.manualRateInput, keyboardType: .decimalPad, sanitize: sanitizeDecimalInput, - onChange: { viewModel.onManualRateChanged($0) } + onChange: { viewModel.onManualRateChanged($0) }, + alignment: .trailing ) } else if !state.defaultCurrencyRate.isEmpty { Text(NumberFormatKt.groupDigits(value: state.defaultCurrencyRate)) - Spacer() - } else { - Spacer() } if !state.isManualSource { if state.isLoading { diff --git a/shared/src/commonMain/kotlin/xyz/tyiu/satsprice/ui/PriceScreen.kt b/shared/src/commonMain/kotlin/xyz/tyiu/satsprice/ui/PriceScreen.kt index d68e1d7..c949f2e 100644 --- a/shared/src/commonMain/kotlin/xyz/tyiu/satsprice/ui/PriceScreen.kt +++ b/shared/src/commonMain/kotlin/xyz/tyiu/satsprice/ui/PriceScreen.kt @@ -5,7 +5,6 @@ import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.fillMaxSize @@ -168,11 +167,6 @@ fun PriceScreen( ) } - Text( - text = stringResource(MR.strings.btc_to_currency, state.defaultCurrencyCode), - style = MaterialTheme.typography.bodyMedium, - ) - Row( modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp), @@ -182,7 +176,7 @@ fun PriceScreen( OutlinedTextField( value = state.manualRateInput, onValueChange = viewModel::onManualRateChanged, - label = { Text(stringResource(MR.strings.rate_label)) }, + label = { Text(stringResource(MR.strings.btc_to_currency, state.defaultCurrencyCode)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Decimal), singleLine = true, visualTransformation = DigitGroupingTransformation, @@ -190,15 +184,16 @@ fun PriceScreen( ) } else { val rate = state.defaultCurrencyRate() - if (rate.isNotEmpty()) { - Text( - text = groupDigits(rate), - style = MaterialTheme.typography.headlineSmall, - modifier = Modifier.weight(1f), - ) - } else { - Spacer(modifier = Modifier.weight(1f)) - } + OutlinedTextField( + value = rate, + onValueChange = {}, + readOnly = true, + enabled = rate.isNotEmpty(), + label = { Text(stringResource(MR.strings.btc_to_currency, state.defaultCurrencyCode)) }, + singleLine = true, + visualTransformation = DigitGroupingTransformation, + modifier = Modifier.weight(1f), + ) } if (!state.isManualSource) { if (state.isLoading) { @@ -216,13 +211,14 @@ fun PriceScreen( val oneCurrencyToSats = state.oneCurrencyToSats() if (oneCurrencyToSats.isNotEmpty()) { - Text( - text = stringResource(MR.strings.currency_to_sats, state.defaultCurrencyCode), - style = MaterialTheme.typography.bodyMedium, - ) - Text( - text = groupDigits(oneCurrencyToSats), - style = MaterialTheme.typography.headlineSmall, + OutlinedTextField( + value = oneCurrencyToSats, + onValueChange = {}, + readOnly = true, + label = { Text(stringResource(MR.strings.currency_to_sats, state.defaultCurrencyCode)) }, + singleLine = true, + visualTransformation = DigitGroupingTransformation, + modifier = Modifier.fillMaxWidth(), ) } } diff --git a/shared/src/commonMain/moko-resources/base/strings.xml b/shared/src/commonMain/moko-resources/base/strings.xml index fdbb31f..4943d5f 100644 --- a/shared/src/commonMain/moko-resources/base/strings.xml +++ b/shared/src/commonMain/moko-resources/base/strings.xml @@ -2,7 +2,7 @@ Add currency Bitcoin BTC - 1 BTC to %1$s + BTC to %1$s Clear search Currencies %1$d selected @@ -11,7 +11,7 @@ %1$s - %2$s %1$s - %2$s Options for %1$s - 1 %1$s to Sats + %1$s to Sats Done Exceeds the %1$s maximum supply Move down @@ -19,7 +19,6 @@ Move to top Move up Price Source - Rate Refresh Remove Retry