From 1a16f96739bec24bbc4b5329f22ced43dce463d4 Mon Sep 17 00:00:00 2001 From: Terry Yiu Date: Wed, 9 Sep 2026 08:09:21 +0300 Subject: [PATCH] Simplify currency row menu labels, add move to top/bottom MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move up/down/Remove no longer repeat the currency code in the menu item text — the row's own field already shows it right next to the button. Also adds Move to top / Move to bottom, enabled under the same conditions as the existing up/down actions. Switches from material-icons-core to material-icons-extended: the core set is a bare ~50-icon subset with nothing suited to "move to top/bottom" (no double-chevron or vertical-align icons), so KeyboardDoubleArrowUp/Down needed the fuller set. Compose-only: the native SwiftUI screen has no three-dot menu, it uses native list reordering instead. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01QpjMKWGoiT5aJBzhxvXkwp --- gradle/libs.versions.toml | 2 +- shared/build.gradle.kts | 2 +- .../xyz/tyiu/satsprice/ui/PriceScreen.kt | 38 +++++++++++++++++-- .../moko-resources/base/strings.xml | 8 ++-- 4 files changed, 42 insertions(+), 8 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 40aee74..3b721bf 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -39,7 +39,7 @@ androidx-lifecycle-runtimeCompose = { module = "org.jetbrains.androidx.lifecycle compose-runtime = { module = "org.jetbrains.compose.runtime:runtime", version.ref = "composeMultiplatform" } compose-foundation = { module = "org.jetbrains.compose.foundation:foundation", version.ref = "composeMultiplatform" } compose-material3 = { module = "org.jetbrains.compose.material3:material3", version.ref = "material3" } -compose-materialIconsCore = { module = "org.jetbrains.compose.material:material-icons-core", version.ref = "composeMaterialIcons" } +compose-materialIconsExtended = { module = "org.jetbrains.compose.material:material-icons-extended", version.ref = "composeMaterialIcons" } compose-ui = { module = "org.jetbrains.compose.ui:ui", version.ref = "composeMultiplatform" } compose-uiToolingPreview = { module = "org.jetbrains.compose.ui:ui-tooling-preview", version.ref = "composeMultiplatform" } moko-resources = { module = "dev.icerock.moko:resources", version.ref = "mokoResources" } diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index d700389..4ca110a 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -71,7 +71,7 @@ kotlin { implementation(libs.compose.runtime) implementation(libs.compose.foundation) implementation(libs.compose.material3) - implementation(libs.compose.materialIconsCore) + implementation(libs.compose.materialIconsExtended) implementation(libs.compose.ui) implementation(libs.compose.uiToolingPreview) api(libs.moko.resources) 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 e8ed8e2..6301a84 100644 --- a/shared/src/commonMain/kotlin/xyz/tyiu/satsprice/ui/PriceScreen.kt +++ b/shared/src/commonMain/kotlin/xyz/tyiu/satsprice/ui/PriceScreen.kt @@ -23,6 +23,8 @@ import androidx.compose.material.icons.filled.Check import androidx.compose.material.icons.filled.Close import androidx.compose.material.icons.filled.KeyboardArrowDown import androidx.compose.material.icons.filled.KeyboardArrowUp +import androidx.compose.material.icons.filled.KeyboardDoubleArrowDown +import androidx.compose.material.icons.filled.KeyboardDoubleArrowUp import androidx.compose.material.icons.filled.MoreVert import androidx.compose.material.icons.filled.Refresh import androidx.compose.material3.Card @@ -358,6 +360,16 @@ fun PriceScreen( state.selectedFiatCurrencies.moved(index, index + 1), ) }, + onMoveToTop = { + viewModel.onFiatCurrenciesReordered( + state.selectedFiatCurrencies.moved(index, 0), + ) + }, + onMoveToBottom = { + viewModel.onFiatCurrenciesReordered( + state.selectedFiatCurrencies.moved(index, state.selectedFiatCurrencies.lastIndex), + ) + }, onRemove = { viewModel.onFiatCurrencyToggled(code) }, ) } @@ -380,6 +392,8 @@ private fun CurrencyRowMenu( canRemove: Boolean, onMoveUp: () -> Unit, onMoveDown: () -> Unit, + onMoveToTop: () -> Unit, + onMoveToBottom: () -> Unit, onRemove: () -> Unit, ) { var expanded by remember { mutableStateOf(false) } @@ -392,7 +406,16 @@ private fun CurrencyRowMenu( } DropdownMenu(expanded = expanded, onDismissRequest = { expanded = false }) { DropdownMenuItem( - text = { Text(stringResource(MR.strings.move_currency_up_content_description, code)) }, + text = { Text(stringResource(MR.strings.move_currency_to_top_content_description)) }, + leadingIcon = { Icon(Icons.Default.KeyboardDoubleArrowUp, contentDescription = null) }, + enabled = canMoveUp, + onClick = { + expanded = false + onMoveToTop() + }, + ) + DropdownMenuItem( + text = { Text(stringResource(MR.strings.move_currency_up_content_description)) }, leadingIcon = { Icon(Icons.Default.KeyboardArrowUp, contentDescription = null) }, enabled = canMoveUp, onClick = { @@ -401,7 +424,7 @@ private fun CurrencyRowMenu( }, ) DropdownMenuItem( - text = { Text(stringResource(MR.strings.move_currency_down_content_description, code)) }, + text = { Text(stringResource(MR.strings.move_currency_down_content_description)) }, leadingIcon = { Icon(Icons.Default.KeyboardArrowDown, contentDescription = null) }, enabled = canMoveDown, onClick = { @@ -409,9 +432,18 @@ private fun CurrencyRowMenu( onMoveDown() }, ) + DropdownMenuItem( + text = { Text(stringResource(MR.strings.move_currency_to_bottom_content_description)) }, + leadingIcon = { Icon(Icons.Default.KeyboardDoubleArrowDown, contentDescription = null) }, + enabled = canMoveDown, + onClick = { + expanded = false + onMoveToBottom() + }, + ) if (canRemove) { DropdownMenuItem( - text = { Text(stringResource(MR.strings.remove_currency_content_description, code)) }, + text = { Text(stringResource(MR.strings.remove_currency_content_description)) }, leadingIcon = { Icon(Icons.Default.Close, contentDescription = null) }, onClick = { expanded = false diff --git a/shared/src/commonMain/moko-resources/base/strings.xml b/shared/src/commonMain/moko-resources/base/strings.xml index 03b7a67..85d6ea3 100644 --- a/shared/src/commonMain/moko-resources/base/strings.xml +++ b/shared/src/commonMain/moko-resources/base/strings.xml @@ -12,12 +12,14 @@ Options for %1$s Done Exceeds the %1$s maximum supply - Move %1$s down - Move %1$s up + Move down + Move to bottom + Move to top + Move up Price Source Rate Refresh - Remove %1$s + Remove Retry Sats Selected Currencies