Updated on 2026-08-14
This commit is contained in:
parent
bea1d4c98b
commit
6a767c7d14
6 changed files with 18 additions and 27 deletions
|
|
@ -9,6 +9,9 @@ import kotlinx.collections.immutable.ImmutableList
|
|||
*/
|
||||
sealed interface TokenItemState {
|
||||
|
||||
/** Token id */
|
||||
val id: String
|
||||
|
||||
/** Token full name (name with symbol) */
|
||||
val fullName: String
|
||||
|
||||
|
|
@ -21,11 +24,13 @@ sealed interface TokenItemState {
|
|||
/**
|
||||
* Token item state that is available for read
|
||||
*
|
||||
* @property fullName token name
|
||||
* @property id token id
|
||||
* @property fullName token name
|
||||
* @property iconUrl token icon url
|
||||
* @property networks list of networks that is available for read
|
||||
*/
|
||||
data class ReadContent(
|
||||
override val id: String,
|
||||
override val fullName: String,
|
||||
override val iconUrl: String,
|
||||
override val networks: ImmutableList<NetworkItemState.ReadContent>,
|
||||
|
|
@ -34,18 +39,18 @@ sealed interface TokenItemState {
|
|||
/**
|
||||
* Token item state that is available for read and manage
|
||||
*
|
||||
* @property id token id
|
||||
* @property fullName token name
|
||||
* @property iconUrl token icon url
|
||||
* @property networks list of networks is available for read and edit
|
||||
* @property id token id
|
||||
* @property name token name
|
||||
* @property symbol token brief name
|
||||
*/
|
||||
data class ManageContent(
|
||||
override val id: String,
|
||||
override val fullName: String,
|
||||
override val iconUrl: String,
|
||||
override val networks: ImmutableList<NetworkItemState.ManageContent>,
|
||||
val id: String,
|
||||
val name: String,
|
||||
val symbol: String,
|
||||
) : TokenItemState
|
||||
|
|
|
|||
|
|
@ -37,9 +37,9 @@ internal fun BriefNetworksList(
|
|||
exit = fadeOut(),
|
||||
) {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(TangemTheme.dimens.spacing4)) {
|
||||
networks.forEach {
|
||||
key(NetworkItemState::name) {
|
||||
BriefNetworkItem(model = it)
|
||||
networks.forEach { network ->
|
||||
key(network.name + network.protocolName) {
|
||||
BriefNetworkItem(model = network)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +1,10 @@
|
|||
package com.tangem.tap.features.tokens.impl.presentation.ui
|
||||
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.expandVertically
|
||||
import androidx.compose.animation.fadeIn
|
||||
import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.animation.shrinkVertically
|
||||
import androidx.compose.animation.*
|
||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||
import androidx.compose.foundation.combinedClickable
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.RowScope
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.Switch
|
||||
import androidx.compose.material.SwitchDefaults
|
||||
import androidx.compose.material.Text
|
||||
|
|
@ -56,7 +45,7 @@ internal fun DetailedNetworksList(
|
|||
) {
|
||||
Column {
|
||||
networks.forEachIndexed { index, network ->
|
||||
key(network.name) {
|
||||
key(network.name + network.protocolName) {
|
||||
DetailedNetworkItem(token = token, network = network, isLastItem = networks.size - 1 == index)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ object TokenListPreviewData {
|
|||
|
||||
fun createReadToken(): TokenItemState.ReadContent {
|
||||
return TokenItemState.ReadContent(
|
||||
id = "1",
|
||||
fullName = "Tether (USDT)",
|
||||
iconUrl = "https://s3.eu-central-1.amazonaws.com/tangem.api/coins/large/tether.png",
|
||||
networks = createReadNetworksList(),
|
||||
|
|
|
|||
|
|
@ -5,12 +5,7 @@ import androidx.compose.animation.AnimatedVisibility
|
|||
import androidx.compose.animation.fadeIn
|
||||
import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.imePadding
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
|
|
@ -141,7 +136,7 @@ private fun TokensListContent(
|
|||
item { DifferentAddressesWarning() }
|
||||
}
|
||||
|
||||
items(items = tokens, key = TokenItemState::fullName) {
|
||||
items(items = tokens, key = TokenItemState::id) {
|
||||
it?.let { TokenItem(model = it) }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,6 +163,7 @@ internal class TokensListViewModel @Inject constructor(
|
|||
|
||||
private fun createReadTokenContent(token: Token): TokenItemState.ReadContent {
|
||||
return TokenItemState.ReadContent(
|
||||
id = token.id,
|
||||
fullName = getTokenFullName(token),
|
||||
iconUrl = token.iconUrl,
|
||||
networks = token.networks.map(::createReadNetworkContent).toImmutableList(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue