senddialog same design as receivedialog

This commit is contained in:
callebtc
2025-07-15 02:53:05 +02:00
parent f01cb686fc
commit 112abc0df5
2 changed files with 513 additions and 264 deletions
@@ -14,6 +14,7 @@ import androidx.compose.runtime.*
import androidx.compose.runtime.livedata.observeAsState import androidx.compose.runtime.livedata.observeAsState
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalClipboardManager import androidx.compose.ui.platform.LocalClipboardManager
import androidx.compose.ui.text.AnnotatedString 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.text.style.TextAlign
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp 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.data.MeltQuote
import com.bitchat.android.wallet.viewmodel.WalletViewModel 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 @Composable
fun SendDialog( fun SendView(
viewModel: WalletViewModel, viewModel: WalletViewModel,
onDismiss: () -> Unit onNavigateBack: () -> Unit
) { ) {
val sendType by viewModel.sendType.observeAsState(WalletViewModel.SendType.CASHU) val sendType by viewModel.sendType.observeAsState(WalletViewModel.SendType.CASHU)
val generatedToken by viewModel.generatedToken.observeAsState() val generatedToken by viewModel.generatedToken.observeAsState()
@@ -42,115 +41,163 @@ fun SendDialog(
val isLoading by viewModel.isLoading.observeAsState(false) val isLoading by viewModel.isLoading.observeAsState(false)
val balance by viewModel.balance.observeAsState(0L) val balance by viewModel.balance.observeAsState(0L)
Dialog( // Determine if we should show type selector
onDismissRequest = onDismiss, val showTypeSelector = generatedToken == null && currentMeltQuote == null
properties = DialogProperties(usePlatformDefaultWidth = false)
Box(
modifier = Modifier
.fillMaxSize()
.background(Color.Black)
) { ) {
Card( Column(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxSize()
.padding(16.dp), .padding(16.dp)
shape = RoundedCornerShape(16.dp), .verticalScroll(rememberScrollState())
colors = CardDefaults.cardColors(containerColor = Color(0xFF1A1A1A))
) { ) {
Column( // Header with back button
Row(
modifier = Modifier modifier = Modifier
.padding(24.dp) .fillMaxWidth()
.verticalScroll(rememberScrollState()) .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( Row(
modifier = Modifier.fillMaxWidth(), modifier = Modifier
.fillMaxWidth()
.padding(16.dp),
horizontalArrangement = Arrangement.SpaceBetween, horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically
) { ) {
Text( 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, color = Color.White,
fontSize = 20.sp, fontSize = 16.sp,
fontWeight = FontWeight.Bold, fontWeight = FontWeight.Bold,
fontFamily = FontFamily.Monospace fontFamily = FontFamily.Monospace
) )
IconButton(onClick = onDismiss) {
Icon(
imageVector = Icons.Filled.Close,
contentDescription = "Close",
tint = Color.Gray
)
}
} }
}
Spacer(modifier = Modifier.height(16.dp))
// Send type selector (only show when not displaying generated token or quote)
// Balance display if (showTypeSelector) {
Text( Card(
text = "Available: ${formatSats(balance)}", modifier = Modifier
color = Color.Gray, .fillMaxWidth()
fontSize = 14.sp, .padding(bottom = 24.dp),
fontFamily = FontFamily.Monospace shape = RoundedCornerShape(16.dp),
) colors = CardDefaults.cardColors(containerColor = Color(0xFF1A1A1A))
Spacer(modifier = Modifier.height(16.dp))
// Send type selector
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(8.dp)
) { ) {
FilterChip( Row(
onClick = { viewModel.setSendType(WalletViewModel.SendType.CASHU) }, modifier = Modifier
label = { .fillMaxWidth()
Text( .padding(8.dp),
text = "Cashu", horizontalArrangement = Arrangement.spacedBy(8.dp)
fontFamily = FontFamily.Monospace ) {
) FilterChip(
}, onClick = { viewModel.setSendType(WalletViewModel.SendType.CASHU) },
selected = sendType == WalletViewModel.SendType.CASHU, label = {
colors = FilterChipDefaults.filterChipColors( Text(
selectedContainerColor = Color(0xFF00C851), text = "Cashu Token",
selectedLabelColor = Color.Black fontFamily = FontFamily.Monospace,
), fontWeight = FontWeight.Medium
modifier = Modifier.weight(1f) )
) },
selected = sendType == WalletViewModel.SendType.CASHU,
FilterChip( colors = FilterChipDefaults.filterChipColors(
onClick = { viewModel.setSendType(WalletViewModel.SendType.LIGHTNING) }, selectedContainerColor = Color(0xFF00C851),
label = { selectedLabelColor = Color.Black,
Text( containerColor = Color(0xFF2A2A2A),
text = "Lightning", labelColor = Color.White
fontFamily = FontFamily.Monospace ),
) modifier = Modifier.weight(1f)
}, )
selected = sendType == WalletViewModel.SendType.LIGHTNING,
colors = FilterChipDefaults.filterChipColors( FilterChip(
selectedContainerColor = Color(0xFF00C851), onClick = { viewModel.setSendType(WalletViewModel.SendType.LIGHTNING) },
selectedLabelColor = Color.Black label = {
), Text(
modifier = Modifier.weight(1f) 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
) )
} }
WalletViewModel.SendType.LIGHTNING -> {
Spacer(modifier = Modifier.height(24.dp)) LightningSendContent(
viewModel = viewModel,
// Content based on send type currentMeltQuote = currentMeltQuote,
when (sendType) { isLoading = isLoading,
WalletViewModel.SendType.CASHU -> { maxAmount = balance
CashuSendContent( )
viewModel = viewModel,
generatedToken = generatedToken,
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) { if (generatedToken != null) {
// Show generated token // Show generated token
Column { Column(
Text( modifier = Modifier.fillMaxWidth(),
text = "Cashu Token Generated", horizontalAlignment = Alignment.CenterHorizontally
color = Color(0xFF00C851), ) {
fontSize = 16.sp, // Token info card
fontWeight = FontWeight.Bold,
fontFamily = FontFamily.Monospace
)
Spacer(modifier = Modifier.height(12.dp))
Card( Card(
modifier = Modifier.fillMaxWidth(), modifier = Modifier
shape = RoundedCornerShape(8.dp), .fillMaxWidth()
colors = CardDefaults.cardColors(containerColor = Color(0xFF2A2A2A)) .padding(bottom = 32.dp),
shape = RoundedCornerShape(16.dp),
colors = CardDefaults.cardColors(containerColor = Color(0xFF1A1A1A))
) { ) {
SelectionContainer { Column(
Text( modifier = Modifier
text = generatedToken, .fillMaxWidth()
color = Color.White, .padding(24.dp),
fontSize = 12.sp, horizontalAlignment = Alignment.CenterHorizontally
fontFamily = FontFamily.Monospace, ) {
modifier = Modifier.padding(16.dp) 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( Button(
onClick = { onClick = {
clipboardManager.setText(AnnotatedString(generatedToken)) clipboardManager.setText(AnnotatedString(generatedToken))
}, },
modifier = Modifier.fillMaxWidth(), modifier = Modifier
.fillMaxWidth()
.height(56.dp),
colors = ButtonDefaults.buttonColors( colors = ButtonDefaults.buttonColors(
containerColor = Color(0xFF00C851) containerColor = Color(0xFF00C851)
), ),
shape = RoundedCornerShape(8.dp) shape = RoundedCornerShape(16.dp)
) { ) {
Icon( Row(
imageVector = Icons.Filled.ContentCopy, verticalAlignment = Alignment.CenterVertically
contentDescription = "Copy", ) {
tint = Color.Black Icon(
) imageVector = Icons.Filled.ContentCopy,
Spacer(modifier = Modifier.width(8.dp)) contentDescription = "Copy",
Text( tint = Color.Black,
text = "Copy Token", modifier = Modifier.size(24.dp)
color = Color.Black, )
fontWeight = FontWeight.Bold, Spacer(modifier = Modifier.width(12.dp))
fontFamily = FontFamily.Monospace Text(
) text = "COPY TOKEN",
color = Color.Black,
fontSize = 16.sp,
fontWeight = FontWeight.Bold,
fontFamily = FontFamily.Monospace,
letterSpacing = 1.sp
)
}
} }
} }
} else { } else {
// Show input form // Show input form
Column { Column(
modifier = Modifier.fillMaxWidth()
) {
// Amount input
OutlinedTextField( OutlinedTextField(
value = amount, value = amount,
onValueChange = { amount = it }, onValueChange = { amount = it },
@@ -239,14 +328,18 @@ private fun CashuSendContent(
colors = OutlinedTextFieldDefaults.colors( colors = OutlinedTextFieldDefaults.colors(
focusedBorderColor = Color(0xFF00C851), focusedBorderColor = Color(0xFF00C851),
focusedLabelColor = Color(0xFF00C851), focusedLabelColor = Color(0xFF00C851),
unfocusedBorderColor = Color(0xFF2A2A2A),
unfocusedLabelColor = Color.Gray,
unfocusedTextColor = Color.White, unfocusedTextColor = Color.White,
focusedTextColor = 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( OutlinedTextField(
value = memo, value = memo,
onValueChange = { memo = it }, onValueChange = { memo = it },
@@ -259,14 +352,18 @@ private fun CashuSendContent(
colors = OutlinedTextFieldDefaults.colors( colors = OutlinedTextFieldDefaults.colors(
focusedBorderColor = Color(0xFF00C851), focusedBorderColor = Color(0xFF00C851),
focusedLabelColor = Color(0xFF00C851), focusedLabelColor = Color(0xFF00C851),
unfocusedBorderColor = Color(0xFF2A2A2A),
unfocusedLabelColor = Color.Gray,
unfocusedTextColor = Color.White, unfocusedTextColor = Color.White,
focusedTextColor = 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( Button(
onClick = { onClick = {
amount.toLongOrNull()?.let { amountSats -> amount.toLongOrNull()?.let { amountSats ->
@@ -274,30 +371,40 @@ private fun CashuSendContent(
} }
}, },
enabled = !isLoading && amount.toLongOrNull()?.let { it > 0 && it <= maxAmount } == true, enabled = !isLoading && amount.toLongOrNull()?.let { it > 0 && it <= maxAmount } == true,
modifier = Modifier.fillMaxWidth(), modifier = Modifier
.fillMaxWidth()
.height(56.dp),
colors = ButtonDefaults.buttonColors( colors = ButtonDefaults.buttonColors(
containerColor = Color(0xFF00C851) containerColor = Color(0xFF00C851),
disabledContainerColor = Color(0xFF2A2A2A)
), ),
shape = RoundedCornerShape(8.dp) shape = RoundedCornerShape(16.dp)
) { ) {
if (isLoading) { if (isLoading) {
CircularProgressIndicator( CircularProgressIndicator(
color = Color.Black, color = Color.Black,
modifier = Modifier.size(16.dp) modifier = Modifier.size(24.dp)
) )
} else { } else {
Icon( Row(
imageVector = Icons.Filled.Send, verticalAlignment = Alignment.CenterVertically
contentDescription = "Create Token", ) {
tint = Color.Black Icon(
) imageVector = Icons.Filled.Toll,
Spacer(modifier = Modifier.width(8.dp)) contentDescription = "Create Token",
Text( tint = Color.Black,
text = "Create Token", modifier = Modifier.size(24.dp)
color = Color.Black, )
fontWeight = FontWeight.Bold, Spacer(modifier = Modifier.width(12.dp))
fontFamily = FontFamily.Monospace 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 maxAmount: Long
) { ) {
var invoice by remember { mutableStateOf("") } var invoice by remember { mutableStateOf("") }
val clipboardManager = LocalClipboardManager.current
if (currentMeltQuote != null) { if (currentMeltQuote != null) {
// Show quote and pay button // Show quote and pay button
Column { Column(
Text( modifier = Modifier.fillMaxWidth(),
text = "Lightning Invoice Quote", horizontalAlignment = Alignment.CenterHorizontally
color = Color(0xFF00C851), ) {
fontSize = 16.sp, // Quote info card
fontWeight = FontWeight.Bold,
fontFamily = FontFamily.Monospace
)
Spacer(modifier = Modifier.height(16.dp))
Card( Card(
modifier = Modifier.fillMaxWidth(), modifier = Modifier
shape = RoundedCornerShape(8.dp), .fillMaxWidth()
colors = CardDefaults.cardColors(containerColor = Color(0xFF2A2A2A)) .padding(bottom = 32.dp),
shape = RoundedCornerShape(16.dp),
colors = CardDefaults.cardColors(containerColor = Color(0xFF1A1A1A))
) { ) {
Column(modifier = Modifier.padding(16.dp)) { Column(
Row( modifier = Modifier
modifier = Modifier.fillMaxWidth(), .fillMaxWidth()
horizontalArrangement = Arrangement.SpaceBetween .padding(24.dp),
) { horizontalAlignment = Alignment.CenterHorizontally
Text( ) {
text = "Amount:", Icon(
color = Color.Gray, imageVector = Icons.Filled.FlashOn,
fontFamily = FontFamily.Monospace contentDescription = "Lightning",
) tint = Color(0xFFFFB000),
Text( modifier = Modifier.size(48.dp)
text = formatSats(currentMeltQuote.amount.toLong()), )
color = Color.White,
fontFamily = FontFamily.Monospace
)
}
if (currentMeltQuote.feeReserve.toLong() > 0) { Spacer(modifier = Modifier.height(16.dp))
Row(
modifier = Modifier.fillMaxWidth(), Text(
horizontalArrangement = Arrangement.SpaceBetween text = "LIGHTNING PAYMENT QUOTE",
) { color = Color(0xFFFFB000),
Text( fontSize = 16.sp,
text = "Fee:", fontWeight = FontWeight.Bold,
color = Color.Gray, fontFamily = FontFamily.Monospace,
fontFamily = FontFamily.Monospace letterSpacing = 1.sp
) )
Text(
text = formatSats(currentMeltQuote.feeReserve.toLong()), Spacer(modifier = Modifier.height(24.dp))
color = Color.White,
fontFamily = FontFamily.Monospace // Quote details
) Card(
} modifier = Modifier.fillMaxWidth(),
shape = RoundedCornerShape(12.dp),
Divider(color = Color.Gray, modifier = Modifier.padding(vertical = 8.dp)) colors = CardDefaults.cardColors(containerColor = Color(0xFF2A2A2A))
) {
Row( Column(modifier = Modifier.padding(16.dp)) {
modifier = Modifier.fillMaxWidth(), Row(
horizontalArrangement = Arrangement.SpaceBetween modifier = Modifier.fillMaxWidth(),
) { horizontalArrangement = Arrangement.SpaceBetween
Text( ) {
text = "Total:", Text(
color = Color.Gray, text = "Amount:",
fontFamily = FontFamily.Monospace, color = Color.Gray,
fontWeight = FontWeight.Bold fontFamily = FontFamily.Monospace,
) fontSize = 14.sp
Text( )
text = formatSats(currentMeltQuote.amount.toLong() + currentMeltQuote.feeReserve.toLong()), Text(
color = Color.White, text = formatSats(currentMeltQuote.amount.toLong()),
fontFamily = FontFamily.Monospace, color = Color.White,
fontWeight = FontWeight.Bold 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( Button(
onClick = { onClick = {
viewModel.payLightningInvoice(currentMeltQuote.id) viewModel.payLightningInvoice(currentMeltQuote.id)
}, },
enabled = !isLoading, enabled = !isLoading,
modifier = Modifier.fillMaxWidth(), modifier = Modifier
.fillMaxWidth()
.height(56.dp),
colors = ButtonDefaults.buttonColors( colors = ButtonDefaults.buttonColors(
containerColor = Color(0xFF00C851) containerColor = Color(0xFF00C851),
disabledContainerColor = Color(0xFF2A2A2A)
), ),
shape = RoundedCornerShape(8.dp) shape = RoundedCornerShape(16.dp)
) { ) {
if (isLoading) { if (isLoading) {
CircularProgressIndicator( CircularProgressIndicator(
color = Color.Black, color = Color.Black,
modifier = Modifier.size(16.dp) modifier = Modifier.size(24.dp)
) )
} else { } else {
Icon( Row(
imageVector = Icons.Filled.FlashOn, verticalAlignment = Alignment.CenterVertically
contentDescription = "Pay Invoice", ) {
tint = Color.Black Icon(
) imageVector = Icons.Filled.FlashOn,
Spacer(modifier = Modifier.width(8.dp)) contentDescription = "Pay Invoice",
Text( tint = Color.Black,
text = "Pay Invoice", modifier = Modifier.size(24.dp)
color = Color.Black, )
fontWeight = FontWeight.Bold, Spacer(modifier = Modifier.width(12.dp))
fontFamily = FontFamily.Monospace Text(
) text = "PAY INVOICE",
color = Color.Black,
fontSize = 16.sp,
fontWeight = FontWeight.Bold,
fontFamily = FontFamily.Monospace,
letterSpacing = 1.sp
)
}
} }
} }
} }
} else { } else {
// Show invoice input // Show invoice input
Column { Column(
modifier = Modifier.fillMaxWidth()
) {
// Invoice input field
OutlinedTextField( OutlinedTextField(
value = invoice, value = invoice,
onValueChange = { invoice = it }, onValueChange = { invoice = it },
@@ -444,15 +605,76 @@ private fun LightningSendContent(
colors = OutlinedTextFieldDefaults.colors( colors = OutlinedTextFieldDefaults.colors(
focusedBorderColor = Color(0xFF00C851), focusedBorderColor = Color(0xFF00C851),
focusedLabelColor = Color(0xFF00C851), focusedLabelColor = Color(0xFF00C851),
unfocusedBorderColor = Color(0xFF2A2A2A),
unfocusedLabelColor = Color.Gray,
unfocusedTextColor = Color.White, unfocusedTextColor = Color.White,
focusedTextColor = Color.White focusedTextColor = Color.White
), ),
modifier = Modifier.fillMaxWidth(), modifier = Modifier
maxLines = 3 .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( Button(
onClick = { onClick = {
if (invoice.isNotEmpty()) { if (invoice.isNotEmpty()) {
@@ -460,30 +682,40 @@ private fun LightningSendContent(
} }
}, },
enabled = !isLoading && invoice.isNotEmpty(), enabled = !isLoading && invoice.isNotEmpty(),
modifier = Modifier.fillMaxWidth(), modifier = Modifier
.fillMaxWidth()
.height(56.dp),
colors = ButtonDefaults.buttonColors( colors = ButtonDefaults.buttonColors(
containerColor = Color(0xFF00C851) containerColor = Color(0xFF00C851),
disabledContainerColor = Color(0xFF2A2A2A)
), ),
shape = RoundedCornerShape(8.dp) shape = RoundedCornerShape(16.dp)
) { ) {
if (isLoading) { if (isLoading) {
CircularProgressIndicator( CircularProgressIndicator(
color = Color.Black, color = Color.Black,
modifier = Modifier.size(16.dp) modifier = Modifier.size(24.dp)
) )
} else { } else {
Icon( Row(
imageVector = Icons.Filled.Assessment, verticalAlignment = Alignment.CenterVertically
contentDescription = "Get Quote", ) {
tint = Color.Black Icon(
) imageVector = Icons.Filled.Assessment,
Spacer(modifier = Modifier.width(8.dp)) contentDescription = "Get Quote",
Text( tint = Color.Black,
text = "Get Quote", modifier = Modifier.size(24.dp)
color = Color.Black, )
fontWeight = FontWeight.Bold, Spacer(modifier = Modifier.width(12.dp))
fontFamily = FontFamily.Monospace Text(
) text = "GET QUOTE",
color = Color.Black,
fontSize = 16.sp,
fontWeight = FontWeight.Bold,
fontFamily = FontFamily.Monospace,
letterSpacing = 1.sp
)
}
} }
} }
} }
@@ -27,6 +27,7 @@ fun WalletScreen(
) { ) {
var selectedTab by remember { mutableStateOf(0) } var selectedTab by remember { mutableStateOf(0) }
var showReceiveView by remember { mutableStateOf(false) } var showReceiveView by remember { mutableStateOf(false) }
var showSendView by remember { mutableStateOf(false) }
val showSendDialog by walletViewModel.showSendDialog.observeAsState(false) val showSendDialog by walletViewModel.showSendDialog.observeAsState(false)
val showReceiveDialog by walletViewModel.showReceiveDialog.observeAsState(false) val showReceiveDialog by walletViewModel.showReceiveDialog.observeAsState(false)
@@ -39,6 +40,12 @@ fun WalletScreen(
walletViewModel.hideReceiveDialog() walletViewModel.hideReceiveDialog()
true true
} }
// Close send view
showSendView -> {
showSendView = false
walletViewModel.hideSendDialog()
true
}
// Close send dialog // Close send dialog
showSendDialog -> { showSendDialog -> {
walletViewModel.hideSendDialog() walletViewModel.hideSendDialog()
@@ -66,6 +73,15 @@ fun WalletScreen(
walletViewModel.hideReceiveDialog() walletViewModel.hideReceiveDialog()
} }
) )
} else if (showSendView) {
// Full-screen SendView
SendView(
viewModel = walletViewModel,
onNavigateBack = {
showSendView = false
walletViewModel.hideSendDialog()
}
)
} else { } else {
Column(modifier = modifier.fillMaxSize()) { Column(modifier = modifier.fillMaxSize()) {
// Content // Content
@@ -102,12 +118,13 @@ fun WalletScreen(
} }
} }
// Dialogs // Handle dialog states
if (showSendDialog) { if (showSendDialog) {
SendDialog( LaunchedEffect(showSendDialog) {
viewModel = walletViewModel, if (showSendDialog) {
onDismiss = { walletViewModel.hideSendDialog() } showSendView = true
) }
}
} }
if (showReceiveDialog) { if (showReceiveDialog) {