Updated on 2026-08-14

This commit is contained in:
Tangem 2023-08-09 17:12:38 +08:00
parent 2336c837cb
commit c266b4c8c6
17 changed files with 137 additions and 65 deletions

View file

@ -5,6 +5,7 @@ import com.tangem.core.ui.R
import com.tangem.core.ui.components.marketprice.MarketPriceBlockState
import com.tangem.core.ui.components.marketprice.PriceChangeConfig
import com.tangem.core.ui.components.transactions.TransactionState
import com.tangem.core.ui.extensions.TextReference
import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.feature.wallet.presentation.common.state.TokenItemState
import com.tangem.feature.wallet.presentation.common.state.TokenItemState.TokenOptionsState
@ -13,6 +14,7 @@ import com.tangem.feature.wallet.presentation.organizetokens.OrganizeTokensListS
import com.tangem.feature.wallet.presentation.organizetokens.OrganizeTokensStateHolder
import com.tangem.feature.wallet.presentation.wallet.state.*
import com.tangem.feature.wallet.presentation.wallet.state.components.*
import com.tangem.feature.wallet.presentation.wallet.state.components.WalletTokensListState.TokensListItemState
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toPersistentList
import kotlinx.coroutines.flow.flowOf
@ -260,8 +262,8 @@ internal object WalletPreviewData {
walletsListConfig = walletListConfig,
tokensListState = WalletTokensListState.Content(
persistentListOf(
WalletTokensListState.TokensListItemState.NetworkGroupTitle("Bitcoin"),
WalletTokensListState.TokensListItemState.Token(
TokensListItemState.NetworkGroupTitle(TextReference.Str("Bitcoin")),
TokensListItemState.Token(
tokenItemVisibleState.copy(
id = "token_1",
name = "Ethereum",
@ -270,7 +272,7 @@ internal object WalletPreviewData {
amount = "1,89340821 ETH",
),
),
WalletTokensListState.TokensListItemState.Token(
TokensListItemState.Token(
tokenItemVisibleState.copy(
id = "token_2",
name = "Ethereum",
@ -279,7 +281,7 @@ internal object WalletPreviewData {
amount = "1,89340821 ETH",
),
),
WalletTokensListState.TokensListItemState.Token(
TokensListItemState.Token(
tokenItemVisibleState.copy(
id = "token_3",
name = "Ethereum",
@ -288,7 +290,7 @@ internal object WalletPreviewData {
amount = "1,89340821 ETH",
),
),
WalletTokensListState.TokensListItemState.Token(
TokensListItemState.Token(
tokenItemVisibleState.copy(
id = "token_4",
name = "Ethereum",
@ -297,8 +299,8 @@ internal object WalletPreviewData {
amount = "1,89340821 ETH",
),
),
WalletTokensListState.TokensListItemState.NetworkGroupTitle("Ethereum"),
WalletTokensListState.TokensListItemState.Token(
TokensListItemState.NetworkGroupTitle(TextReference.Str("Ethereum")),
TokensListItemState.Token(
tokenItemVisibleState.copy(
id = "token_5",
name = "Ethereum",
@ -334,7 +336,7 @@ internal object WalletPreviewData {
onRefresh = {},
),
notifications = persistentListOf(WalletNotification.LikeTangemApp(onClick = {})),
buttons = manageButtons.map(WalletManageButton::config).toPersistentList(),
buttons = manageButtons,
bottomSheetConfig = bottomSheet,
marketPriceBlockState = MarketPriceBlockState.Content(
currencyName = "BTC",

View file

@ -1,6 +1,5 @@
package com.tangem.feature.wallet.presentation.wallet.state
import com.tangem.core.ui.components.buttons.actions.ActionButtonConfig
import com.tangem.core.ui.components.marketprice.MarketPriceBlockState
import com.tangem.feature.wallet.presentation.wallet.state.components.*
import kotlinx.collections.immutable.ImmutableList
@ -14,7 +13,7 @@ import kotlinx.collections.immutable.persistentListOf
internal sealed class WalletSingleCurrencyState : WalletStateHolder() {
/** Manage buttons */
abstract val buttons: ImmutableList<ActionButtonConfig>
abstract val buttons: ImmutableList<WalletManageButton>
/** Market price block state */
abstract val marketPriceBlockState: MarketPriceBlockState?
@ -29,7 +28,7 @@ internal sealed class WalletSingleCurrencyState : WalletStateHolder() {
override val pullToRefreshConfig: WalletPullToRefreshConfig,
override val notifications: ImmutableList<WalletNotification>,
override val bottomSheetConfig: WalletBottomSheetConfig?,
override val buttons: ImmutableList<ActionButtonConfig>,
override val buttons: ImmutableList<WalletManageButton>,
override val marketPriceBlockState: MarketPriceBlockState,
override val txHistoryState: WalletTxHistoryState,
) : WalletSingleCurrencyState()
@ -39,7 +38,7 @@ internal sealed class WalletSingleCurrencyState : WalletStateHolder() {
override val topBarConfig: WalletTopBarConfig,
override val walletsListConfig: WalletsListConfig,
override val pullToRefreshConfig: WalletPullToRefreshConfig,
override val buttons: ImmutableList<ActionButtonConfig>,
override val buttons: ImmutableList<WalletManageButton>,
override val onUnlockWalletsNotificationClick: () -> Unit,
override val onUnlockClick: () -> Unit,
override val onScanClick: () -> Unit,

View file

@ -13,16 +13,34 @@ import com.tangem.feature.wallet.impl.R
*/
sealed class WalletManageButton(val config: ActionButtonConfig) {
/** Lambda be invoked when manage button is clicked */
abstract val onClick: (() -> Unit)?
/**
* Buy
*
* @param onClick lambda be invoked when manage button is clicked
*/
data class Buy(val onClick: () -> Unit) : WalletManageButton(
data class Buy(override val onClick: (() -> Unit)? = null) : WalletManageButton(
config = ActionButtonConfig(
text = TextReference.Res(id = R.string.common_buy),
iconResId = R.drawable.ic_plus_24,
onClick = onClick,
onClick = onClick ?: {},
enabled = onClick != null,
),
)
/**
* Sell
*
* @param onClick lambda be invoked when manage button is clicked
*/
data class Sell(override val onClick: (() -> Unit)? = null) : WalletManageButton(
config = ActionButtonConfig(
text = TextReference.Res(id = R.string.common_sell),
iconResId = R.drawable.ic_currency_24,
onClick = onClick ?: {},
enabled = onClick != null,
),
)
@ -31,11 +49,12 @@ sealed class WalletManageButton(val config: ActionButtonConfig) {
*
* @param onClick lambda be invoked when manage button is clicked
*/
data class Send(val onClick: () -> Unit) : WalletManageButton(
data class Send(override val onClick: (() -> Unit)? = null) : WalletManageButton(
config = ActionButtonConfig(
text = TextReference.Res(id = R.string.common_send),
iconResId = R.drawable.ic_arrow_up_24,
onClick = onClick,
onClick = onClick ?: {},
enabled = onClick != null,
),
)
@ -44,7 +63,7 @@ sealed class WalletManageButton(val config: ActionButtonConfig) {
*
* @param onClick lambda be invoked when manage button is clicked
*/
data class Receive(val onClick: () -> Unit) : WalletManageButton(
data class Receive(override val onClick: () -> Unit) : WalletManageButton(
config = ActionButtonConfig(
text = TextReference.Res(id = R.string.common_receive),
iconResId = R.drawable.ic_arrow_down_24,
@ -57,11 +76,12 @@ sealed class WalletManageButton(val config: ActionButtonConfig) {
*
* @param onClick lambda be invoked when manage button is clicked
*/
data class Exchange(val onClick: () -> Unit) : WalletManageButton(
data class Exchange(override val onClick: (() -> Unit)? = null) : WalletManageButton(
config = ActionButtonConfig(
text = TextReference.Res(id = R.string.common_exchange),
iconResId = R.drawable.ic_exchange_vertical_24,
onClick = onClick,
onClick = onClick ?: {},
enabled = onClick != null,
),
)
@ -70,7 +90,7 @@ sealed class WalletManageButton(val config: ActionButtonConfig) {
*
* @param onClick lambda be invoked when manage button is clicked
*/
data class CopyAddress(val onClick: () -> Unit) : WalletManageButton(
data class CopyAddress(override val onClick: () -> Unit) : WalletManageButton(
config = ActionButtonConfig(
text = TextReference.Res(id = R.string.common_copy_address),
iconResId = R.drawable.ic_copy_24,

View file

@ -1,5 +1,7 @@
package com.tangem.feature.wallet.presentation.wallet.state.components
import com.tangem.core.ui.extensions.TextReference
import com.tangem.feature.wallet.impl.R
import com.tangem.feature.wallet.presentation.common.state.TokenItemState
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
@ -12,17 +14,26 @@ import kotlinx.collections.immutable.persistentListOf
*
[REDACTED_AUTHOR]
*/
// TODO: Finalize strings [REDACTED_JIRA]
internal sealed class WalletTokensListState(
open val items: ImmutableList<TokensListItemState>,
open val onOrganizeTokensClick: (() -> Unit)?,
) {
/** Loading content state */
object Loading : WalletTokensListState(
items = persistentListOf(
TokensListItemState.NetworkGroupTitle(value = TextReference.Res(id = R.string.main_tokens)),
TokensListItemState.Token(state = TokenItemState.Loading),
TokensListItemState.Token(state = TokenItemState.Loading),
),
onOrganizeTokensClick = null,
)
/**
* Content state
*
* @property items content items
* @property onOrganizeTokensClick lambda be invoked when organize tokens button is clicked
* @property items content items
* @property onOrganizeTokensClick lambda be invoked when organize tokens button is clicked
*/
data class Content(
override val items: ImmutableList<TokensListItemState>,
@ -33,7 +44,7 @@ internal sealed class WalletTokensListState(
object Locked :
WalletTokensListState(
items = persistentListOf(
TokensListItemState.NetworkGroupTitle(networkName = "Tokens"),
TokensListItemState.NetworkGroupTitle(value = TextReference.Res(id = R.string.main_tokens)),
TokensListItemState.Token(state = TokenItemState.Loading),
),
onOrganizeTokensClick = null,
@ -46,9 +57,9 @@ internal sealed class WalletTokensListState(
/**
* Network group title item
*
* @property networkName network name
* @property value network name
*/
data class NetworkGroupTitle(val networkName: String) : TokensListItemState
data class NetworkGroupTitle(val value: TextReference) : TokensListItemState
/**
* Token item

View file

@ -20,7 +20,38 @@ internal sealed interface WalletTxHistoryState {
sealed class ContentState(open val items: Flow<PagingData<TxHistoryItemState>>) : WalletTxHistoryState
/**
* Content state
* Loading state
*
* @property onExploreClick lambda be invoke when explore button was clicked
*/
data class Loading(val onExploreClick: () -> Unit) : ContentState(
items = flowOf(
PagingData.from(
listOf(
TxHistoryItemState.Title(onExploreClick = onExploreClick),
TxHistoryItemState.Transaction(state = TransactionState.Loading),
),
),
),
)
/**
* Wallet transaction history state with loading transactions
*
* @property itemsCount count of loading transactions
*/
data class ContentWithLoadingItems(val itemsCount: Int) : ContentState(
items = flowOf(
value = PagingData.from(
data = buildList(capacity = itemsCount) {
add(TxHistoryItemState.Transaction(state = TransactionState.Loading))
},
),
),
)
/**
* Wallet transaction history state with content
*
* @property items content items
*/

View file

@ -1,7 +1,6 @@
package com.tangem.feature.wallet.presentation.wallet.state.factory
import androidx.paging.PagingData
import com.tangem.core.ui.components.buttons.actions.ActionButtonConfig
import com.tangem.core.ui.components.marketprice.MarketPriceBlockState
import com.tangem.domain.common.CardTypesResolver
import com.tangem.domain.common.util.cardTypesResolver
@ -122,7 +121,7 @@ internal class WalletSkeletonStateConverter(
}
// TODO: [REDACTED_JIRA]
private fun getButtons(): ImmutableList<ActionButtonConfig> {
private fun getButtons(): ImmutableList<WalletManageButton> {
return persistentListOf(
WalletManageButton.Buy(onClick = {}),
WalletManageButton.Send(onClick = {}),
@ -130,8 +129,6 @@ internal class WalletSkeletonStateConverter(
WalletManageButton.Exchange(onClick = {}),
WalletManageButton.CopyAddress(onClick = {}),
)
.map(WalletManageButton::config)
.toImmutableList()
}
data class SkeletonModel(

View file

@ -3,13 +3,12 @@ package com.tangem.feature.wallet.presentation.wallet.state.factory
import androidx.paging.PagingData
import arrow.core.Either
import com.tangem.common.Provider
import com.tangem.core.ui.components.buttons.actions.ActionButtonConfig
import com.tangem.domain.common.CardTypesResolver
import com.tangem.domain.tokens.error.TokenListError
import com.tangem.domain.tokens.model.TokenList
import com.tangem.domain.txhistory.models.TxHistoryItem
import com.tangem.domain.txhistory.models.TxHistoryListError
import com.tangem.domain.txhistory.models.TxHistoryStateError
import com.tangem.domain.txhistory.models.TxHistoryItem
import com.tangem.domain.wallets.models.UserWallet
import com.tangem.feature.wallet.presentation.wallet.state.WalletLoading
import com.tangem.feature.wallet.presentation.wallet.state.WalletMultiCurrencyState
@ -24,7 +23,6 @@ import com.tangem.feature.wallet.presentation.wallet.state.factory.txhistory.Wal
import com.tangem.feature.wallet.presentation.wallet.viewmodels.WalletClickIntents
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList
import kotlinx.coroutines.flow.Flow
/**
@ -155,7 +153,7 @@ internal class WalletStateFactory(
}
// TODO: [REDACTED_JIRA]
private fun getButtons(): ImmutableList<ActionButtonConfig> {
private fun getButtons(): ImmutableList<WalletManageButton> {
return persistentListOf(
WalletManageButton.Buy(onClick = {}),
WalletManageButton.Send(onClick = {}),
@ -163,7 +161,5 @@ internal class WalletStateFactory(
WalletManageButton.Exchange(onClick = {}),
WalletManageButton.CopyAddress(onClick = {}),
)
.map(WalletManageButton::config)
.toImmutableList()
}
}

View file

@ -3,11 +3,10 @@ package com.tangem.feature.wallet.presentation.wallet.state.factory.txhistory
import androidx.paging.PagingData
import arrow.core.Either
import com.tangem.common.Provider
import com.tangem.core.ui.components.buttons.actions.ActionButtonConfig
import com.tangem.core.ui.components.marketprice.MarketPriceBlockState
import com.tangem.domain.common.CardTypesResolver
import com.tangem.domain.txhistory.models.TxHistoryListError
import com.tangem.domain.txhistory.models.TxHistoryItem
import com.tangem.domain.txhistory.models.TxHistoryListError
import com.tangem.feature.wallet.presentation.wallet.state.WalletSingleCurrencyState
import com.tangem.feature.wallet.presentation.wallet.state.WalletStateHolder
import com.tangem.feature.wallet.presentation.wallet.state.components.WalletManageButton
@ -16,7 +15,6 @@ import com.tangem.feature.wallet.presentation.wallet.viewmodels.WalletClickInten
import com.tangem.utils.converter.Converter
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList
import kotlinx.coroutines.flow.Flow
/**
@ -78,7 +76,7 @@ internal class WalletLoadedTxHistoryConverter(
}
// TODO: [REDACTED_JIRA]
private fun getButtons(): ImmutableList<ActionButtonConfig> {
private fun getButtons(): ImmutableList<WalletManageButton> {
return persistentListOf(
WalletManageButton.Buy(onClick = {}),
WalletManageButton.Send(onClick = {}),
@ -86,8 +84,6 @@ internal class WalletLoadedTxHistoryConverter(
WalletManageButton.Exchange(onClick = {}),
WalletManageButton.CopyAddress(onClick = {}),
)
.map(WalletManageButton::config)
.toImmutableList()
}
private fun getLoadingMarketPriceBlockState(): MarketPriceBlockState {

View file

@ -3,7 +3,6 @@ package com.tangem.feature.wallet.presentation.wallet.state.factory.txhistory
import androidx.paging.PagingData
import arrow.core.Either
import com.tangem.common.Provider
import com.tangem.core.ui.components.buttons.actions.ActionButtonConfig
import com.tangem.core.ui.components.marketprice.MarketPriceBlockState
import com.tangem.core.ui.components.transactions.TransactionState
import com.tangem.domain.common.CardTypesResolver
@ -16,7 +15,6 @@ import com.tangem.feature.wallet.presentation.wallet.viewmodels.WalletClickInten
import com.tangem.utils.converter.Converter
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList
import kotlinx.coroutines.flow.flowOf
/**
@ -85,7 +83,7 @@ internal class WalletLoadingTxHistoryConverter(
}
// TODO: [REDACTED_JIRA]
private fun getButtons(): ImmutableList<ActionButtonConfig> {
private fun getButtons(): ImmutableList<WalletManageButton> {
return persistentListOf(
WalletManageButton.Buy(onClick = {}),
WalletManageButton.Send(onClick = {}),
@ -93,8 +91,6 @@ internal class WalletLoadingTxHistoryConverter(
WalletManageButton.Exchange(onClick = {}),
WalletManageButton.CopyAddress(onClick = {}),
)
.map(WalletManageButton::config)
.toImmutableList()
}
private fun getLoadingMarketPriceBlockState(): MarketPriceBlockState {

View file

@ -46,7 +46,12 @@ internal fun WalletsList(config: WalletsListConfig, lazyListState: LazyListState
flingBehavior = rememberSnapFlingBehavior(lazyListState = lazyListState),
) {
items(items = config.wallets, key = { it.id.stringValue }) { state ->
WalletCard(state = state, modifier = Modifier.width(itemWidth))
WalletCard(
state = state,
modifier = Modifier
.animateItemPlacement()
.width(itemWidth),
)
}
}
}

View file

@ -1,5 +1,6 @@
package com.tangem.feature.wallet.presentation.wallet.ui.components.multicurrency
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.ui.Modifier
@ -14,6 +15,7 @@ import com.tangem.feature.wallet.presentation.wallet.ui.decorations.walletConten
*
[REDACTED_AUTHOR]
*/
@OptIn(ExperimentalFoundationApi::class)
internal fun LazyListScope.tokensListItems(state: WalletTokensListState, modifier: Modifier = Modifier) {
itemsIndexed(
items = state.items,
@ -21,10 +23,12 @@ internal fun LazyListScope.tokensListItems(state: WalletTokensListState, modifie
itemContent = { index, item ->
MultiCurrencyContentItem(
state = item,
modifier = modifier.walletContentItemDecoration(
currentIndex = index,
lastIndex = state.items.lastIndex,
),
modifier = modifier
.animateItemPlacement()
.walletContentItemDecoration(
currentIndex = index,
lastIndex = state.items.lastIndex,
),
)
},
)

View file

@ -2,6 +2,7 @@ package com.tangem.feature.wallet.presentation.wallet.ui.components.multicurrenc
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.tangem.core.ui.extensions.resolveReference
import com.tangem.feature.wallet.presentation.common.component.NetworkGroupItem
import com.tangem.feature.wallet.presentation.common.component.TokenItem
import com.tangem.feature.wallet.presentation.wallet.state.components.WalletTokensListState
@ -18,7 +19,7 @@ import com.tangem.feature.wallet.presentation.wallet.state.components.WalletToke
internal fun MultiCurrencyContentItem(state: WalletTokensListState.TokensListItemState, modifier: Modifier = Modifier) {
when (state) {
is WalletTokensListState.TokensListItemState.NetworkGroupTitle -> {
NetworkGroupItem(networkName = state.networkName, modifier = modifier)
NetworkGroupItem(networkName = state.value.resolveReference(), modifier = modifier)
}
is WalletTokensListState.TokensListItemState.Token -> {
TokenItem(state = state.state, modifier = modifier)

View file

@ -1,5 +1,6 @@
package com.tangem.feature.wallet.presentation.wallet.ui.components.multicurrency
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.ui.Modifier
@ -11,6 +12,7 @@ import androidx.compose.ui.Modifier
*
[REDACTED_AUTHOR]
*/
@OptIn(ExperimentalFoundationApi::class)
internal fun LazyListScope.organizeButton(onClick: (() -> Unit)?, modifier: Modifier = Modifier) {
item { OrganizeTokensButton(onClick = onClick, modifier = modifier) }
item { OrganizeTokensButton(onClick = onClick, modifier = modifier.animateItemPlacement()) }
}

View file

@ -1,5 +1,6 @@
package com.tangem.feature.wallet.presentation.wallet.ui.components.singlecurrency
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyListScope
@ -52,6 +53,7 @@ internal fun LazyListScope.txHistoryItems(
}
}
@OptIn(ExperimentalFoundationApi::class)
private fun LazyListScope.contentItems(
txHistoryItems: LazyPagingItems<WalletTxHistoryState.TxHistoryItemState>,
modifier: Modifier = Modifier,
@ -64,20 +66,24 @@ private fun LazyListScope.contentItems(
SingleCurrencyContentItem(
state = item,
modifier = modifier.walletContentItemDecoration(
currentIndex = index,
lastIndex = txHistoryItems.itemSnapshotList.lastIndex,
),
modifier = modifier
.animateItemPlacement()
.walletContentItemDecoration(
currentIndex = index,
lastIndex = txHistoryItems.itemSnapshotList.lastIndex,
),
)
},
)
}
@OptIn(ExperimentalFoundationApi::class)
private fun LazyListScope.nonContentItem(state: EmptyTransactionsBlockState, modifier: Modifier = Modifier) {
item {
EmptyTransactionBlock(
state = state,
modifier = modifier
.animateItemPlacement()
.padding(horizontal = TangemTheme.dimens.spacing16, vertical = TangemTheme.dimens.spacing12)
.fillMaxWidth(),
)

View file

@ -1,12 +1,14 @@
package com.tangem.feature.wallet.presentation.wallet.ui.components.singlecurrency
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.ui.Modifier
import com.tangem.core.ui.components.buttons.HorizontalActionChips
import com.tangem.core.ui.components.buttons.actions.ActionButtonConfig
import com.tangem.core.ui.res.TangemTheme
import com.tangem.feature.wallet.presentation.wallet.state.components.WalletManageButton
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList
/**
* Single currency control buttons. Like, "Buy", "Sell", etc
@ -16,11 +18,12 @@ import kotlinx.collections.immutable.ImmutableList
*
[REDACTED_AUTHOR]
*/
internal fun LazyListScope.controlButtons(configs: ImmutableList<ActionButtonConfig>, modifier: Modifier = Modifier) {
@OptIn(ExperimentalFoundationApi::class)
internal fun LazyListScope.controlButtons(configs: ImmutableList<WalletManageButton>, modifier: Modifier = Modifier) {
item {
HorizontalActionChips(
buttons = configs,
modifier = modifier,
buttons = configs.map(WalletManageButton::config).toImmutableList(),
modifier = modifier.animateItemPlacement(),
contentPadding = PaddingValues(horizontal = TangemTheme.dimens.spacing16),
)
}

View file

@ -1,5 +1,6 @@
package com.tangem.feature.wallet.presentation.wallet.ui.components.singlecurrency
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.ui.Modifier
import com.tangem.core.ui.components.marketprice.MarketPriceBlock
@ -13,6 +14,7 @@ import com.tangem.core.ui.components.marketprice.MarketPriceBlockState
*
[REDACTED_AUTHOR]
*/
@OptIn(ExperimentalFoundationApi::class)
internal fun LazyListScope.marketPriceBlock(state: MarketPriceBlockState, modifier: Modifier = Modifier) {
item { MarketPriceBlock(state = state, modifier = modifier) }
item { MarketPriceBlock(state = state, modifier = modifier.animateItemPlacement()) }
}

View file

@ -1,5 +1,6 @@
package com.tangem.feature.wallet.presentation.wallet.utils
import com.tangem.core.ui.extensions.TextReference
import com.tangem.domain.tokens.model.CryptoCurrencyStatus
import com.tangem.domain.tokens.model.NetworkGroup
import com.tangem.domain.tokens.model.TokenList
@ -53,7 +54,7 @@ internal class TokenListToContentItemsConverter(
}
private fun MutableList<TokensListItemState>.addGroup(group: NetworkGroup): List<TokensListItemState> {
this.add(TokensListItemState.NetworkGroupTitle(group.network.name))
this.add(TokensListItemState.NetworkGroupTitle(TextReference.Str(group.network.name)))
group.currencies.forEach { token ->
this.addToken(token)