Updated on 2026-08-14

This commit is contained in:
Tangem 2026-06-05 12:35:03 +05:00
parent c637c9a194
commit 0b3914cf6a
29 changed files with 453 additions and 37 deletions

View file

@ -66,6 +66,12 @@ fun AccountIcon(
fun AccountIcon(name: TextReference, icon: AccountIconUM, size: AccountIconSize, modifier: Modifier = Modifier) {
when (icon) {
is AccountIconUM.Payment -> PaymentAccountIcon(size = size, modifier = modifier)
is AccountIconUM.Virtual -> AccountResIcon(
resId = icon.icon.getResId(),
color = icon.color.getUiColor(),
size = size,
modifier = modifier,
)
is AccountIconUM.CryptoPortfolio -> AccountIcon(
name = name,
icon = icon,

View file

@ -7,4 +7,9 @@ sealed class AccountIconUM {
data class CryptoPortfolio(val value: Icon, val color: Color) : AccountIconUM()
data object Payment : AccountIconUM()
data object Virtual : AccountIconUM() {
val icon: Icon = Icon.Safe
val color: Color = Color.VitalGreen
}
}

View file

@ -90,6 +90,10 @@ private fun PreviewAccountTitle() {
accountTitleUM = AccountTitleUM.Account.payment(prefixText = stringReference(StringsSigns.DOT)),
modifier = Modifier.padding(4.dp),
)
AccountTitle(
accountTitleUM = AccountTitleUM.Account.virtual(prefixText = stringReference(StringsSigns.DOT)),
modifier = Modifier.padding(4.dp),
)
}
}
}

View file

@ -4,6 +4,7 @@ import androidx.compose.runtime.Immutable
import com.tangem.common.ui.R
import com.tangem.core.ui.extensions.TextReference
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.extensions.stringReference
/**
* A sealed interface representing the title of an account, which can be either a simple text
@ -31,6 +32,14 @@ sealed interface AccountTitleUM {
icon = AccountIconUM.Payment,
)
}
fun virtual(prefixText: TextReference = TextReference.EMPTY): Account {
return Account(
prefixText = prefixText,
name = stringReference("Virtual account"),
icon = AccountIconUM.Virtual,
)
}
}
}
}

View file

@ -31,6 +31,7 @@ class AmountAccountConverter(
return when (account) {
is Account.CryptoPortfolio -> CryptoPortfolioIconConverter.convert(account.icon)
is Account.Payment -> AccountIconUM.Payment
is Account.Virtual -> AccountIconUM.Virtual
}
}
}