Updated on 2026-08-14
This commit is contained in:
parent
aa19739725
commit
6c396362e4
12 changed files with 284 additions and 69 deletions
|
|
@ -62,6 +62,7 @@
|
|||
<string name="common_done">Готово</string>
|
||||
<string name="common_enable">Включить</string>
|
||||
<string name="common_enabled">Включено</string>
|
||||
<string name="common_explorer">Обозреватель</string>
|
||||
<string name="common_no">Нет</string>
|
||||
<string name="common_ok">Ок</string>
|
||||
<string name="common_origin_card">Основная карта</string>
|
||||
|
|
@ -77,6 +78,7 @@
|
|||
<string name="common_success">Успешно</string>
|
||||
<string name="common_swap">Обмен</string>
|
||||
<string name="common_terms_and_conditions">условия участия</string>
|
||||
<string name="common_transactions">Транзакции</string>
|
||||
<string name="common_transfer">Перевод</string>
|
||||
<string name="common_understand">Я понял</string>
|
||||
<string name="common_yes">Да</string>
|
||||
|
|
@ -417,9 +419,11 @@
|
|||
<item quantity="many">%d токенов</item>
|
||||
<item quantity="other">%d токенов</item>
|
||||
</plurals>
|
||||
<string name="transaction_history_contract_address">контракт: %s</string>
|
||||
<string name="transaction_history_empty_transactions">У вас еще нет транзакций</string>
|
||||
<string name="transaction_history_error_failed_to_load">Не удалось загрузить транзакции</string>
|
||||
<string name="transaction_history_title">Транзакции</string>
|
||||
<string name="transaction_history_error_failed_to_load">Не удалось загрузить историю транзакций.\nНажмите на кнопку перезагрузки, чтобы обновить информацию.</string>
|
||||
<string name="transaction_history_not_supported_description">История транзакций в настоящее время не поддерживается для этого блокчейна. Но не волнуйтесь, мы работаем над этим! А пока вы можете проверить ее в обозревателе.</string>
|
||||
<string name="transaction_history_transaction_from_address">от: %s</string>
|
||||
<string name="transaction_history_tx_in_progress">В процессе…</string>
|
||||
<string name="twin_error_same_card">Вы отсканировали ту же карту. Для создания twin-кошелька вам необходимо отсканировать карту с номером %d</string>
|
||||
<string name="twins_onboarding_description_format">Это карта, которую вы держите в руках. У парной карты номер %s.\n\nОбе карты можно использовать для вывода средств из этого кошелька.</string>
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@
|
|||
<string name="common_done">完成</string>
|
||||
<string name="common_enable">允許</string>
|
||||
<string name="common_enabled">啟用</string>
|
||||
<string name="common_exchange">交易</string>
|
||||
<string name="common_no">否</string>
|
||||
<string name="common_ok">OK</string>
|
||||
<string name="common_origin_card">主卡片</string>
|
||||
|
|
@ -71,6 +72,7 @@
|
|||
<string name="common_success">成功</string>
|
||||
<string name="common_swap">交換</string>
|
||||
<string name="common_terms_and_conditions">條款和條件</string>
|
||||
<string name="common_transactions">交易</string>
|
||||
<string name="common_understand">我了解</string>
|
||||
<string name="common_yes">是</string>
|
||||
<string name="contract_address_copied_message">已複製代幣地址</string>
|
||||
|
|
@ -392,7 +394,6 @@
|
|||
</plurals>
|
||||
<string name="transaction_history_empty_transactions">您還沒有任何交易</string>
|
||||
<string name="transaction_history_error_failed_to_load">無法加載交易</string>
|
||||
<string name="transaction_history_title">交易</string>
|
||||
<string name="transaction_history_tx_in_progress">進行中…</string>
|
||||
<string name="twin_error_same_card">您掃描了同一張卡片。要創建雙錢包,您需要掃描編號為 %d 的卡</string>
|
||||
<string name="twins_onboarding_description_format">這一個是你手裡拿著的,另一個是編號為 %s 的,這兩張卡都可以用來從這個錢包中提取資金</string>
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@
|
|||
<string name="common_done">Done</string>
|
||||
<string name="common_enable">Enable</string>
|
||||
<string name="common_enabled">Enabled</string>
|
||||
<string name="common_explorer">Explorer</string>
|
||||
<string name="common_no">No</string>
|
||||
<string name="common_ok">OK</string>
|
||||
<string name="common_origin_card">Primary Card</string>
|
||||
|
|
@ -75,6 +76,7 @@
|
|||
<string name="common_success">Success</string>
|
||||
<string name="common_swap">Swap</string>
|
||||
<string name="common_terms_and_conditions">terms and conditions</string>
|
||||
<string name="common_transactions">Transactions</string>
|
||||
<string name="common_transfer">Transfer</string>
|
||||
<string name="common_understand">I understand</string>
|
||||
<string name="common_yes">Yes</string>
|
||||
|
|
@ -409,9 +411,12 @@
|
|||
<item quantity="one">%d token</item>
|
||||
<item quantity="other">%d tokens</item>
|
||||
</plurals>
|
||||
<string name="transaction_history_contract_address">contract: %s</string>
|
||||
<string name="transaction_history_empty_transactions">You don\'t have any transactions yet</string>
|
||||
<string name="transaction_history_error_failed_to_load">Failed to load transactions</string>
|
||||
<string name="transaction_history_title">Transactions</string>
|
||||
<string name="transaction_history_error_failed_to_load">Failed to load transaction history.\nClick on reload button to update the information.</string>
|
||||
<string name="transaction_history_not_supported_description">Transaction history is currently not supported for this blockchain. But don\'t worry, we\'re working on it! In the meantime you can check it in the explorer.</string>
|
||||
<string name="transaction_history_transaction_from_address">from: %s</string>
|
||||
<string name="transaction_history_transaction_to_address">to: %s</string>
|
||||
<string name="transaction_history_tx_in_progress">In progress…</string>
|
||||
<string name="twin_error_same_card">You\'ve scanned the same card. To create a twin wallet you need to scan the card with number %d</string>
|
||||
<string name="twins_onboarding_description_format">This one that you are holding in your hands and the other one with number %s.\n\nBoth cards can be used to extract funds from this wallet.</string>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@ import com.tangem.core.ui.res.TangemTheme
|
|||
/**
|
||||
* Transaction component
|
||||
*
|
||||
* @param state state
|
||||
* @param state state
|
||||
* @param modifier modifier
|
||||
*
|
||||
* @see <a href = "https://www.figma.com/file/RU7AIgwHtGdMfy83T5UOoR/iOS?type=design&node-id=446-438&t=71jPDxMMk4e0
|
||||
* a025-4">Figma Component</a>
|
||||
|
|
@ -34,9 +35,9 @@ import com.tangem.core.ui.res.TangemTheme
|
|||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
@Composable
|
||||
fun Transaction(state: TransactionState) {
|
||||
fun Transaction(state: TransactionState, modifier: Modifier = Modifier) {
|
||||
Surface(
|
||||
modifier = Modifier
|
||||
modifier = modifier
|
||||
.background(TangemTheme.colors.background.primary)
|
||||
.defaultMinSize(minHeight = TangemTheme.dimens.size56)
|
||||
.padding(horizontal = TangemTheme.dimens.spacing12, vertical = TangemTheme.dimens.spacing10),
|
||||
|
|
@ -212,14 +213,26 @@ private fun Subtitle(state: TransactionState, modifier: Modifier = Modifier) {
|
|||
is TransactionState.Content -> {
|
||||
Text(
|
||||
text = when (state) {
|
||||
is TransactionState.Sending -> "to: ${state.address}"
|
||||
is TransactionState.Send -> "to: ${state.address}"
|
||||
is TransactionState.Receiving -> "from: ${state.address}"
|
||||
is TransactionState.Receive -> "from: ${state.address}"
|
||||
is TransactionState.Approving -> "from: ${state.address}"
|
||||
is TransactionState.Approved -> "from: ${state.address}"
|
||||
is TransactionState.Swapping -> "contract: ${state.address}"
|
||||
is TransactionState.Swapped -> "contract ${state.address}"
|
||||
is TransactionState.Sending,
|
||||
is TransactionState.Send,
|
||||
-> stringResource(
|
||||
id = R.string.transaction_history_transaction_to_address,
|
||||
state.address,
|
||||
)
|
||||
is TransactionState.Receiving,
|
||||
is TransactionState.Receive,
|
||||
is TransactionState.Approving,
|
||||
is TransactionState.Approved,
|
||||
-> stringResource(
|
||||
id = R.string.transaction_history_transaction_from_address,
|
||||
state.address,
|
||||
)
|
||||
is TransactionState.Swapping,
|
||||
is TransactionState.Swapped,
|
||||
-> stringResource(
|
||||
id = R.string.transaction_history_contract_address,
|
||||
state.address,
|
||||
)
|
||||
},
|
||||
modifier = modifier,
|
||||
textAlign = TextAlign.Start,
|
||||
|
|
|
|||
9
core/ui/src/main/res/drawable/ic_compass_24.xml
Normal file
9
core/ui/src/main/res/drawable/ic_compass_24.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M7,17L10.2,10.2L17,7L13.8,13.8L7,17ZM12,11.1C11.761,11.1 11.532,11.195 11.364,11.364C11.195,11.532 11.1,11.761 11.1,12C11.1,12.239 11.195,12.468 11.364,12.636C11.532,12.805 11.761,12.9 12,12.9C12.239,12.9 12.468,12.805 12.636,12.636C12.805,12.468 12.9,12.239 12.9,12C12.9,11.761 12.805,11.532 12.636,11.364C12.468,11.195 12.239,11.1 12,11.1ZM12,2C13.313,2 14.614,2.259 15.827,2.761C17.04,3.264 18.142,4 19.071,4.929C20,5.858 20.736,6.96 21.239,8.173C21.741,9.386 22,10.687 22,12C22,14.652 20.946,17.196 19.071,19.071C17.196,20.946 14.652,22 12,22C10.687,22 9.386,21.741 8.173,21.239C6.96,20.736 5.858,20 4.929,19.071C3.054,17.196 2,14.652 2,12C2,9.348 3.054,6.804 4.929,4.929C6.804,3.054 9.348,2 12,2ZM12,4C9.878,4 7.843,4.843 6.343,6.343C4.843,7.843 4,9.878 4,12C4,14.122 4.843,16.157 6.343,17.657C7.843,19.157 9.878,20 12,20C14.122,20 16.157,19.157 17.657,17.657C19.157,16.157 20,14.122 20,12C20,9.878 19.157,7.843 17.657,6.343C16.157,4.843 14.122,4 12,4Z"
|
||||
android:fillColor="#000000" />
|
||||
</vector>
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.tangem.feature.wallet.presentation.common
|
||||
|
||||
import com.tangem.core.ui.R
|
||||
import com.tangem.core.ui.components.transactions.TransactionState
|
||||
import com.tangem.feature.wallet.presentation.common.state.TokenItemState
|
||||
import com.tangem.feature.wallet.presentation.common.state.TokenItemState.TokenOptionsState
|
||||
import com.tangem.feature.wallet.presentation.organizetokens.DraggableItem
|
||||
|
|
@ -9,13 +10,14 @@ import com.tangem.feature.wallet.presentation.organizetokens.OrganizeTokensState
|
|||
import com.tangem.feature.wallet.presentation.wallet.state.WalletCardState
|
||||
import com.tangem.feature.wallet.presentation.wallet.state.WalletContentItemState
|
||||
import com.tangem.feature.wallet.presentation.wallet.state.WalletStateHolder
|
||||
import com.tangem.feature.wallet.presentation.wallet.state.WalletTopBarConfig
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import kotlinx.collections.immutable.toPersistentList
|
||||
import java.util.UUID
|
||||
|
||||
internal object WalletPreviewData {
|
||||
|
||||
val walletTopBarConfig = WalletStateHolder.TopBarConfig(onScanCardClick = {}, onMoreClick = {})
|
||||
val walletTopBarConfig = WalletTopBarConfig(onScanCardClick = {}, onMoreClick = {})
|
||||
|
||||
val walletCardContentState = WalletCardState.Content(
|
||||
id = UUID.randomUUID().toString(),
|
||||
|
|
@ -159,7 +161,7 @@ internal object WalletPreviewData {
|
|||
),
|
||||
)
|
||||
|
||||
val groupedWalletScreenState = WalletStateHolder(
|
||||
val multicurrencyWalletScreenState = WalletStateHolder.MultiCurrencyContent(
|
||||
onBackClick = {},
|
||||
topBarConfig = walletTopBarConfig,
|
||||
selectedWallet = walletCardContentState,
|
||||
|
|
@ -170,8 +172,8 @@ internal object WalletPreviewData {
|
|||
walletCardErrorState,
|
||||
),
|
||||
contentItems = persistentListOf(
|
||||
WalletContentItemState.NetworkGroupTitle("Bitcoin"),
|
||||
WalletContentItemState.Token(
|
||||
WalletContentItemState.MultiCurrencyItem.NetworkGroupTitle("Bitcoin"),
|
||||
WalletContentItemState.MultiCurrencyItem.Token(
|
||||
tokenItemVisibleState.copy(
|
||||
id = "token_1",
|
||||
name = "Ethereum",
|
||||
|
|
@ -180,7 +182,7 @@ internal object WalletPreviewData {
|
|||
amount = "1,89340821 ETH",
|
||||
),
|
||||
),
|
||||
WalletContentItemState.Token(
|
||||
WalletContentItemState.MultiCurrencyItem.Token(
|
||||
tokenItemVisibleState.copy(
|
||||
id = "token_2",
|
||||
name = "Ethereum",
|
||||
|
|
@ -189,7 +191,7 @@ internal object WalletPreviewData {
|
|||
amount = "1,89340821 ETH",
|
||||
),
|
||||
),
|
||||
WalletContentItemState.Token(
|
||||
WalletContentItemState.MultiCurrencyItem.Token(
|
||||
tokenItemVisibleState.copy(
|
||||
id = "token_3",
|
||||
name = "Ethereum",
|
||||
|
|
@ -198,7 +200,7 @@ internal object WalletPreviewData {
|
|||
amount = "1,89340821 ETH",
|
||||
),
|
||||
),
|
||||
WalletContentItemState.Token(
|
||||
WalletContentItemState.MultiCurrencyItem.Token(
|
||||
tokenItemVisibleState.copy(
|
||||
id = "token_4",
|
||||
name = "Ethereum",
|
||||
|
|
@ -207,8 +209,8 @@ internal object WalletPreviewData {
|
|||
amount = "1,89340821 ETH",
|
||||
),
|
||||
),
|
||||
WalletContentItemState.NetworkGroupTitle("Ethereum"),
|
||||
WalletContentItemState.Token(
|
||||
WalletContentItemState.MultiCurrencyItem.NetworkGroupTitle("Ethereum"),
|
||||
WalletContentItemState.MultiCurrencyItem.Token(
|
||||
tokenItemVisibleState.copy(
|
||||
id = "token_5",
|
||||
name = "Ethereum",
|
||||
|
|
@ -220,4 +222,35 @@ internal object WalletPreviewData {
|
|||
),
|
||||
onOrganizeTokensClick = {},
|
||||
)
|
||||
|
||||
val singleWalletScreenState = WalletStateHolder.SingleCurrencyContent(
|
||||
onBackClick = {},
|
||||
topBarConfig = walletTopBarConfig,
|
||||
selectedWallet = walletCardContentState,
|
||||
wallets = persistentListOf(
|
||||
walletCardContentState,
|
||||
walletCardLoadingState,
|
||||
walletCardHiddenContentState,
|
||||
walletCardErrorState,
|
||||
),
|
||||
contentItems = persistentListOf(
|
||||
WalletContentItemState.SingleCurrencyItem.Title(onExploreClick = {}),
|
||||
WalletContentItemState.SingleCurrencyItem.TransactionGroupTitle("Today"),
|
||||
WalletContentItemState.SingleCurrencyItem.Transaction(
|
||||
TransactionState.Sending(
|
||||
address = "33BddS...ga2B",
|
||||
amount = "-0.500913 BTC",
|
||||
timestamp = "8:41",
|
||||
),
|
||||
),
|
||||
WalletContentItemState.SingleCurrencyItem.TransactionGroupTitle("Yesterday"),
|
||||
WalletContentItemState.SingleCurrencyItem.Transaction(
|
||||
TransactionState.Sending(
|
||||
address = "33BddS...ga2B",
|
||||
amount = "-0.500913 BTC",
|
||||
timestamp = "8:41",
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
@ -1,13 +1,55 @@
|
|||
package com.tangem.feature.wallet.presentation.wallet.state
|
||||
|
||||
import com.tangem.core.ui.components.transactions.TransactionState
|
||||
import com.tangem.feature.wallet.presentation.common.state.TokenItemState
|
||||
|
||||
/**
|
||||
* Wallet screen content item state
|
||||
*
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
internal sealed interface WalletContentItemState {
|
||||
|
||||
data class NetworkGroupTitle(val networkName: String) : WalletContentItemState
|
||||
/** Multi currency wallet content state */
|
||||
sealed interface MultiCurrencyItem : WalletContentItemState {
|
||||
|
||||
data class Token(val tokenItemState: TokenItemState) : WalletContentItemState
|
||||
/**
|
||||
* Network group title item
|
||||
*
|
||||
* @property networkName network name
|
||||
*/
|
||||
data class NetworkGroupTitle(val networkName: String) : MultiCurrencyItem
|
||||
|
||||
/**
|
||||
* Token item
|
||||
*
|
||||
* @property state token item state
|
||||
*/
|
||||
data class Token(val state: TokenItemState) : MultiCurrencyItem
|
||||
}
|
||||
|
||||
/** Single currency wallet content state */
|
||||
sealed interface SingleCurrencyItem : WalletContentItemState {
|
||||
|
||||
/**
|
||||
* Title item
|
||||
*
|
||||
* @property onExploreClick lambda be invoke when explore button was clicked
|
||||
*/
|
||||
data class Title(val onExploreClick: () -> Unit) : SingleCurrencyItem
|
||||
|
||||
/**
|
||||
* Transaction group title item
|
||||
*
|
||||
* @property title title
|
||||
*/
|
||||
data class TransactionGroupTitle(val title: String) : SingleCurrencyItem
|
||||
|
||||
/**
|
||||
* Transaction item
|
||||
*
|
||||
* @property state transaction state
|
||||
*/
|
||||
data class Transaction(val state: TransactionState) : SingleCurrencyItem
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@ package com.tangem.feature.wallet.presentation.wallet.state
|
|||
import kotlinx.collections.immutable.ImmutableList
|
||||
|
||||
/**
|
||||
* Wallet state holder
|
||||
* Wallet screen state holder
|
||||
*
|
||||
* @property onBackClick lambda be invoked when back button is clicked
|
||||
* @property topBarConfig top bar config
|
||||
|
|
@ -13,20 +13,46 @@ import kotlinx.collections.immutable.ImmutableList
|
|||
*
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
internal data class WalletStateHolder(
|
||||
val onBackClick: () -> Unit,
|
||||
val topBarConfig: TopBarConfig,
|
||||
val selectedWallet: WalletCardState,
|
||||
val wallets: ImmutableList<WalletCardState>,
|
||||
val contentItems: ImmutableList<WalletContentItemState>,
|
||||
val onOrganizeTokensClick: () -> Unit,
|
||||
internal sealed class WalletStateHolder(
|
||||
open val onBackClick: () -> Unit,
|
||||
open val topBarConfig: WalletTopBarConfig,
|
||||
open val selectedWallet: WalletCardState,
|
||||
open val wallets: ImmutableList<WalletCardState>,
|
||||
open val contentItems: ImmutableList<WalletContentItemState>,
|
||||
) {
|
||||
|
||||
/**
|
||||
* Top bar config
|
||||
* Multi currency wallet content state
|
||||
*
|
||||
* @property onScanCardClick lambda be invoked when scan card button is clicked
|
||||
* @property onMoreClick lambda be invoked when more button is clicked
|
||||
* @property onBackClick lambda be invoked when back button is clicked
|
||||
* @property topBarConfig top bar config
|
||||
* @property selectedWallet selected wallet
|
||||
* @property wallets list of wallets states
|
||||
* @property contentItems content items
|
||||
*/
|
||||
data class TopBarConfig(val onScanCardClick: () -> Unit, val onMoreClick: () -> Unit)
|
||||
data class MultiCurrencyContent(
|
||||
override val onBackClick: () -> Unit,
|
||||
override val topBarConfig: WalletTopBarConfig,
|
||||
override val selectedWallet: WalletCardState,
|
||||
override val wallets: ImmutableList<WalletCardState>,
|
||||
override val contentItems: ImmutableList<WalletContentItemState.MultiCurrencyItem>,
|
||||
val onOrganizeTokensClick: () -> Unit,
|
||||
) : WalletStateHolder(onBackClick, topBarConfig, selectedWallet, wallets, contentItems)
|
||||
|
||||
/**
|
||||
* Single currency wallet content state
|
||||
*
|
||||
* @property onBackClick lambda be invoked when back button is clicked
|
||||
* @property topBarConfig top bar config
|
||||
* @property selectedWallet selected wallet
|
||||
* @property wallets list of wallets states
|
||||
* @property contentItems content items
|
||||
*/
|
||||
data class SingleCurrencyContent(
|
||||
override val onBackClick: () -> Unit,
|
||||
override val topBarConfig: WalletTopBarConfig,
|
||||
override val selectedWallet: WalletCardState,
|
||||
override val wallets: ImmutableList<WalletCardState>,
|
||||
override val contentItems: ImmutableList<WalletContentItemState.SingleCurrencyItem>,
|
||||
) : WalletStateHolder(onBackClick, topBarConfig, selectedWallet, wallets, contentItems)
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.tangem.feature.wallet.presentation.wallet.state
|
||||
|
||||
/**
|
||||
* Wallet screen top bar config
|
||||
*
|
||||
* @property onScanCardClick lambda be invoked when scan card button is clicked
|
||||
* @property onMoreClick lambda be invoked when more button is clicked
|
||||
*/
|
||||
data class WalletTopBarConfig(val onScanCardClick: () -> Unit, val onMoreClick: () -> Unit)
|
||||
|
|
@ -1,23 +1,29 @@
|
|||
package com.tangem.feature.wallet.presentation.wallet.ui
|
||||
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.itemsIndexed
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.composed
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider
|
||||
import com.tangem.core.ui.components.RoundedActionButton
|
||||
import com.tangem.core.ui.components.transactions.Transaction
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.feature.wallet.impl.R
|
||||
import com.tangem.feature.wallet.presentation.common.WalletPreviewData
|
||||
|
|
@ -43,9 +49,7 @@ internal fun WalletScreen(state: WalletStateHolder, modifier: Modifier = Modifie
|
|||
topBar = { WalletTopBar(config = state.topBarConfig) },
|
||||
containerColor = TangemTheme.colors.background.secondary,
|
||||
) { scaffoldPaddings ->
|
||||
val lastContentItemIndex = remember(state.contentItems) {
|
||||
state.contentItems.lastIndex
|
||||
}
|
||||
val lastContentItemIndex = remember(state.contentItems) { state.contentItems.lastIndex }
|
||||
|
||||
LazyColumn(
|
||||
modifier = modifier
|
||||
|
|
@ -57,10 +61,13 @@ internal fun WalletScreen(state: WalletStateHolder, modifier: Modifier = Modifie
|
|||
|
||||
itemsIndexed(
|
||||
items = state.contentItems,
|
||||
key = { _, item ->
|
||||
key = { index, item ->
|
||||
when (item) {
|
||||
is WalletContentItemState.NetworkGroupTitle -> item.networkName
|
||||
is WalletContentItemState.Token -> item.tokenItemState.id
|
||||
is WalletContentItemState.MultiCurrencyItem.NetworkGroupTitle -> item.networkName
|
||||
is WalletContentItemState.MultiCurrencyItem.Token -> item.state.id
|
||||
is WalletContentItemState.SingleCurrencyItem.Title -> index
|
||||
is WalletContentItemState.SingleCurrencyItem.TransactionGroupTitle -> item.title
|
||||
is WalletContentItemState.SingleCurrencyItem.Transaction -> index
|
||||
}
|
||||
},
|
||||
) { index, item ->
|
||||
|
|
@ -69,33 +76,96 @@ internal fun WalletScreen(state: WalletStateHolder, modifier: Modifier = Modifie
|
|||
.clipFirstAndLastItems(index, lastContentItemIndex)
|
||||
|
||||
when (item) {
|
||||
is WalletContentItemState.NetworkGroupTitle -> {
|
||||
NetworkGroupItem(
|
||||
networkName = item.networkName,
|
||||
modifier = itemModifier,
|
||||
)
|
||||
is WalletContentItemState.MultiCurrencyItem.NetworkGroupTitle -> {
|
||||
NetworkGroupItem(networkName = item.networkName, modifier = itemModifier)
|
||||
}
|
||||
is WalletContentItemState.Token -> {
|
||||
TokenItem(
|
||||
state = item.tokenItemState,
|
||||
modifier = itemModifier,
|
||||
)
|
||||
is WalletContentItemState.MultiCurrencyItem.Token -> {
|
||||
TokenItem(state = item.state, modifier = itemModifier)
|
||||
}
|
||||
is WalletContentItemState.SingleCurrencyItem.Title -> {
|
||||
SingleCurrencyTitle(config = item, modifier = itemModifier)
|
||||
}
|
||||
is WalletContentItemState.SingleCurrencyItem.TransactionGroupTitle -> {
|
||||
TransactionGroupTitle(config = item, modifier = itemModifier)
|
||||
}
|
||||
is WalletContentItemState.SingleCurrencyItem.Transaction -> {
|
||||
Transaction(state = item.state, modifier = itemModifier)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
item {
|
||||
RoundedActionButton(
|
||||
text = stringResource(id = R.string.organize_tokens_title),
|
||||
iconResId = R.drawable.ic_filter_24,
|
||||
onClick = state.onOrganizeTokensClick,
|
||||
modifier = Modifier.padding(top = TangemTheme.dimens.spacing14),
|
||||
)
|
||||
if (state is WalletStateHolder.MultiCurrencyContent) {
|
||||
item {
|
||||
RoundedActionButton(
|
||||
text = stringResource(id = R.string.organize_tokens_title),
|
||||
iconResId = R.drawable.ic_filter_24,
|
||||
onClick = state.onOrganizeTokensClick,
|
||||
modifier = Modifier.padding(top = TangemTheme.dimens.spacing14),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun SingleCurrencyTitle(
|
||||
config: WalletContentItemState.SingleCurrencyItem.Title,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Row(
|
||||
modifier = modifier
|
||||
.background(TangemTheme.colors.background.primary)
|
||||
.fillMaxWidth()
|
||||
.padding(top = TangemTheme.dimens.spacing12)
|
||||
.padding(horizontal = TangemTheme.dimens.spacing16),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.common_transactions),
|
||||
color = TangemTheme.colors.text.tertiary,
|
||||
style = TangemTheme.typography.subtitle2,
|
||||
)
|
||||
|
||||
Row(
|
||||
modifier = Modifier.clickable(onClick = config.onExploreClick),
|
||||
horizontalArrangement = Arrangement.spacedBy(space = TangemTheme.dimens.spacing4),
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.ic_compass_24),
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(size = TangemTheme.dimens.size18),
|
||||
tint = TangemTheme.colors.icon.informative,
|
||||
)
|
||||
Text(
|
||||
text = stringResource(id = R.string.common_explorer),
|
||||
color = TangemTheme.colors.text.tertiary,
|
||||
style = TangemTheme.typography.subtitle2,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun TransactionGroupTitle(
|
||||
config: WalletContentItemState.SingleCurrencyItem.TransactionGroupTitle,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Text(
|
||||
text = config.title,
|
||||
modifier = modifier
|
||||
.background(TangemTheme.colors.background.primary)
|
||||
.fillMaxWidth()
|
||||
.padding(
|
||||
horizontal = TangemTheme.dimens.spacing16,
|
||||
vertical = TangemTheme.dimens.spacing14,
|
||||
),
|
||||
color = TangemTheme.colors.text.tertiary,
|
||||
textAlign = TextAlign.Start,
|
||||
style = TangemTheme.typography.body2,
|
||||
)
|
||||
}
|
||||
|
||||
private fun Modifier.clipFirstAndLastItems(index: Int, lastItemIndex: Int): Modifier = composed {
|
||||
when (index) {
|
||||
0 -> {
|
||||
|
|
@ -143,6 +213,9 @@ private fun WalletScreenPreview_Dark(
|
|||
}
|
||||
|
||||
private class WalletScreenParameterProvider : CollectionPreviewParameterProvider<WalletStateHolder>(
|
||||
collection = listOf(WalletPreviewData.groupedWalletScreenState),
|
||||
collection = listOf(
|
||||
WalletPreviewData.multicurrencyWalletScreenState,
|
||||
WalletPreviewData.singleWalletScreenState,
|
||||
),
|
||||
)
|
||||
// endregion Preview
|
||||
|
|
@ -7,7 +7,7 @@ import androidx.compose.ui.tooling.preview.Preview
|
|||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.feature.wallet.impl.R
|
||||
import com.tangem.feature.wallet.presentation.common.WalletPreviewData
|
||||
import com.tangem.feature.wallet.presentation.wallet.state.WalletStateHolder
|
||||
import com.tangem.feature.wallet.presentation.wallet.state.WalletTopBarConfig
|
||||
|
||||
/**
|
||||
* Wallet screen top bar
|
||||
|
|
@ -16,7 +16,7 @@ import com.tangem.feature.wallet.presentation.wallet.state.WalletStateHolder
|
|||
*/
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
internal fun WalletTopBar(config: WalletStateHolder.TopBarConfig) {
|
||||
internal fun WalletTopBar(config: WalletTopBarConfig) {
|
||||
TopAppBar(
|
||||
title = {
|
||||
Icon(painter = painterResource(id = R.drawable.img_tangem_logo_90_24), contentDescription = null)
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ internal class WalletViewModel @Inject constructor() : ViewModel() {
|
|||
private set
|
||||
|
||||
// TODO: [REDACTED_TASK_KEY] Use production data instead of WalletPreviewData
|
||||
private fun getInitialState(): WalletStateHolder = WalletPreviewData.groupedWalletScreenState.copy(
|
||||
private fun getInitialState(): WalletStateHolder = WalletPreviewData.multicurrencyWalletScreenState.copy(
|
||||
onBackClick = { router.popBackStack() },
|
||||
topBarConfig = WalletPreviewData.groupedWalletScreenState.topBarConfig.copy(
|
||||
topBarConfig = WalletPreviewData.multicurrencyWalletScreenState.topBarConfig.copy(
|
||||
onScanCardClick = { router.openOrganizeTokensScreen() },
|
||||
),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue