Updated on 2026-08-14
This commit is contained in:
parent
d8ea76fca9
commit
ec0643cc97
4 changed files with 169 additions and 7 deletions
|
|
@ -146,7 +146,7 @@ private fun MainContent(
|
|||
tint = iconTint,
|
||||
modifier = Modifier
|
||||
.size(size = iconSize)
|
||||
.align(alignment = Alignment.CenterVertically),
|
||||
.align(alignment = Alignment.Top),
|
||||
)
|
||||
|
||||
SpacerW(width = TangemTheme.dimens.spacing10)
|
||||
|
|
|
|||
|
|
@ -8,12 +8,17 @@
|
|||
android:pathData="M4,0L16,0A4,4 0,0 1,20 4L20,16A4,4 0,0 1,16 20L4,20A4,4 0,0 1,0 16L0,4A4,4 0,0 1,4 0z"/>
|
||||
<path
|
||||
android:pathData="M4,0L16,0A4,4 0,0 1,20 4L20,16A4,4 0,0 1,16 20L4,20A4,4 0,0 1,0 16L0,4A4,4 0,0 1,4 0z"
|
||||
android:fillColor="#EBEBEB"
|
||||
android:fillAlpha="0.7"/>
|
||||
android:fillColor="#EBEBEB"/>
|
||||
<path
|
||||
android:pathData="M9.253,4.076C9.717,3.808 10.289,3.808 10.753,4.076L14.76,6.389C15.224,6.657 15.51,7.153 15.51,7.688V12.314C15.51,12.85 15.224,13.346 14.76,13.614L10.753,15.927C10.289,16.194 9.717,16.194 9.253,15.927L5.246,13.614C4.782,13.346 4.496,12.85 4.496,12.314V7.688C4.496,7.152 4.782,6.657 5.246,6.389L9.253,4.076Z"
|
||||
android:strokeAlpha="0.1"
|
||||
android:fillColor="#1E1E1E"
|
||||
android:fillAlpha="0.1"/>
|
||||
android:pathData="M7.645,7.047C8.365,7.047 8.948,7.631 8.948,8.351C8.948,9.07 8.365,9.654 7.645,9.654C6.925,9.654 6.341,9.07 6.341,8.351C6.341,7.631 6.925,7.047 7.645,7.047Z"
|
||||
android:strokeAlpha="0.3"
|
||||
android:fillColor="#919191"
|
||||
android:fillAlpha="0.3"/>
|
||||
<path
|
||||
android:pathData="M9.176,3.268C9.735,2.993 10.397,3.012 10.941,3.326L15.315,5.852C15.895,6.187 16.252,6.806 16.252,7.476V12.527C16.252,13.197 15.895,13.816 15.315,14.151L10.941,16.676C10.397,16.99 9.735,17.01 9.176,16.735L9.066,16.676L4.691,14.151C4.148,13.837 3.799,13.273 3.758,12.651L3.754,12.527V7.476C3.754,6.806 4.111,6.187 4.691,5.852L9.066,3.326L9.176,3.268ZM15.002,10.217C13.239,10.258 11.71,10.72 10.623,11.515C9.502,12.334 8.825,13.521 8.825,15.066H8.778L9.691,15.593L9.765,15.63C9.943,15.703 10.146,15.691 10.316,15.593L14.69,13.068C14.883,12.957 15.002,12.75 15.002,12.527V10.217ZM10.316,4.409C10.122,4.298 9.884,4.298 9.691,4.409L5.316,6.935C5.123,7.046 5.004,7.252 5.004,7.476V12.527L5.01,12.609C5.035,12.8 5.147,12.97 5.316,13.068L7.612,14.393C7.791,12.744 8.627,11.425 9.886,10.505C11.234,9.52 13.039,9.007 15.002,8.966V7.476C15.002,7.252 14.883,7.046 14.69,6.935L10.316,4.409Z"
|
||||
android:strokeAlpha="0.3"
|
||||
android:fillColor="#919191"
|
||||
android:fillType="evenOdd"
|
||||
android:fillAlpha="0.3"/>
|
||||
</group>
|
||||
</vector>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package com.tangem.features.walletconnect.transaction.entity.chain
|
||||
|
||||
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfigContent
|
||||
import com.tangem.features.walletconnect.transaction.entity.common.WcTransactionAppInfoContentUM
|
||||
import com.tangem.features.walletconnect.transaction.entity.common.WcTransactionRequestInfoUM
|
||||
|
||||
internal data class WcAddEthereumChainUM(
|
||||
val transaction: WcAddEthereumChainItemUM,
|
||||
val transactionRequestInfo: WcTransactionRequestInfoUM,
|
||||
)
|
||||
|
||||
internal data class WcAddEthereumChainItemUM(
|
||||
val onDismiss: () -> Unit,
|
||||
val onSign: () -> Unit,
|
||||
val appInfo: WcTransactionAppInfoContentUM,
|
||||
val walletName: String,
|
||||
val isLoading: Boolean = false,
|
||||
) : TangemBottomSheetConfigContent
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
package com.tangem.features.walletconnect.transaction.ui.chain
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.animation.animateContentSize
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.tooling.preview.Devices
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
|
||||
import com.tangem.core.ui.components.bottomsheets.modal.TangemModalBottomSheet
|
||||
import com.tangem.core.ui.components.bottomsheets.modal.TangemModalBottomSheetTitle
|
||||
import com.tangem.core.ui.components.divider.DividerWithPadding
|
||||
import com.tangem.core.ui.extensions.resourceReference
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.features.walletconnect.connections.ui.WcAppInfoItem
|
||||
import com.tangem.features.walletconnect.impl.R
|
||||
import com.tangem.features.walletconnect.transaction.entity.chain.WcAddEthereumChainItemUM
|
||||
import com.tangem.features.walletconnect.transaction.entity.common.WcTransactionAppInfoContentUM
|
||||
import com.tangem.features.walletconnect.transaction.ui.common.*
|
||||
|
||||
@Composable
|
||||
internal fun WcAddEthereumChainModalBottomSheetContent(
|
||||
state: WcAddEthereumChainItemUM,
|
||||
onClickTransactionRequest: () -> Unit,
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.padding(horizontal = TangemTheme.dimens.spacing16),
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.clip(RoundedCornerShape(TangemTheme.dimens.radius14))
|
||||
.background(color = TangemTheme.colors.background.action)
|
||||
.fillMaxWidth()
|
||||
.animateContentSize(),
|
||||
) {
|
||||
WcSmallTitleItem(R.string.wc_request_from)
|
||||
WcAppInfoItem(
|
||||
iconUrl = state.appInfo.appIcon,
|
||||
title = state.appInfo.appName,
|
||||
subtitle = state.appInfo.appSubtitle,
|
||||
isVerified = state.appInfo.isVerified,
|
||||
)
|
||||
DividerWithPadding(start = 0.dp, end = 0.dp)
|
||||
WcTransactionRequestItem(
|
||||
iconRes = R.drawable.ic_doc_new_24,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.clickable { onClickTransactionRequest() }
|
||||
.padding(TangemTheme.dimens.spacing12),
|
||||
)
|
||||
}
|
||||
Column(modifier = Modifier.padding(top = TangemTheme.dimens.spacing16)) {
|
||||
WcAddEthereumChainItems(state)
|
||||
WcTransactionRequestButtons(
|
||||
modifier = Modifier.padding(vertical = TangemTheme.dimens.spacing16),
|
||||
onDismiss = state.onDismiss,
|
||||
onClickActiveButton = state.onSign,
|
||||
activeButtonText = resourceReference(R.string.common_sign),
|
||||
isLoading = state.isLoading,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun WcAddEthereumChainItems(state: WcAddEthereumChainItemUM) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.clip(RoundedCornerShape(TangemTheme.dimens.radius14))
|
||||
.background(color = TangemTheme.colors.background.action)
|
||||
.fillMaxWidth()
|
||||
.animateContentSize(),
|
||||
) {
|
||||
DividerWithPadding(start = 0.dp, end = 0.dp)
|
||||
WcWalletItem(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(TangemTheme.dimens.spacing12),
|
||||
walletName = state.walletName,
|
||||
)
|
||||
DividerWithPadding(start = TangemTheme.dimens.spacing40, end = TangemTheme.dimens.spacing12)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview(showBackground = true, device = Devices.PIXEL_7_PRO)
|
||||
@Preview(showBackground = true, device = Devices.PIXEL_7_PRO, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
private fun WcAddEthereumChainBottomSheetPreview(
|
||||
@PreviewParameter(WcAddEthereumChainStateProvider::class) state: WcAddEthereumChainItemUM,
|
||||
) {
|
||||
TangemThemePreview {
|
||||
TangemModalBottomSheet<WcAddEthereumChainItemUM>(
|
||||
config = TangemBottomSheetConfig(
|
||||
isShown = true,
|
||||
onDismissRequest = {},
|
||||
content = state,
|
||||
),
|
||||
containerColor = TangemTheme.colors.background.tertiary,
|
||||
title = {
|
||||
TangemModalBottomSheetTitle(
|
||||
title = resourceReference(R.string.wallet_connect_title),
|
||||
endIconRes = R.drawable.ic_close_24,
|
||||
onEndClick = {},
|
||||
startIconRes = null,
|
||||
onStartClick = {},
|
||||
)
|
||||
},
|
||||
content = {
|
||||
WcAddEthereumChainModalBottomSheetContent(state = state, onClickTransactionRequest = {})
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private class WcAddEthereumChainStateProvider : CollectionPreviewParameterProvider<WcAddEthereumChainItemUM>(
|
||||
listOf(
|
||||
WcAddEthereumChainItemUM(
|
||||
onDismiss = {},
|
||||
onSign = {},
|
||||
appInfo = WcTransactionAppInfoContentUM(
|
||||
appName = "React App",
|
||||
appIcon = "",
|
||||
isVerified = true,
|
||||
appSubtitle = "react-app.walletconnect.com",
|
||||
),
|
||||
walletName = "Tangem 2.0",
|
||||
),
|
||||
),
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue