Updated on 2026-08-14

This commit is contained in:
Tangem 2026-03-02 16:53:46 +03:00
parent 09f1669029
commit 81ef606a43
21 changed files with 283 additions and 157 deletions

View file

@ -0,0 +1,31 @@
package com.tangem.common.ui.account
import com.tangem.core.ui.components.token.state.TokenItemState
import com.tangem.core.ui.components.tokenlist.state.PortfolioItemContentUM
import com.tangem.core.ui.components.tokenlist.state.PortfolioTokensListItemUM
import com.tangem.core.ui.components.tokenlist.state.TokensListItemUM
import com.tangem.utils.converter.Converter
import kotlinx.collections.immutable.ImmutableList
class TokensListPortfolioItemConverter(
val tokenItemUM: TokenItemState,
val isExpanded: Boolean,
val isCollapsable: Boolean,
val tokens: ImmutableList<PortfolioTokensListItemUM>,
val onEmptyAction: PortfolioItemContentUM.Empty.Action? = null,
) : Converter<Unit, TokensListItemUM.Portfolio> {
override fun convert(value: Unit): TokensListItemUM.Portfolio {
val content = if (tokens.isEmpty()) {
PortfolioItemContentUM.Empty(onEmptyAction)
} else {
PortfolioItemContentUM.Tokens(tokens)
}
return TokensListItemUM.Portfolio(
tokenItemUM = tokenItemUM,
isExpanded = isExpanded,
isCollapsable = isCollapsable,
content = content,
)
}
}