Skip to content

Commit a792092

Browse files
committed
refactor(feature:send-money): improve ui ux in payment chat history and payment details screens
1 parent d39688a commit a792092

File tree

3 files changed

+17
-33
lines changed

3 files changed

+17
-33
lines changed

feature/send-money/src/commonMain/kotlin/org/mifospay/feature/send/money/PaymentChatHistoryScreen.kt

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ import androidx.compose.ui.unit.sp
5353
import androidx.lifecycle.compose.collectAsStateWithLifecycle
5454
import org.koin.compose.viewmodel.koinViewModel
5555
import org.mifospay.core.common.CurrencyFormatter
56-
import org.mifospay.core.common.DateHelper
5756
import org.mifospay.core.designsystem.component.MifosScaffold
5857
import org.mifospay.core.designsystem.icon.MifosIcons
5958
import org.mifospay.core.ui.AvatarBox
6059
import template.core.base.designsystem.theme.KptTheme
6160

61+
// TODO make the topbar back button consistent with other screens
6262
@Composable
6363
fun PaymentChatHistoryScreen(
6464
onBackClick: () -> Unit,
@@ -143,7 +143,7 @@ private fun UserProfileTopBar(
143143
Text(
144144
text = if (userType == UserType.BUSINESS) businessName else bankingName,
145145
style = KptTheme.typography.titleMedium,
146-
fontWeight = FontWeight.SemiBold,
146+
fontWeight = FontWeight.Medium,
147147
color = KptTheme.colorScheme.onSurface,
148148
)
149149

@@ -226,7 +226,7 @@ private fun PaymentHistoryGroup(
226226
}
227227

228228
if (transaction != group.transactions.last()) {
229-
Spacer(modifier = Modifier.height(8.dp))
229+
Spacer(modifier = Modifier.height(16.dp))
230230
}
231231
}
232232
}
@@ -258,13 +258,9 @@ private fun PaymentCard(
258258
.padding(16.dp),
259259
) {
260260
Text(
261-
text = if (transaction.isSent) {
262-
"Payment to ${getFirstName(transaction.recipientName)}"
263-
} else {
264-
"Payment from ${getFirstName(transaction.recipientName)}"
265-
},
261+
text = "Payment to ${getFirstName(transaction.recipientName)}",
266262
style = KptTheme.typography.titleMedium,
267-
fontWeight = FontWeight.SemiBold,
263+
fontWeight = FontWeight.Medium,
268264
color = KptTheme.colorScheme.onSurface,
269265
)
270266

@@ -281,7 +277,7 @@ private fun PaymentCard(
281277
Text(
282278
text = formatAmount(transaction.amount),
283279
style = KptTheme.typography.headlineSmall,
284-
fontWeight = FontWeight.SemiBold,
280+
fontWeight = FontWeight.Medium,
285281
color = KptTheme.colorScheme.onSurface,
286282
)
287283

@@ -304,7 +300,7 @@ private fun PaymentCard(
304300
Text(
305301
text = "Paid - ${formatPaymentDate(transaction.paymentDate)}",
306302
style = KptTheme.typography.bodyMedium,
307-
fontWeight = FontWeight.SemiBold,
303+
fontWeight = FontWeight.Medium,
308304
color = KptTheme.colorScheme.onSurfaceVariant,
309305
)
310306
}
@@ -350,7 +346,7 @@ private fun PaymentActionBar(
350346
Text(
351347
text = "Pay",
352348
style = KptTheme.typography.titleMedium,
353-
fontWeight = FontWeight.SemiBold,
349+
fontWeight = FontWeight.Medium,
354350
)
355351
}
356352

@@ -435,18 +431,6 @@ private fun MessageInput(
435431
}
436432
}
437433

438-
private fun formatGroupDate(dateString: String): String {
439-
return try {
440-
// Parse the date string (e.g., "27 Aug 2025") and add current time
441-
val currentDate = DateHelper.currentDate
442-
val time = "${currentDate.hour.toString().padStart(2, '0')}:${currentDate.minute.toString().padStart(2, '0')}"
443-
val amPm = if (currentDate.hour < 12) "am" else "pm"
444-
"$dateString, $time $amPm"
445-
} catch (e: Exception) {
446-
dateString
447-
}
448-
}
449-
450434
private fun formatPaymentDate(dateString: String): String {
451435
return try {
452436
// Extract day, month, and year from the date string (e.g., "25 Sep 2023")

feature/send-money/src/commonMain/kotlin/org/mifospay/feature/send/money/PaymentChatHistoryViewModel.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class PaymentChatHistoryViewModel : ViewModel() {
6464
transactions = listOf(
6565
PaymentTransaction(
6666
transactionId = "txn_005",
67-
recipientName = "Lisa Chen",
67+
recipientName = "Jane Smith",
6868
amount = "3,200.00",
6969
note = "Shopping payment",
7070
paymentDate = "25 Sep 2025",
@@ -78,7 +78,7 @@ class PaymentChatHistoryViewModel : ViewModel() {
7878
transactions = listOf(
7979
PaymentTransaction(
8080
transactionId = "txn_003",
81-
recipientName = "Emma Davis",
81+
recipientName = "Jane Smith",
8282
amount = "2,000.00",
8383
note = "Dinner payment",
8484
paymentDate = "26 Sep 2025",
@@ -87,7 +87,7 @@ class PaymentChatHistoryViewModel : ViewModel() {
8787
),
8888
PaymentTransaction(
8989
transactionId = "txn_004",
90-
recipientName = "Alex Brown",
90+
recipientName = "You",
9191
amount = "750.00",
9292
note = "Movie tickets",
9393
paymentDate = "26 Sep 2025",
@@ -101,7 +101,7 @@ class PaymentChatHistoryViewModel : ViewModel() {
101101
transactions = listOf(
102102
PaymentTransaction(
103103
transactionId = "txn_001",
104-
recipientName = "Sarah Wilson",
104+
recipientName = "Jane Smith",
105105
amount = "1,500.00",
106106
note = "Lunch payment",
107107
paymentDate = "27 Sep 2025",
@@ -110,7 +110,7 @@ class PaymentChatHistoryViewModel : ViewModel() {
110110
),
111111
PaymentTransaction(
112112
transactionId = "txn_002",
113-
recipientName = "Mike Johnson",
113+
recipientName = "Jane Smith",
114114
amount = "500.00",
115115
note = "Coffee and snacks",
116116
paymentDate = "27 Sep 2025",

feature/send-money/src/commonMain/kotlin/org/mifospay/feature/send/money/PaymentDetailsViewModel.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,22 @@ class PaymentDetailsViewModel : ViewModel() {
4444
*/
4545
private fun createPlaceholderState(): PaymentDetailsState {
4646
return PaymentDetailsState(
47-
payeeName = "Sarah Wilson",
47+
payeeName = "Jane Smith",
4848
isBusiness = false,
4949
bankingName = "TechCorp Solutions",
5050
phoneNumber = "+91 98765 43210",
51-
upiId = "sarah.wilson@upi",
51+
upiId = "jane.smith@upi",
5252
profileImageUrl = null,
5353
amount = "1,500.00",
5454
formattedAmount = "₹1,500.00",
5555
note = "Lunch payment",
5656
isPaymentSuccessful = true,
5757
upiTransactionId = "UPI123456789012345",
58-
payerName = "John Doe",
58+
payerName = "Biplab Dutta",
5959
payerBankName = "HDFC Bank",
6060
payerAccountLast4Digits = "1234",
6161
payerUpiAppName = "Google Pay",
62-
payerUpiId = "john.doe@okicici",
62+
payerUpiId = "biplabdutta@okicici",
6363
upiAppName = "PhonePe",
6464
mifosTransactionId = "MF123456789",
6565
transactionDate = "27 Sept 2025, 2:30 PM",

0 commit comments

Comments
 (0)