From ba664f15575ee87b41bacb3945723548f95c466d Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 3 Mar 2026 13:08:53 +0500 Subject: [PATCH] Updated on 2026-08-14 --- .../tokenActions/TokenActionsComponent.kt | 63 +++++++++++++++++ .../wallet/child/wallet/WalletComponent.kt | 10 +++ .../intents/WalletContentClickIntents.kt | 30 +++----- .../common/WalletPreviewDataLegacy.kt | 16 +---- .../router/DefaultWalletRouter.kt | 10 +++ .../presentation/router/InnerWalletRouter.kt | 5 ++ .../state/model/ActionsBottomSheetConfig.kt | 13 ---- ...ButtonConfig.kt => TokenActionButtonUM.kt} | 8 ++- .../wallet/state/model/WalletDialogConfig.kt | 6 ++ .../MultiWalletCurrencyActionsConverter.kt | 18 +++-- .../presentation/wallet/ui/WalletScreen.kt | 2 - .../ui/components/TokenActionsBottomSheet.kt | 68 ------------------- 12 files changed, 119 insertions(+), 130 deletions(-) create mode 100644 features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/tokenActions/TokenActionsComponent.kt delete mode 100644 features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/ActionsBottomSheetConfig.kt rename features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/{TokenActionButtonConfig.kt => TokenActionButtonUM.kt} (76%) delete mode 100644 features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/TokenActionsBottomSheet.kt diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/tokenActions/TokenActionsComponent.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/tokenActions/TokenActionsComponent.kt new file mode 100644 index 0000000000..e994cb9f17 --- /dev/null +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/tokenActions/TokenActionsComponent.kt @@ -0,0 +1,63 @@ +package com.tangem.feature.wallet.child.tokenActions + +import androidx.compose.foundation.layout.Column +import androidx.compose.runtime.Composable +import com.tangem.core.decompose.context.AppComponentContext +import com.tangem.core.ui.components.SimpleSettingsRow +import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig +import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfigContent +import com.tangem.core.ui.components.bottomsheets.sheet.TangemBottomSheet +import com.tangem.core.ui.components.getDefaultRowColors +import com.tangem.core.ui.components.getWarningRowColors +import com.tangem.core.ui.decompose.ComposableBottomSheetComponent +import com.tangem.core.ui.extensions.resolveReference +import com.tangem.core.ui.res.TangemTheme +import com.tangem.feature.wallet.presentation.wallet.state.model.TokenActionButtonUM +import dagger.assisted.Assisted +import dagger.assisted.AssistedInject + +internal class TokenActionsComponent @AssistedInject constructor( + @Assisted appComponentContext: AppComponentContext, + @Assisted private val params: Params, +) : ComposableBottomSheetComponent, AppComponentContext by appComponentContext { + + override fun dismiss() { + params.onDismiss() + } + + @Composable + override fun BottomSheet() { + TangemBottomSheet( + containerColor = TangemTheme.colors.background.primary, + config = TangemBottomSheetConfig( + isShown = true, + onDismissRequest = ::dismiss, + content = TangemBottomSheetConfigContent.Empty, + ), + ) { + Column { + params.actions.forEach { action -> + if (action.isEnabled) { + val rowColors = if (action.isWarning) { + getWarningRowColors() + } else { + getDefaultRowColors() + } + SimpleSettingsRow( + title = action.text.resolveReference(), + icon = action.iconResId, + enabled = action.isEnabled, + rowColors = rowColors, + onItemsClick = action.onClick, + ) + } + } + } + } + } + + data class Params( + val actions: List, + val onDismiss: () -> Unit, + ) +} \ No newline at end of file diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/WalletComponent.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/WalletComponent.kt index 6bcf590744..f7c026a60f 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/WalletComponent.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/WalletComponent.kt @@ -21,6 +21,7 @@ import com.tangem.core.ui.decompose.ComposableBottomSheetComponent import com.tangem.core.ui.decompose.ComposableContentComponent import com.tangem.core.ui.decompose.ComposableDialogComponent import com.tangem.domain.tokens.model.details.TokenAction +import com.tangem.feature.wallet.child.tokenActions.TokenActionsComponent import com.tangem.feature.wallet.child.wallet.model.WalletModel import com.tangem.feature.wallet.navigation.WalletRoute import com.tangem.feature.wallet.presentation.wallet.state.model.WalletDialogConfig @@ -136,6 +137,15 @@ internal class WalletComponent @AssistedInject constructor( ), ) } + is WalletDialogConfig.TokenActionList -> { + TokenActionsComponent( + appComponentContext = childByContext(componentContext), + params = TokenActionsComponent.Params( + actions = dialogConfig.actionList, + onDismiss = model.innerWalletRouter.dialogNavigation::dismiss, + ), + ) + } } }, ) diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/WalletContentClickIntents.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/WalletContentClickIntents.kt index 9ccb19d1f6..8b1fd04f57 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/WalletContentClickIntents.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/WalletContentClickIntents.kt @@ -19,7 +19,6 @@ import com.tangem.domain.nft.analytics.NFTAnalyticsEvent import com.tangem.domain.settings.ShouldShowMarketsTooltipUseCase import com.tangem.domain.tokens.GetCryptoCurrencyActionsUseCase import com.tangem.domain.tokens.GetSingleCryptoCurrencyStatusUseCase -import com.tangem.domain.tokens.model.TokenActionsState import com.tangem.domain.tokens.model.details.NavigationAction import com.tangem.domain.txhistory.usecase.GetExplorerTransactionUrlUseCase import com.tangem.domain.wallets.usecase.GetUserWalletUseCase @@ -29,7 +28,6 @@ import com.tangem.feature.wallet.presentation.wallet.analytics.utils.TokenListAn import com.tangem.feature.wallet.presentation.wallet.domain.OnrampStatusFactory import com.tangem.feature.wallet.presentation.wallet.domain.unwrap import com.tangem.feature.wallet.presentation.wallet.state.WalletStateController -import com.tangem.feature.wallet.presentation.wallet.state.model.ActionsBottomSheetConfig import com.tangem.feature.wallet.presentation.wallet.state.model.WalletAlertUM import com.tangem.feature.wallet.presentation.wallet.state.model.WalletEvent import com.tangem.feature.wallet.presentation.wallet.state.model.WalletNFTItemUM @@ -142,8 +140,15 @@ internal class WalletContentClickIntentsImplementor @Inject constructor( getCryptoCurrencyActionsUseCase(userWallet = userWallet, cryptoCurrencyStatus = cryptoCurrencyStatus) .take(count = 1) - .collectLatest { - showActionsBottomSheet(it, userWallet, accountId) + .collectLatest { actionsState -> + router.openTokenActionSheet( + userWallet = userWallet, + tokenActionList = MultiWalletCurrencyActionsConverter( + userWallet = userWallet, + accountId = accountId, + clickIntents = currencyActionsClickIntents, + ).convert(actionsState), + ) } } } @@ -259,23 +264,6 @@ internal class WalletContentClickIntentsImplementor @Inject constructor( analyticsEventHandler.send(event) } - private fun showActionsBottomSheet( - tokenActionsState: TokenActionsState, - userWallet: UserWallet, - accountId: AccountId, - ) { - stateHolder.showBottomSheet( - ActionsBottomSheetConfig( - actions = MultiWalletCurrencyActionsConverter( - userWallet = userWallet, - accountId = accountId, - clickIntents = currencyActionsClickIntents, - ).convert(tokenActionsState), - ), - userWallet.walletId, - ) - } - override fun onTransactionClick(txHash: String) { modelScope.launch(dispatchers.main) { val currency = getSingleCryptoCurrencyStatusUseCase.unwrap( diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/common/WalletPreviewDataLegacy.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/common/WalletPreviewDataLegacy.kt index e613117202..626da24cb8 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/common/WalletPreviewDataLegacy.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/common/WalletPreviewDataLegacy.kt @@ -3,9 +3,10 @@ package com.tangem.feature.wallet.presentation.common import com.tangem.core.ui.extensions.TextReference import com.tangem.domain.models.wallet.UserWalletId import com.tangem.feature.wallet.impl.R -import com.tangem.feature.wallet.presentation.wallet.state.model.* +import com.tangem.feature.wallet.presentation.wallet.state.model.WalletAdditionalInfo +import com.tangem.feature.wallet.presentation.wallet.state.model.WalletCardState +import com.tangem.feature.wallet.presentation.wallet.state.model.WalletTopBarConfig import kotlinx.collections.immutable.persistentListOf -import kotlinx.collections.immutable.toImmutableList @Suppress("LargeClass") internal object WalletPreviewDataLegacy { @@ -54,15 +55,4 @@ internal object WalletPreviewDataLegacy { UserWalletId(stringValue = "24") to walletCardErrorState, ) } - - val actionsBottomSheet = ActionsBottomSheetConfig( - actions = listOf( - TokenActionButtonConfig( - text = TextReference.Str("Send"), - iconResId = R.drawable.ic_share_24, - isWarning = false, - onClick = {}, - ), - ).toImmutableList(), - ) } \ No newline at end of file diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/router/DefaultWalletRouter.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/router/DefaultWalletRouter.kt index ab2b53ed60..d4a58b4046 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/router/DefaultWalletRouter.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/router/DefaultWalletRouter.kt @@ -19,7 +19,9 @@ import com.tangem.domain.redux.StateDialog import com.tangem.domain.tokens.model.details.NavigationAction import com.tangem.domain.tokens.model.details.TokenAction import com.tangem.feature.wallet.navigation.WalletRoute +import com.tangem.feature.wallet.presentation.wallet.state.model.TokenActionButtonUM import com.tangem.feature.wallet.presentation.wallet.state.model.WalletDialogConfig +import kotlinx.collections.immutable.ImmutableList import kotlinx.coroutines.channels.BufferOverflow import kotlinx.coroutines.flow.MutableSharedFlow import javax.inject.Inject @@ -151,4 +153,12 @@ internal class DefaultWalletRouter @Inject constructor( ), ) } + + override fun openTokenActionSheet(userWallet: UserWallet, tokenActionList: ImmutableList) { + dialogNavigation.activate( + configuration = WalletDialogConfig.TokenActionList( + actionList = tokenActionList, + ), + ) + } } \ No newline at end of file diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/router/InnerWalletRouter.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/router/InnerWalletRouter.kt index 3e9f99185e..54a04de46c 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/router/InnerWalletRouter.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/router/InnerWalletRouter.kt @@ -14,7 +14,9 @@ import com.tangem.domain.pay.TangemPayDetailsConfig import com.tangem.domain.tokens.model.details.NavigationAction import com.tangem.domain.tokens.model.details.TokenAction import com.tangem.feature.wallet.navigation.WalletRoute +import com.tangem.feature.wallet.presentation.wallet.state.model.TokenActionButtonUM import com.tangem.feature.wallet.presentation.wallet.state.model.WalletDialogConfig +import kotlinx.collections.immutable.ImmutableList import kotlinx.coroutines.flow.SharedFlow /** @@ -81,4 +83,7 @@ internal interface InnerWalletRouter { /** Open yield supply entry screen */ fun openYieldSupplyEntryScreen(userWalletId: UserWalletId, cryptoCurrency: CryptoCurrency, apy: String) + + /** Open token action sheet */ + fun openTokenActionSheet(userWallet: UserWallet, tokenActionList: ImmutableList) } \ No newline at end of file diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/ActionsBottomSheetConfig.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/ActionsBottomSheetConfig.kt deleted file mode 100644 index 84ec1221bd..0000000000 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/ActionsBottomSheetConfig.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.tangem.feature.wallet.presentation.wallet.state.model - -import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfigContent -import kotlinx.collections.immutable.ImmutableList - -/** - * Config for the token actions bottom sheet - * - * @property actions actions - */ -internal data class ActionsBottomSheetConfig( - val actions: ImmutableList, -) : TangemBottomSheetConfigContent \ No newline at end of file diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/TokenActionButtonConfig.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/TokenActionButtonUM.kt similarity index 76% rename from features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/TokenActionButtonConfig.kt rename to features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/TokenActionButtonUM.kt index 12c3c648f1..1b678f372d 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/TokenActionButtonConfig.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/TokenActionButtonUM.kt @@ -2,6 +2,7 @@ package com.tangem.feature.wallet.presentation.wallet.state.model import androidx.annotation.DrawableRes import com.tangem.core.ui.extensions.TextReference +import kotlinx.serialization.Serializable /** * Action button config @@ -10,12 +11,13 @@ import com.tangem.core.ui.extensions.TextReference * @property iconResId icon resource id * @property onClick lambda be invoked when action component is clicked * @property isWarning if warning row - * @property enabled enabled + * @property isEnabled enabled */ -data class TokenActionButtonConfig( +@Serializable +data class TokenActionButtonUM( val text: TextReference, @DrawableRes val iconResId: Int, val onClick: () -> Unit, val isWarning: Boolean, - val enabled: Boolean = true, + val isEnabled: Boolean = true, ) \ No newline at end of file diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/WalletDialogConfig.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/WalletDialogConfig.kt index a482dc420f..e1144d4983 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/WalletDialogConfig.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/model/WalletDialogConfig.kt @@ -4,6 +4,7 @@ import com.tangem.domain.models.TokenReceiveConfig import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.wallet.UserWalletId import com.tangem.domain.tokens.model.details.TokenAction +import kotlinx.collections.immutable.ImmutableList import kotlinx.serialization.Serializable /** @@ -26,6 +27,11 @@ internal sealed interface WalletDialogConfig { @Serializable data class TokenReceive(val tokenReceiveConfig: TokenReceiveConfig) : WalletDialogConfig + @Serializable + data class TokenActionList( + val actionList: ImmutableList, + ) : WalletDialogConfig + @Serializable data class YieldSupplyWarning( val cryptoCurrency: CryptoCurrency, diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/MultiWalletCurrencyActionsConverter.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/MultiWalletCurrencyActionsConverter.kt index 0e3d985f61..4044cedde1 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/MultiWalletCurrencyActionsConverter.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/MultiWalletCurrencyActionsConverter.kt @@ -2,7 +2,6 @@ package com.tangem.feature.wallet.presentation.wallet.state.transformers.convert import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.extensions.resourceReference -import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.account.AccountId import com.tangem.domain.models.currency.CryptoCurrencyStatus import com.tangem.domain.models.wallet.UserWallet @@ -10,7 +9,8 @@ import com.tangem.domain.tokens.model.ScenarioUnavailabilityReason import com.tangem.domain.tokens.model.TokenActionsState import com.tangem.feature.wallet.child.wallet.model.intents.WalletCurrencyActionsClickIntents import com.tangem.feature.wallet.impl.R -import com.tangem.feature.wallet.presentation.wallet.state.model.TokenActionButtonConfig +import com.tangem.feature.wallet.presentation.wallet.state.model.TokenActionButtonUM +import com.tangem.feature.wallet.presentation.wallet.state.utils.isSingleWalletWithToken import com.tangem.utils.converter.Converter import com.tangem.utils.isNullOrZero import kotlinx.collections.immutable.ImmutableList @@ -20,9 +20,9 @@ internal class MultiWalletCurrencyActionsConverter( private val userWallet: UserWallet, private val accountId: AccountId, private val clickIntents: WalletCurrencyActionsClickIntents, -) : Converter> { +) : Converter> { - override fun convert(value: TokenActionsState): ImmutableList { + override fun convert(value: TokenActionsState): ImmutableList { return value.states .filterIfSingleWithToken() .mapNotNull { @@ -32,9 +32,7 @@ internal class MultiWalletCurrencyActionsConverter( } private fun List.filterIfSingleWithToken(): List { - return if (userWallet is UserWallet.Cold && - userWallet.scanResponse.cardTypesResolver.isSingleWalletWithToken() - ) { + return if (userWallet.isSingleWalletWithToken()) { filter { it !is TokenActionsState.ActionState.HideToken } } else { this @@ -45,7 +43,7 @@ internal class MultiWalletCurrencyActionsConverter( private fun mapTokenActionState( actionsState: TokenActionsState.ActionState, cryptoCurrencyStatus: CryptoCurrencyStatus, - ): TokenActionButtonConfig? { + ): TokenActionButtonUM? { if (actionsState is TokenActionsState.ActionState.Send && cryptoCurrencyStatus.value.amount.isNullOrZero()) { return null } @@ -112,12 +110,12 @@ internal class MultiWalletCurrencyActionsConverter( } } - return TokenActionButtonConfig( + return TokenActionButtonUM( text = title, iconResId = icon, onClick = action, isWarning = actionsState is TokenActionsState.ActionState.HideToken, - enabled = actionsState.unavailabilityReason == noneReason, + isEnabled = actionsState.unavailabilityReason == noneReason, ) } } \ No newline at end of file diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/WalletScreen.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/WalletScreen.kt index 114a71988b..a094c17794 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/WalletScreen.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/WalletScreen.kt @@ -73,7 +73,6 @@ import com.tangem.feature.wallet.presentation.common.preview.WalletScreenPreview import com.tangem.feature.wallet.presentation.common.preview.WalletScreenPreviewDataLegacy.walletScreenState import com.tangem.feature.wallet.presentation.wallet.state.model.* import com.tangem.feature.wallet.presentation.wallet.state.model.holder.TxHistoryStateHolder -import com.tangem.feature.wallet.presentation.wallet.ui.components.TokenActionsBottomSheet import com.tangem.feature.wallet.presentation.wallet.ui.components.WalletsList import com.tangem.feature.wallet.presentation.wallet.ui.components.common.* import com.tangem.feature.wallet.presentation.wallet.ui.components.multicurrency.nftCollections @@ -716,7 +715,6 @@ internal fun LazyListScope.nftCollections(state: WalletState, itemModifier: Modi private fun ShowBottomSheet(bottomSheetConfig: TangemBottomSheetConfig?) { if (bottomSheetConfig != null) { when (bottomSheetConfig.content) { - is ActionsBottomSheetConfig -> TokenActionsBottomSheet(config = bottomSheetConfig) is ChooseAddressBottomSheetConfig -> ChooseAddressBottomSheet(config = bottomSheetConfig) is ExpressStatusBottomSheetConfig -> ExpressStatusBottomSheet(config = bottomSheetConfig) } diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/TokenActionsBottomSheet.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/TokenActionsBottomSheet.kt deleted file mode 100644 index 6916bf40c8..0000000000 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/TokenActionsBottomSheet.kt +++ /dev/null @@ -1,68 +0,0 @@ -package com.tangem.feature.wallet.presentation.wallet.ui.components - -import android.content.res.Configuration -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Column -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.tooling.preview.PreviewParameter -import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider -import com.tangem.core.ui.components.SimpleSettingsRow -import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig -import com.tangem.core.ui.components.bottomsheets.sheet.TangemBottomSheet -import com.tangem.core.ui.components.getDefaultRowColors -import com.tangem.core.ui.components.getWarningRowColors -import com.tangem.core.ui.extensions.resolveReference -import com.tangem.core.ui.res.TangemTheme -import com.tangem.core.ui.res.TangemThemePreview -import com.tangem.feature.wallet.presentation.common.WalletPreviewDataLegacy -import com.tangem.feature.wallet.presentation.wallet.state.model.ActionsBottomSheetConfig -import com.tangem.feature.wallet.presentation.wallet.state.model.TokenActionButtonConfig -import kotlinx.collections.immutable.ImmutableList - -@Composable -internal fun TokenActionsBottomSheet(config: TangemBottomSheetConfig) { - TangemBottomSheet(config = config) { - ActionsBottomSheetContent(actions = it.actions) - } -} - -@Composable -private fun ActionsBottomSheetContent(actions: ImmutableList) { - Column(modifier = Modifier.background(TangemTheme.colors.background.primary)) { - actions.forEach { action -> - if (action.enabled) { - val rowColors = if (action.isWarning) { - getWarningRowColors() - } else { - getDefaultRowColors() - } - SimpleSettingsRow( - title = action.text.resolveReference(), - icon = action.iconResId, - enabled = action.enabled, - rowColors = rowColors, - onItemsClick = action.onClick, - ) - } - } - } -} - -@Preview -@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES) -@Composable -private fun ActionsBottomSheetContent_Light( - @PreviewParameter(ActionsBottomSheetContentConfigProvider::class) - config: ActionsBottomSheetConfig, -) { - TangemThemePreview { - // Use preview of content because ModalBottomSheet isn't supported in Preview mode - ActionsBottomSheetContent(actions = config.actions) - } -} - -private class ActionsBottomSheetContentConfigProvider : CollectionPreviewParameterProvider( - collection = listOf(WalletPreviewDataLegacy.actionsBottomSheet), -) \ No newline at end of file