Updated on 2026-08-14
This commit is contained in:
parent
c637c9a194
commit
0b3914cf6a
29 changed files with 453 additions and 37 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
@ -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),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue