diff --git a/app/src/main/java/com/bitchat/android/wallet/ui/SendDialog.kt b/app/src/main/java/com/bitchat/android/wallet/ui/SendDialog.kt index 0f9f08cc..a47ebf18 100644 --- a/app/src/main/java/com/bitchat/android/wallet/ui/SendDialog.kt +++ b/app/src/main/java/com/bitchat/android/wallet/ui/SendDialog.kt @@ -14,6 +14,7 @@ import androidx.compose.runtime.* import androidx.compose.runtime.livedata.observeAsState import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalClipboardManager import androidx.compose.ui.text.AnnotatedString @@ -23,18 +24,16 @@ import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import androidx.compose.ui.window.Dialog -import androidx.compose.ui.window.DialogProperties import com.bitchat.android.wallet.data.MeltQuote import com.bitchat.android.wallet.viewmodel.WalletViewModel /** - * Send dialog with options for Cashu tokens or Lightning payments + * Full-screen send view with options for Cashu tokens or Lightning payments */ @Composable -fun SendDialog( +fun SendView( viewModel: WalletViewModel, - onDismiss: () -> Unit + onNavigateBack: () -> Unit ) { val sendType by viewModel.sendType.observeAsState(WalletViewModel.SendType.CASHU) val generatedToken by viewModel.generatedToken.observeAsState() @@ -42,115 +41,163 @@ fun SendDialog( val isLoading by viewModel.isLoading.observeAsState(false) val balance by viewModel.balance.observeAsState(0L) - Dialog( - onDismissRequest = onDismiss, - properties = DialogProperties(usePlatformDefaultWidth = false) + // Determine if we should show type selector + val showTypeSelector = generatedToken == null && currentMeltQuote == null + + Box( + modifier = Modifier + .fillMaxSize() + .background(Color.Black) ) { - Card( + Column( modifier = Modifier - .fillMaxWidth() - .padding(16.dp), - shape = RoundedCornerShape(16.dp), - colors = CardDefaults.cardColors(containerColor = Color(0xFF1A1A1A)) + .fillMaxSize() + .padding(16.dp) + .verticalScroll(rememberScrollState()) ) { - Column( + // Header with back button + Row( modifier = Modifier - .padding(24.dp) - .verticalScroll(rememberScrollState()) + .fillMaxWidth() + .padding(bottom = 24.dp), + horizontalArrangement = Arrangement.SpaceBetween, + verticalAlignment = Alignment.CenterVertically + ) { + IconButton( + onClick = onNavigateBack, + modifier = Modifier + .size(48.dp) + .clip(RoundedCornerShape(12.dp)) + .background(Color(0xFF1A1A1A)) + ) { + Icon( + imageVector = Icons.Filled.ArrowBack, + contentDescription = "Back", + tint = Color.White, + modifier = Modifier.size(24.dp) + ) + } + + Text( + text = "SEND", + color = Color.White, + fontSize = 24.sp, + fontWeight = FontWeight.Bold, + fontFamily = FontFamily.Monospace, + letterSpacing = 2.sp + ) + + // Spacer to center the title + Spacer(modifier = Modifier.width(48.dp)) + } + + // Balance display + Card( + modifier = Modifier + .fillMaxWidth() + .padding(bottom = 16.dp), + shape = RoundedCornerShape(16.dp), + colors = CardDefaults.cardColors(containerColor = Color(0xFF1A1A1A)) ) { - // Header Row( - modifier = Modifier.fillMaxWidth(), + modifier = Modifier + .fillMaxWidth() + .padding(16.dp), horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically ) { Text( - text = "Send", + text = "AVAILABLE BALANCE", + color = Color.Gray, + fontSize = 14.sp, + fontWeight = FontWeight.Bold, + fontFamily = FontFamily.Monospace, + letterSpacing = 1.sp + ) + + Text( + text = formatSats(balance), color = Color.White, - fontSize = 20.sp, + fontSize = 16.sp, fontWeight = FontWeight.Bold, fontFamily = FontFamily.Monospace ) - - IconButton(onClick = onDismiss) { - Icon( - imageVector = Icons.Filled.Close, - contentDescription = "Close", - tint = Color.Gray - ) - } } - - Spacer(modifier = Modifier.height(16.dp)) - - // Balance display - Text( - text = "Available: ${formatSats(balance)}", - color = Color.Gray, - fontSize = 14.sp, - fontFamily = FontFamily.Monospace - ) - - Spacer(modifier = Modifier.height(16.dp)) - - // Send type selector - Row( - modifier = Modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.spacedBy(8.dp) + } + + // Send type selector (only show when not displaying generated token or quote) + if (showTypeSelector) { + Card( + modifier = Modifier + .fillMaxWidth() + .padding(bottom = 24.dp), + shape = RoundedCornerShape(16.dp), + colors = CardDefaults.cardColors(containerColor = Color(0xFF1A1A1A)) ) { - FilterChip( - onClick = { viewModel.setSendType(WalletViewModel.SendType.CASHU) }, - label = { - Text( - text = "Cashu", - fontFamily = FontFamily.Monospace - ) - }, - selected = sendType == WalletViewModel.SendType.CASHU, - colors = FilterChipDefaults.filterChipColors( - selectedContainerColor = Color(0xFF00C851), - selectedLabelColor = Color.Black - ), - modifier = Modifier.weight(1f) - ) - - FilterChip( - onClick = { viewModel.setSendType(WalletViewModel.SendType.LIGHTNING) }, - label = { - Text( - text = "Lightning", - fontFamily = FontFamily.Monospace - ) - }, - selected = sendType == WalletViewModel.SendType.LIGHTNING, - colors = FilterChipDefaults.filterChipColors( - selectedContainerColor = Color(0xFF00C851), - selectedLabelColor = Color.Black - ), - modifier = Modifier.weight(1f) + Row( + modifier = Modifier + .fillMaxWidth() + .padding(8.dp), + horizontalArrangement = Arrangement.spacedBy(8.dp) + ) { + FilterChip( + onClick = { viewModel.setSendType(WalletViewModel.SendType.CASHU) }, + label = { + Text( + text = "Cashu Token", + fontFamily = FontFamily.Monospace, + fontWeight = FontWeight.Medium + ) + }, + selected = sendType == WalletViewModel.SendType.CASHU, + colors = FilterChipDefaults.filterChipColors( + selectedContainerColor = Color(0xFF00C851), + selectedLabelColor = Color.Black, + containerColor = Color(0xFF2A2A2A), + labelColor = Color.White + ), + modifier = Modifier.weight(1f) + ) + + FilterChip( + onClick = { viewModel.setSendType(WalletViewModel.SendType.LIGHTNING) }, + label = { + Text( + text = "Lightning Payment", + fontFamily = FontFamily.Monospace, + fontWeight = FontWeight.Medium + ) + }, + selected = sendType == WalletViewModel.SendType.LIGHTNING, + colors = FilterChipDefaults.filterChipColors( + selectedContainerColor = Color(0xFF00C851), + selectedLabelColor = Color.Black, + containerColor = Color(0xFF2A2A2A), + labelColor = Color.White + ), + modifier = Modifier.weight(1f) + ) + } + } + } + + // Content based on send type + when (sendType) { + WalletViewModel.SendType.CASHU -> { + CashuSendContent( + viewModel = viewModel, + generatedToken = generatedToken, + isLoading = isLoading, + maxAmount = balance ) } - - Spacer(modifier = Modifier.height(24.dp)) - - // Content based on send type - when (sendType) { - WalletViewModel.SendType.CASHU -> { - CashuSendContent( - viewModel = viewModel, - generatedToken = generatedToken, - isLoading = isLoading, - maxAmount = balance - ) - } - WalletViewModel.SendType.LIGHTNING -> { - LightningSendContent( - viewModel = viewModel, - currentMeltQuote = currentMeltQuote, - isLoading = isLoading, - maxAmount = balance - ) - } + WalletViewModel.SendType.LIGHTNING -> { + LightningSendContent( + viewModel = viewModel, + currentMeltQuote = currentMeltQuote, + isLoading = isLoading, + maxAmount = balance + ) } } } @@ -170,62 +217,104 @@ private fun CashuSendContent( if (generatedToken != null) { // Show generated token - Column { - Text( - text = "Cashu Token Generated", - color = Color(0xFF00C851), - fontSize = 16.sp, - fontWeight = FontWeight.Bold, - fontFamily = FontFamily.Monospace - ) - - Spacer(modifier = Modifier.height(12.dp)) - + Column( + modifier = Modifier.fillMaxWidth(), + horizontalAlignment = Alignment.CenterHorizontally + ) { + // Token info card Card( - modifier = Modifier.fillMaxWidth(), - shape = RoundedCornerShape(8.dp), - colors = CardDefaults.cardColors(containerColor = Color(0xFF2A2A2A)) + modifier = Modifier + .fillMaxWidth() + .padding(bottom = 32.dp), + shape = RoundedCornerShape(16.dp), + colors = CardDefaults.cardColors(containerColor = Color(0xFF1A1A1A)) ) { - SelectionContainer { - Text( - text = generatedToken, - color = Color.White, - fontSize = 12.sp, - fontFamily = FontFamily.Monospace, - modifier = Modifier.padding(16.dp) + Column( + modifier = Modifier + .fillMaxWidth() + .padding(24.dp), + horizontalAlignment = Alignment.CenterHorizontally + ) { + Icon( + imageVector = Icons.Filled.Toll, + contentDescription = "Token", + tint = Color(0xFF00C851), + modifier = Modifier.size(48.dp) ) + + Spacer(modifier = Modifier.height(16.dp)) + + Text( + text = "CASHU TOKEN CREATED", + color = Color(0xFF00C851), + fontSize = 16.sp, + fontWeight = FontWeight.Bold, + fontFamily = FontFamily.Monospace, + letterSpacing = 1.sp + ) + + Spacer(modifier = Modifier.height(24.dp)) + + // Token display + Card( + modifier = Modifier.fillMaxWidth(), + shape = RoundedCornerShape(12.dp), + colors = CardDefaults.cardColors(containerColor = Color(0xFF2A2A2A)) + ) { + SelectionContainer { + Text( + text = generatedToken, + color = Color.White, + fontSize = 12.sp, + fontFamily = FontFamily.Monospace, + modifier = Modifier.padding(16.dp), + textAlign = TextAlign.Center + ) + } + } } } - Spacer(modifier = Modifier.height(16.dp)) - + // Copy button Button( onClick = { clipboardManager.setText(AnnotatedString(generatedToken)) }, - modifier = Modifier.fillMaxWidth(), + modifier = Modifier + .fillMaxWidth() + .height(56.dp), colors = ButtonDefaults.buttonColors( containerColor = Color(0xFF00C851) ), - shape = RoundedCornerShape(8.dp) + shape = RoundedCornerShape(16.dp) ) { - Icon( - imageVector = Icons.Filled.ContentCopy, - contentDescription = "Copy", - tint = Color.Black - ) - Spacer(modifier = Modifier.width(8.dp)) - Text( - text = "Copy Token", - color = Color.Black, - fontWeight = FontWeight.Bold, - fontFamily = FontFamily.Monospace - ) + Row( + verticalAlignment = Alignment.CenterVertically + ) { + Icon( + imageVector = Icons.Filled.ContentCopy, + contentDescription = "Copy", + tint = Color.Black, + modifier = Modifier.size(24.dp) + ) + Spacer(modifier = Modifier.width(12.dp)) + Text( + text = "COPY TOKEN", + color = Color.Black, + fontSize = 16.sp, + fontWeight = FontWeight.Bold, + fontFamily = FontFamily.Monospace, + letterSpacing = 1.sp + ) + } } } } else { // Show input form - Column { + Column( + modifier = Modifier.fillMaxWidth() + ) { + // Amount input OutlinedTextField( value = amount, onValueChange = { amount = it }, @@ -239,14 +328,18 @@ private fun CashuSendContent( colors = OutlinedTextFieldDefaults.colors( focusedBorderColor = Color(0xFF00C851), focusedLabelColor = Color(0xFF00C851), + unfocusedBorderColor = Color(0xFF2A2A2A), + unfocusedLabelColor = Color.Gray, unfocusedTextColor = Color.White, focusedTextColor = Color.White ), - modifier = Modifier.fillMaxWidth() + modifier = Modifier + .fillMaxWidth() + .padding(bottom = 16.dp), + shape = RoundedCornerShape(16.dp) ) - Spacer(modifier = Modifier.height(16.dp)) - + // Memo input OutlinedTextField( value = memo, onValueChange = { memo = it }, @@ -259,14 +352,18 @@ private fun CashuSendContent( colors = OutlinedTextFieldDefaults.colors( focusedBorderColor = Color(0xFF00C851), focusedLabelColor = Color(0xFF00C851), + unfocusedBorderColor = Color(0xFF2A2A2A), + unfocusedLabelColor = Color.Gray, unfocusedTextColor = Color.White, focusedTextColor = Color.White ), - modifier = Modifier.fillMaxWidth() + modifier = Modifier + .fillMaxWidth() + .padding(bottom = 32.dp), + shape = RoundedCornerShape(16.dp) ) - Spacer(modifier = Modifier.height(24.dp)) - + // Create token button Button( onClick = { amount.toLongOrNull()?.let { amountSats -> @@ -274,30 +371,40 @@ private fun CashuSendContent( } }, enabled = !isLoading && amount.toLongOrNull()?.let { it > 0 && it <= maxAmount } == true, - modifier = Modifier.fillMaxWidth(), + modifier = Modifier + .fillMaxWidth() + .height(56.dp), colors = ButtonDefaults.buttonColors( - containerColor = Color(0xFF00C851) + containerColor = Color(0xFF00C851), + disabledContainerColor = Color(0xFF2A2A2A) ), - shape = RoundedCornerShape(8.dp) + shape = RoundedCornerShape(16.dp) ) { if (isLoading) { CircularProgressIndicator( color = Color.Black, - modifier = Modifier.size(16.dp) + modifier = Modifier.size(24.dp) ) } else { - Icon( - imageVector = Icons.Filled.Send, - contentDescription = "Create Token", - tint = Color.Black - ) - Spacer(modifier = Modifier.width(8.dp)) - Text( - text = "Create Token", - color = Color.Black, - fontWeight = FontWeight.Bold, - fontFamily = FontFamily.Monospace - ) + Row( + verticalAlignment = Alignment.CenterVertically + ) { + Icon( + imageVector = Icons.Filled.Toll, + contentDescription = "Create Token", + tint = Color.Black, + modifier = Modifier.size(24.dp) + ) + Spacer(modifier = Modifier.width(12.dp)) + Text( + text = "CREATE TOKEN", + color = Color.Black, + fontSize = 16.sp, + fontWeight = FontWeight.Bold, + fontFamily = FontFamily.Monospace, + letterSpacing = 1.sp + ) + } } } } @@ -312,119 +419,173 @@ private fun LightningSendContent( maxAmount: Long ) { var invoice by remember { mutableStateOf("") } + val clipboardManager = LocalClipboardManager.current if (currentMeltQuote != null) { // Show quote and pay button - Column { - Text( - text = "Lightning Invoice Quote", - color = Color(0xFF00C851), - fontSize = 16.sp, - fontWeight = FontWeight.Bold, - fontFamily = FontFamily.Monospace - ) - - Spacer(modifier = Modifier.height(16.dp)) - + Column( + modifier = Modifier.fillMaxWidth(), + horizontalAlignment = Alignment.CenterHorizontally + ) { + // Quote info card Card( - modifier = Modifier.fillMaxWidth(), - shape = RoundedCornerShape(8.dp), - colors = CardDefaults.cardColors(containerColor = Color(0xFF2A2A2A)) + modifier = Modifier + .fillMaxWidth() + .padding(bottom = 32.dp), + shape = RoundedCornerShape(16.dp), + colors = CardDefaults.cardColors(containerColor = Color(0xFF1A1A1A)) ) { - Column(modifier = Modifier.padding(16.dp)) { - Row( - modifier = Modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.SpaceBetween - ) { - Text( - text = "Amount:", - color = Color.Gray, - fontFamily = FontFamily.Monospace - ) - Text( - text = formatSats(currentMeltQuote.amount.toLong()), - color = Color.White, - fontFamily = FontFamily.Monospace - ) - } + Column( + modifier = Modifier + .fillMaxWidth() + .padding(24.dp), + horizontalAlignment = Alignment.CenterHorizontally + ) { + Icon( + imageVector = Icons.Filled.FlashOn, + contentDescription = "Lightning", + tint = Color(0xFFFFB000), + modifier = Modifier.size(48.dp) + ) - if (currentMeltQuote.feeReserve.toLong() > 0) { - Row( - modifier = Modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.SpaceBetween - ) { - Text( - text = "Fee:", - color = Color.Gray, - fontFamily = FontFamily.Monospace - ) - Text( - text = formatSats(currentMeltQuote.feeReserve.toLong()), - color = Color.White, - fontFamily = FontFamily.Monospace - ) - } - - Divider(color = Color.Gray, modifier = Modifier.padding(vertical = 8.dp)) - - Row( - modifier = Modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.SpaceBetween - ) { - Text( - text = "Total:", - color = Color.Gray, - fontFamily = FontFamily.Monospace, - fontWeight = FontWeight.Bold - ) - Text( - text = formatSats(currentMeltQuote.amount.toLong() + currentMeltQuote.feeReserve.toLong()), - color = Color.White, - fontFamily = FontFamily.Monospace, - fontWeight = FontWeight.Bold - ) + Spacer(modifier = Modifier.height(16.dp)) + + Text( + text = "LIGHTNING PAYMENT QUOTE", + color = Color(0xFFFFB000), + fontSize = 16.sp, + fontWeight = FontWeight.Bold, + fontFamily = FontFamily.Monospace, + letterSpacing = 1.sp + ) + + Spacer(modifier = Modifier.height(24.dp)) + + // Quote details + Card( + modifier = Modifier.fillMaxWidth(), + shape = RoundedCornerShape(12.dp), + colors = CardDefaults.cardColors(containerColor = Color(0xFF2A2A2A)) + ) { + Column(modifier = Modifier.padding(16.dp)) { + Row( + modifier = Modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.SpaceBetween + ) { + Text( + text = "Amount:", + color = Color.Gray, + fontFamily = FontFamily.Monospace, + fontSize = 14.sp + ) + Text( + text = formatSats(currentMeltQuote.amount.toLong()), + color = Color.White, + fontFamily = FontFamily.Monospace, + fontSize = 14.sp, + fontWeight = FontWeight.Bold + ) + } + + if (currentMeltQuote.feeReserve.toLong() > 0) { + Spacer(modifier = Modifier.height(8.dp)) + Row( + modifier = Modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.SpaceBetween + ) { + Text( + text = "Fee:", + color = Color.Gray, + fontFamily = FontFamily.Monospace, + fontSize = 14.sp + ) + Text( + text = formatSats(currentMeltQuote.feeReserve.toLong()), + color = Color.White, + fontFamily = FontFamily.Monospace, + fontSize = 14.sp, + fontWeight = FontWeight.Bold + ) + } + + Spacer(modifier = Modifier.height(8.dp)) + HorizontalDivider(color = Color.Gray) + Spacer(modifier = Modifier.height(8.dp)) + + Row( + modifier = Modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.SpaceBetween + ) { + Text( + text = "Total:", + color = Color.Gray, + fontFamily = FontFamily.Monospace, + fontSize = 14.sp, + fontWeight = FontWeight.Bold + ) + Text( + text = formatSats(currentMeltQuote.amount.toLong() + currentMeltQuote.feeReserve.toLong()), + color = Color.White, + fontFamily = FontFamily.Monospace, + fontSize = 14.sp, + fontWeight = FontWeight.Bold + ) + } + } } } } } - Spacer(modifier = Modifier.height(24.dp)) - + // Pay button Button( onClick = { viewModel.payLightningInvoice(currentMeltQuote.id) }, enabled = !isLoading, - modifier = Modifier.fillMaxWidth(), + modifier = Modifier + .fillMaxWidth() + .height(56.dp), colors = ButtonDefaults.buttonColors( - containerColor = Color(0xFF00C851) + containerColor = Color(0xFF00C851), + disabledContainerColor = Color(0xFF2A2A2A) ), - shape = RoundedCornerShape(8.dp) + shape = RoundedCornerShape(16.dp) ) { if (isLoading) { CircularProgressIndicator( color = Color.Black, - modifier = Modifier.size(16.dp) + modifier = Modifier.size(24.dp) ) } else { - Icon( - imageVector = Icons.Filled.FlashOn, - contentDescription = "Pay Invoice", - tint = Color.Black - ) - Spacer(modifier = Modifier.width(8.dp)) - Text( - text = "Pay Invoice", - color = Color.Black, - fontWeight = FontWeight.Bold, - fontFamily = FontFamily.Monospace - ) + Row( + verticalAlignment = Alignment.CenterVertically + ) { + Icon( + imageVector = Icons.Filled.FlashOn, + contentDescription = "Pay Invoice", + tint = Color.Black, + modifier = Modifier.size(24.dp) + ) + Spacer(modifier = Modifier.width(12.dp)) + Text( + text = "PAY INVOICE", + color = Color.Black, + fontSize = 16.sp, + fontWeight = FontWeight.Bold, + fontFamily = FontFamily.Monospace, + letterSpacing = 1.sp + ) + } } } } } else { // Show invoice input - Column { + Column( + modifier = Modifier.fillMaxWidth() + ) { + // Invoice input field OutlinedTextField( value = invoice, onValueChange = { invoice = it }, @@ -444,15 +605,76 @@ private fun LightningSendContent( colors = OutlinedTextFieldDefaults.colors( focusedBorderColor = Color(0xFF00C851), focusedLabelColor = Color(0xFF00C851), + unfocusedBorderColor = Color(0xFF2A2A2A), + unfocusedLabelColor = Color.Gray, unfocusedTextColor = Color.White, focusedTextColor = Color.White ), - modifier = Modifier.fillMaxWidth(), - maxLines = 3 + modifier = Modifier + .fillMaxWidth() + .padding(bottom = 24.dp), + minLines = 3, + maxLines = 4, + shape = RoundedCornerShape(16.dp), + trailingIcon = { + IconButton( + onClick = { + // TODO: Implement QR code scanning + } + ) { + Icon( + imageVector = Icons.Filled.QrCode, + contentDescription = "Scan QR", + tint = Color(0xFF00C851) + ) + } + } ) - Spacer(modifier = Modifier.height(24.dp)) + // Paste button + Button( + onClick = { + clipboardManager.getText()?.text?.let { clipText -> + if (clipText.startsWith("lnbc") || clipText.startsWith("lnbtb")) { + invoice = clipText + } + } + }, + modifier = Modifier + .fillMaxWidth() + .height(56.dp) + .padding(bottom = 16.dp), + colors = ButtonDefaults.buttonColors( + containerColor = Color.Transparent + ), + border = androidx.compose.foundation.BorderStroke( + 2.dp, + Color(0xFF00C851) + ), + shape = RoundedCornerShape(16.dp) + ) { + Row( + verticalAlignment = Alignment.CenterVertically + ) { + Icon( + imageVector = Icons.Filled.ContentPaste, + contentDescription = "Paste", + tint = Color(0xFF00C851), + modifier = Modifier.size(24.dp) + ) + Spacer(modifier = Modifier.width(12.dp)) + Text( + text = "PASTE FROM CLIPBOARD", + color = Color(0xFF00C851), + fontSize = 16.sp, + fontWeight = FontWeight.Bold, + fontFamily = FontFamily.Monospace, + letterSpacing = 1.sp + ) + } + } + // Get quote button Button( onClick = { if (invoice.isNotEmpty()) { @@ -460,30 +682,40 @@ private fun LightningSendContent( } }, enabled = !isLoading && invoice.isNotEmpty(), - modifier = Modifier.fillMaxWidth(), + modifier = Modifier + .fillMaxWidth() + .height(56.dp), colors = ButtonDefaults.buttonColors( - containerColor = Color(0xFF00C851) + containerColor = Color(0xFF00C851), + disabledContainerColor = Color(0xFF2A2A2A) ), - shape = RoundedCornerShape(8.dp) + shape = RoundedCornerShape(16.dp) ) { if (isLoading) { CircularProgressIndicator( color = Color.Black, - modifier = Modifier.size(16.dp) + modifier = Modifier.size(24.dp) ) } else { - Icon( - imageVector = Icons.Filled.Assessment, - contentDescription = "Get Quote", - tint = Color.Black - ) - Spacer(modifier = Modifier.width(8.dp)) - Text( - text = "Get Quote", - color = Color.Black, - fontWeight = FontWeight.Bold, - fontFamily = FontFamily.Monospace - ) + Row( + verticalAlignment = Alignment.CenterVertically + ) { + Icon( + imageVector = Icons.Filled.Assessment, + contentDescription = "Get Quote", + tint = Color.Black, + modifier = Modifier.size(24.dp) + ) + Spacer(modifier = Modifier.width(12.dp)) + Text( + text = "GET QUOTE", + color = Color.Black, + fontSize = 16.sp, + fontWeight = FontWeight.Bold, + fontFamily = FontFamily.Monospace, + letterSpacing = 1.sp + ) + } } } } diff --git a/app/src/main/java/com/bitchat/android/wallet/ui/WalletScreen.kt b/app/src/main/java/com/bitchat/android/wallet/ui/WalletScreen.kt index f49bed25..2a5cd877 100644 --- a/app/src/main/java/com/bitchat/android/wallet/ui/WalletScreen.kt +++ b/app/src/main/java/com/bitchat/android/wallet/ui/WalletScreen.kt @@ -27,6 +27,7 @@ fun WalletScreen( ) { var selectedTab by remember { mutableStateOf(0) } var showReceiveView by remember { mutableStateOf(false) } + var showSendView by remember { mutableStateOf(false) } val showSendDialog by walletViewModel.showSendDialog.observeAsState(false) val showReceiveDialog by walletViewModel.showReceiveDialog.observeAsState(false) @@ -39,6 +40,12 @@ fun WalletScreen( walletViewModel.hideReceiveDialog() true } + // Close send view + showSendView -> { + showSendView = false + walletViewModel.hideSendDialog() + true + } // Close send dialog showSendDialog -> { walletViewModel.hideSendDialog() @@ -66,6 +73,15 @@ fun WalletScreen( walletViewModel.hideReceiveDialog() } ) + } else if (showSendView) { + // Full-screen SendView + SendView( + viewModel = walletViewModel, + onNavigateBack = { + showSendView = false + walletViewModel.hideSendDialog() + } + ) } else { Column(modifier = modifier.fillMaxSize()) { // Content @@ -102,12 +118,13 @@ fun WalletScreen( } } - // Dialogs + // Handle dialog states if (showSendDialog) { - SendDialog( - viewModel = walletViewModel, - onDismiss = { walletViewModel.hideSendDialog() } - ) + LaunchedEffect(showSendDialog) { + if (showSendDialog) { + showSendView = true + } + } } if (showReceiveDialog) {