Updated on 2026-08-14

This commit is contained in:
Tangem 2023-07-19 16:08:15 +05:00
parent 5f1a5494dc
commit 9e7e5f0157
4 changed files with 23 additions and 1 deletions

View file

@ -1,6 +1,8 @@
package com.tangem.feature.tokendetails.presentation.tokendetails
import com.tangem.core.ui.components.buttons.actions.ActionButtonConfig
import com.tangem.core.ui.components.marketprice.MarketPriceBlockState
import com.tangem.core.ui.components.marketprice.PriceChangeConfig
import com.tangem.feature.tokendetails.presentation.tokendetails.state.TokenDetailsBalanceBlockState
import com.tangem.feature.tokendetails.presentation.tokendetails.state.TokenDetailsState
import com.tangem.feature.tokendetails.presentation.tokendetails.state.TokenDetailsTopAppBarConfig
@ -71,9 +73,21 @@ internal object TokenDetailsPreviewData {
)
val balanceError = TokenDetailsBalanceBlockState.Error(actionButtons = disabledActionButtons)
val marketPriceContent = MarketPriceBlockState.Content(
currencyName = "USDT",
price = "98900 $",
priceChangeConfig = PriceChangeConfig(
valueInPercent = "10.89%",
type = PriceChangeConfig.Type.UP,
),
)
private val marketPriceLoading = MarketPriceBlockState.Loading(currencyName = "USDT")
val tokenDetailsState = TokenDetailsState(
topAppBarConfig = tokenDetailsTopAppBarConfig,
tokenInfoBlockState = tokenInfoBlockState,
tokenBalanceBlockState = balanceLoading,
marketPriceBlockState = marketPriceLoading,
)
}

View file

@ -1,7 +1,10 @@
package com.tangem.feature.tokendetails.presentation.tokendetails.state
import com.tangem.core.ui.components.marketprice.MarketPriceBlockState
data class TokenDetailsState(
val topAppBarConfig: TokenDetailsTopAppBarConfig,
val tokenInfoBlockState: TokenInfoBlockState,
val tokenBalanceBlockState: TokenDetailsBalanceBlockState,
val marketPriceBlockState: MarketPriceBlockState,
)

View file

@ -8,6 +8,7 @@ import androidx.compose.material3.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.tangem.core.ui.components.marketprice.MarketPriceBlock
import com.tangem.core.ui.res.TangemTheme
import com.tangem.feature.tokendetails.presentation.tokendetails.TokenDetailsPreviewData
import com.tangem.feature.tokendetails.presentation.tokendetails.state.TokenDetailsState
@ -30,6 +31,7 @@ internal fun TokenDetailsScreen(state: TokenDetailsState) {
) {
TokenInfoBlock(state = state.tokenInfoBlockState)
TokenDetailsBalanceBlock(state = state.tokenBalanceBlockState)
MarketPriceBlock(state = state.marketPriceBlockState)
}
}
}

View file

@ -27,7 +27,10 @@ internal class TokenDetailsViewModel @Inject constructor() : ViewModel() {
// simulate loading state
viewModelScope.launch {
delay(LOADING_DELAY)
uiState = uiState.copy(tokenBalanceBlockState = TokenDetailsPreviewData.balanceContent)
uiState = uiState.copy(
tokenBalanceBlockState = TokenDetailsPreviewData.balanceContent,
marketPriceBlockState = TokenDetailsPreviewData.marketPriceContent,
)
}
}