diff --git a/core/res/src/main/res/values/strings.xml b/core/res/src/main/res/values/strings.xml
index 0f66cd5146..b72b7efbc3 100644
--- a/core/res/src/main/res/values/strings.xml
+++ b/core/res/src/main/res/values/strings.xml
@@ -900,6 +900,7 @@
**Add to your portfolio** to start buying, exchanging or receiving this asset
In your portfolio
Your portfolio
+ **Token not supported**. This token is currently not supported in the wallet
Market Pulse
Quick actions
Clear all
diff --git a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/details/DefaultMarketsTokenDetailsComponent.kt b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/details/DefaultMarketsTokenDetailsComponent.kt
index efbc99093b..a185cc8ed4 100644
--- a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/details/DefaultMarketsTokenDetailsComponent.kt
+++ b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/details/DefaultMarketsTokenDetailsComponent.kt
@@ -76,7 +76,7 @@ internal class DefaultMarketsTokenDetailsComponent(
}
private val portfolioBlockComponent: PortfolioBlockComponent? =
- if (updatedParams.shouldShowPortfolio && designFeatureToggles.isRedesignEnabled) {
+ if (designFeatureToggles.isRedesignEnabled) {
portfolioBlockComponentFactory.create(
context = child("portfolio_block"),
params = PortfolioBlockComponent.Params(token = updatedParams.token),
diff --git a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/details/portfolioblock/model/PortfolioBlockModel.kt b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/details/portfolioblock/model/PortfolioBlockModel.kt
index 6b5bb8bdef..d7e0019cea 100644
--- a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/details/portfolioblock/model/PortfolioBlockModel.kt
+++ b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/details/portfolioblock/model/PortfolioBlockModel.kt
@@ -47,7 +47,7 @@ internal class PortfolioBlockModel @Inject constructor(
) : Model() {
val state: StateFlow
- field = MutableStateFlow(PortfolioBlockUM.Loading)
+ field = MutableStateFlow(PortfolioBlockUM.Hidden)
val cryptoCurrencyIdState: StateFlow
field = MutableStateFlow(null)
@@ -86,7 +86,7 @@ internal class PortfolioBlockModel @Inject constructor(
private fun combineData(): Flow {
return availableNetworks.transformLatest { networks ->
if (networks.isEmpty()) {
- emit(PortfolioBlockUM.Hidden)
+ emit(PortfolioBlockUM.Unsupported(tokenIcon = tokenIcon))
} else {
emitAll(portfolioFlow().distinctUntilChanged())
}
@@ -145,7 +145,7 @@ internal class PortfolioBlockModel @Inject constructor(
onAddClick = { parentRouter?.openAddToPortfolioDirect() },
)
} else {
- PortfolioBlockUM.Hidden
+ PortfolioBlockUM.Unsupported(tokenIcon = tokenIcon)
}
}
diff --git a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/details/portfolioblock/ui/PortfolioBlock.kt b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/details/portfolioblock/ui/PortfolioBlock.kt
index 14cded09d0..22a447786c 100644
--- a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/details/portfolioblock/ui/PortfolioBlock.kt
+++ b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/details/portfolioblock/ui/PortfolioBlock.kt
@@ -43,12 +43,11 @@ import com.tangem.features.feed.impl.R
@Composable
internal fun PortfolioBlock(state: PortfolioBlockUM, modifier: Modifier = Modifier) {
- val isVisible = state is PortfolioBlockUM.AddToken || state is PortfolioBlockUM.Content
val screenHeightPx = with(LocalDensity.current) { LocalWindowSize.current.height.toPx() }
Box(modifier = modifier) {
AnimatedVisibility(
- visible = isVisible,
+ visible = state !is PortfolioBlockUM.Hidden,
enter = fadeIn(animationSpec = tween(durationMillis = 300)),
) {
TangemFade(
@@ -63,7 +62,7 @@ internal fun PortfolioBlock(state: PortfolioBlockUM, modifier: Modifier = Modifi
AnimatedVisibility(
modifier = Modifier.align(Alignment.BottomCenter),
- visible = isVisible,
+ visible = state !is PortfolioBlockUM.Hidden,
enter = fadeIn(animationSpec = tween(durationMillis = 300, easing = FastOutSlowInEasing)),
exit = fadeOut(animationSpec = tween(durationMillis = 300)),
) {
@@ -87,9 +86,8 @@ internal fun PortfolioBlock(state: PortfolioBlockUM, modifier: Modifier = Modifi
when (state) {
is PortfolioBlockUM.AddToken -> AddTokenBlock(state)
is PortfolioBlockUM.Content -> ContentBlock(state)
- is PortfolioBlockUM.Hidden,
- is PortfolioBlockUM.Loading,
- -> Unit
+ is PortfolioBlockUM.Unsupported -> UnsupportedTokenBlock(state.tokenIcon)
+ is PortfolioBlockUM.Hidden -> Unit
}
}
}
@@ -158,13 +156,19 @@ private fun AddTokenBlock(state: PortfolioBlockUM.AddToken, modifier: Modifier =
FloatingCard(modifier = modifier) {
Row(
modifier = Modifier
- .padding(TangemTheme.dimens2.x3)
+ .padding(
+ vertical = 12.dp,
+ horizontal = 16.dp,
+ )
.clickableSingle(onClick = state.onAddClick),
verticalAlignment = Alignment.CenterVertically,
) {
- CurrencyIcon(state.tokenIcon)
+ CurrencyIcon(
+ state = state.tokenIcon,
+ iconSize = 40.dp,
+ )
- SpacerW(TangemTheme.dimens2.x3)
+ SpacerW(8.dp)
Text(
text = formatAnnotatedWithBoldColor(
@@ -192,6 +196,39 @@ private fun AddTokenBlock(state: PortfolioBlockUM.AddToken, modifier: Modifier =
}
}
+@Composable
+private fun UnsupportedTokenBlock(icon: CurrencyIconState, modifier: Modifier = Modifier) {
+ FloatingCard(modifier = modifier) {
+ Row(
+ modifier = Modifier
+ .padding(
+ vertical = 12.dp,
+ horizontal = 16.dp,
+ )
+ .clickableSingle(onClick = {}), // just intercept
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ CurrencyIcon(
+ state = icon,
+ iconSize = 40.dp,
+ )
+
+ SpacerW(8.dp)
+
+ Text(
+ text = formatAnnotatedWithBoldColor(
+ rawString = stringResourceSafe(R.string.markets_portfolio_block_token_unsupported),
+ boldColor = TangemTheme.colors2.text.neutral.primary,
+ ),
+ style = TangemTheme.typography2.captionMedium12,
+ color = TangemTheme.colors2.text.neutral.secondary,
+ modifier = Modifier.weight(1f),
+ maxLines = 2,
+ )
+ }
+ }
+}
+
@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun FloatingCard(modifier: Modifier = Modifier, content: @Composable () -> Unit) {
diff --git a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/details/portfolioblock/ui/state/PortfolioBlockUM.kt b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/details/portfolioblock/ui/state/PortfolioBlockUM.kt
index 136a952189..620fe2084f 100644
--- a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/details/portfolioblock/ui/state/PortfolioBlockUM.kt
+++ b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/details/portfolioblock/ui/state/PortfolioBlockUM.kt
@@ -5,15 +5,14 @@ import com.tangem.core.ui.components.currency.icon.CurrencyIconState
import com.tangem.core.ui.extensions.TextReference
@Immutable
-internal sealed class PortfolioBlockUM {
+internal sealed interface PortfolioBlockUM {
- data object Loading : PortfolioBlockUM()
- data object Hidden : PortfolioBlockUM()
+ data object Hidden : PortfolioBlockUM
data class AddToken(
val tokenIcon: CurrencyIconState,
val onAddClick: () -> Unit,
- ) : PortfolioBlockUM()
+ ) : PortfolioBlockUM
data class Content(
val totalBalance: TextReference,
@@ -24,5 +23,9 @@ internal sealed class PortfolioBlockUM {
val isBalanceHidden: Boolean,
val onRowClick: () -> Unit,
val onAddFundsClick: () -> Unit,
- ) : PortfolioBlockUM()
+ ) : PortfolioBlockUM
+
+ data class Unsupported(
+ val tokenIcon: CurrencyIconState,
+ ) : PortfolioBlockUM
}
\ No newline at end of file