Updated on 2026-08-14
This commit is contained in:
parent
d808a3ddb2
commit
b775329fb3
28 changed files with 768 additions and 73 deletions
|
|
@ -0,0 +1,22 @@
|
|||
package com.tangem.common.ui.expressStatus.state
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import com.tangem.common.ui.tokendetails.TokenDetailsDialogConfig
|
||||
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
|
||||
import kotlinx.collections.immutable.PersistentList
|
||||
|
||||
data class ExpressTransactionsBlockState(
|
||||
val transactions: PersistentList<ExpressTransactionStateUM>,
|
||||
val bottomSheetSlot: BottomSheetSlot?,
|
||||
val dialogSlot: DialogSlot?,
|
||||
)
|
||||
|
||||
data class BottomSheetSlot(
|
||||
val config: TangemBottomSheetConfig,
|
||||
val content: @Composable () -> Unit,
|
||||
)
|
||||
|
||||
data class DialogSlot(
|
||||
val config: TokenDetailsDialogConfig,
|
||||
val content: @Composable () -> Unit,
|
||||
)
|
||||
|
|
@ -0,0 +1,155 @@
|
|||
package com.tangem.common.ui.tokendetails
|
||||
|
||||
import com.tangem.core.ui.R
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.extensions.resourceReference
|
||||
import com.tangem.core.ui.extensions.wrappedList
|
||||
|
||||
/**
|
||||
* Wallet bottom sheet config
|
||||
*
|
||||
* @property isShow flag that determine if bottom sheet is shown
|
||||
* @property onDismissRequest lambda be invoked when bottom sheet is dismissed
|
||||
* @property content content config
|
||||
*/
|
||||
data class TokenDetailsDialogConfig(
|
||||
val isShow: Boolean,
|
||||
val onDismissRequest: () -> Unit,
|
||||
val content: DialogContentConfig,
|
||||
) {
|
||||
|
||||
sealed class DialogContentConfig {
|
||||
|
||||
abstract val title: TextReference?
|
||||
abstract val message: TextReference
|
||||
abstract val confirmButtonConfig: ButtonConfig
|
||||
abstract val cancelButtonConfig: ButtonConfig?
|
||||
|
||||
data class ButtonConfig(
|
||||
val text: TextReference,
|
||||
val onClick: () -> Unit,
|
||||
val hasWarning: Boolean = false,
|
||||
)
|
||||
|
||||
data class ConfirmHideConfig(
|
||||
val currencyTitle: String,
|
||||
val onConfirmClick: () -> Unit,
|
||||
val onCancelClick: () -> Unit,
|
||||
) : DialogContentConfig() {
|
||||
override val title: TextReference = TextReference.Res(
|
||||
id = R.string.token_details_hide_alert_title,
|
||||
formatArgs = wrappedList(currencyTitle),
|
||||
)
|
||||
|
||||
override val message: TextReference = TextReference.Res(R.string.token_details_hide_alert_message)
|
||||
|
||||
override val cancelButtonConfig: ButtonConfig = ButtonConfig(
|
||||
text = TextReference.Res(R.string.common_cancel),
|
||||
onClick = onCancelClick,
|
||||
)
|
||||
|
||||
override val confirmButtonConfig: ButtonConfig = ButtonConfig(
|
||||
text = TextReference.Res(R.string.token_details_hide_alert_hide),
|
||||
onClick = onConfirmClick,
|
||||
hasWarning = true,
|
||||
)
|
||||
}
|
||||
|
||||
data class HasLinkedTokensConfig(
|
||||
val currencyName: String,
|
||||
val currencySymbol: String,
|
||||
val networkName: String,
|
||||
val onConfirmClick: () -> Unit,
|
||||
) : DialogContentConfig() {
|
||||
override val title: TextReference = TextReference.Res(
|
||||
id = R.string.token_details_unable_hide_alert_title,
|
||||
formatArgs = wrappedList(currencySymbol),
|
||||
)
|
||||
|
||||
override val message: TextReference = TextReference.Res(
|
||||
id = R.string.token_details_unable_hide_alert_message,
|
||||
formatArgs = wrappedList(currencyName, currencySymbol, networkName),
|
||||
)
|
||||
|
||||
override val cancelButtonConfig: ButtonConfig?
|
||||
get() = null
|
||||
|
||||
override val confirmButtonConfig: ButtonConfig = ButtonConfig(
|
||||
text = TextReference.Res(R.string.common_ok),
|
||||
onClick = onConfirmClick,
|
||||
)
|
||||
}
|
||||
|
||||
data class DisabledButtonReasonDialogConfig(
|
||||
val text: TextReference,
|
||||
val onConfirmClick: () -> Unit,
|
||||
) : DialogContentConfig() {
|
||||
|
||||
override val title = null
|
||||
|
||||
override val message: TextReference = text
|
||||
|
||||
override val cancelButtonConfig = null
|
||||
|
||||
override val confirmButtonConfig: ButtonConfig = ButtonConfig(
|
||||
text = TextReference.Res(R.string.common_ok),
|
||||
onClick = onConfirmClick,
|
||||
)
|
||||
}
|
||||
|
||||
data class RemoveIncompleteTransactionConfirmDialogConfig(
|
||||
val onConfirmClick: () -> Unit,
|
||||
val onCancelClick: () -> Unit,
|
||||
) : DialogContentConfig() {
|
||||
override val title = null
|
||||
|
||||
override val message: TextReference = TextReference.Res(
|
||||
id = R.string.warning_kaspa_unfinished_token_transaction_discard_message,
|
||||
)
|
||||
|
||||
override val cancelButtonConfig: ButtonConfig = ButtonConfig(
|
||||
text = TextReference.Res(R.string.common_cancel),
|
||||
onClick = onCancelClick,
|
||||
)
|
||||
|
||||
override val confirmButtonConfig: ButtonConfig = ButtonConfig(
|
||||
text = TextReference.Res(R.string.common_yes),
|
||||
onClick = onConfirmClick,
|
||||
)
|
||||
}
|
||||
|
||||
data class ErrorDialogConfig(
|
||||
val text: TextReference,
|
||||
val onConfirmClick: () -> Unit,
|
||||
) : DialogContentConfig() {
|
||||
|
||||
override val title = null
|
||||
|
||||
override val message: TextReference = text
|
||||
|
||||
override val cancelButtonConfig = null
|
||||
|
||||
override val confirmButtonConfig: ButtonConfig = ButtonConfig(
|
||||
text = TextReference.Res(R.string.common_ok),
|
||||
onClick = onConfirmClick,
|
||||
)
|
||||
}
|
||||
|
||||
data class ConfirmExpressStatusHideDialogConfig(
|
||||
val onConfirmClick: () -> Unit,
|
||||
val onCancelClick: () -> Unit,
|
||||
) : DialogContentConfig() {
|
||||
override val title: TextReference = resourceReference(R.string.express_status_hide_dialog_title)
|
||||
override val message: TextReference = resourceReference(R.string.express_status_hide_dialog_text)
|
||||
override val confirmButtonConfig: ButtonConfig = ButtonConfig(
|
||||
text = resourceReference(R.string.common_hide),
|
||||
onClick = onConfirmClick,
|
||||
)
|
||||
|
||||
override val cancelButtonConfig: ButtonConfig = ButtonConfig(
|
||||
text = resourceReference(R.string.common_cancel),
|
||||
onClick = onCancelClick,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue