Rename rate labels, style them like other amount fields
"1 BTC to USD" -> "BTC to USD", "1 <currency> to Sats" -> "<currency> 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 <currency>". iOS/macOS: dropped the Section's "1 BTC to <currency>" 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 "<currency> to Sats" row below it. rate_label is now unused and removed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FXcrACM5sok3M1KQJ8kByy
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<string name="add_currency">Add currency</string>
|
||||
<string name="bitcoin_section_title">Bitcoin</string>
|
||||
<string name="btc_label">BTC</string>
|
||||
<string name="btc_to_currency">1 BTC to %1$s</string>
|
||||
<string name="btc_to_currency">BTC to %1$s</string>
|
||||
<string name="clear_search_content_description">Clear search</string>
|
||||
<string name="currencies_section_title">Currencies</string>
|
||||
<string name="currencies_selected_count">%1$d selected</string>
|
||||
@@ -11,7 +11,7 @@
|
||||
<string name="currency_option_label">%1$s - %2$s</string>
|
||||
<string name="currency_option_label_local">%1$s - %2$s</string>
|
||||
<string name="currency_options_content_description">Options for %1$s</string>
|
||||
<string name="currency_to_sats">1 %1$s to Sats</string>
|
||||
<string name="currency_to_sats">%1$s to Sats</string>
|
||||
<string name="done">Done</string>
|
||||
<string name="exceeds_max_supply">Exceeds the %1$s maximum supply</string>
|
||||
<string name="move_currency_down_content_description">Move down</string>
|
||||
@@ -19,7 +19,6 @@
|
||||
<string name="move_currency_to_top_content_description">Move to top</string>
|
||||
<string name="move_currency_up_content_description">Move up</string>
|
||||
<string name="price_source">Price Source</string>
|
||||
<string name="rate_label">Rate</string>
|
||||
<string name="refresh_content_description">Refresh</string>
|
||||
<string name="remove_currency_content_description">Remove</string>
|
||||
<string name="retry">Retry</string>
|
||||
|
||||
Reference in New Issue
Block a user