Skip to content

Conversation

@kartikey004
Copy link
Contributor

@kartikey004 kartikey004 commented Dec 27, 2025

Fixes - Jira-#618

Problem

When a user opens the navigation drawer and selects any drawer item (e.g. Settings, About, Path Tracking, Checker Inbox), the destination screen is opened without a toolbar, leaving no way to navigate back.

Solution

Added a top app bar to all Navigation Drawer destination screens
Toolbar includes a Back button to allow users to return to the previous screen
Ensured consistent behavior across all drawer items
Home / bottom-navigation screens remain unchanged and continue to show the menu icon

Result

All drawer screens now have a visible toolbar
Back navigation works correctly from every drawer destination
Improves usability and navigation consistency

Screenshots

Screenshot_20251227_172730 Screenshot_20251227_172753 Screenshot_20251227_172945 Screenshot_20251227_173016 Screenshot_20251227_173032

Summary by CodeRabbit

  • Style

    • Unified top app bar presentation across many screens with consistent back navigation and colors.
    • Refined client list cards and avatars, updated typography and spacing.
    • Minor string tweak: "Offline Sync" label cleaned up.
  • Refactor

    • Reworked several screen layouts for clearer structure and scrolling behavior.
    • Reorganized payment details into a clearer, two-column layout with expandable additional fields.
  • Chores

    • Removed unused preview/demo code and simplified some settings menu options.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 27, 2025

📝 Walkthrough

Walkthrough

Introduces Material3 TopAppBar usage across many screens, refactors Client list UI, rewrites Payment Details screen with scaffold/top bar and additional fields, threads onBackPressed through collection sheet navigation, replaces some Scaffolds with scrolling Columns, and updates one string resource.

Changes

Cohort / File(s) Summary
TopAppBar Migrations
feature/about/.../AboutScreen.kt, feature/checker-inbox-task/.../CheckerInboxTasksScreen.kt, feature/collectionSheet/.../IndividualCollectionSheetScreen.kt, feature/offline/.../OfflineDashboardScreen.kt, feature/path-tracking/.../PathTrackingScreen.kt, feature/settings/.../SettingsScreen.kt
Replaced scaffold title/onBackPressed usage with explicit Material3 TopAppBar (navigationIcon back button, title, colors). Added ExperimentalMaterial3 opt-ins and relevant imports.
Client List UI Redesign
feature/client/.../ClientListScreen.kt
UI overhaul: OutlinedCardElevatedCard, avatar now Surface+Image, adjusted paddings, typography, ellipses, sync indicator switched to Icon, added contentPadding and layout tweaks.
Payment Details Screen Refactor
feature/collectionSheet/.../PaymentDetailsScreen.kt
Added onBackPressed parameter, wrapped content in MifosScaffold with TopAppBar, added snackbarHostState, reorganized payment details into two-column card, added "Add payment detail" section with payment-type dropdown, multiple input fields, and save/cancel row (MifosButtonRow).
Navigation Threading
feature/collectionSheet/.../CollectionSheetNavigation.kt
paymentDetailsScreen signature updated to accept onBackPressed: () -> Unit and threaded through to composable call sites; removed unused import.
Layout Restructuring (New Individual Collection)
feature/collectionSheet/.../NewIndividualCollectionSheetScreen.kt
Replaced MifosScaffold with a Column + rememberScrollState for vertical scrolling; removed scaffold padding usage.
Top Bar Actions Refactor
feature/report/.../RunReportScreen.kt
Removed title content from topBar and added interactive actions with a clickable menu and DropdownMenu items that update title and call onMenuClick.
Design System: Conditional Top Bar
core/designsystem/.../MifosScaffold.kt
Added conditional MifosDetailTopBar private composable and render logic when title is non-null; uses TopAppBar + back icon and configurable actions.
String Resource Update
feature/offline/.../strings.xml
Changed feature_offline_offline_Sync from "Offline Sync *" to "Offline Sync".

Sequence Diagram(s)

sequenceDiagram
  %%{init: {"themeVariables":{"actorBackground":"#F6F7FB","actorBorder":"#D0D7E6","noteBackground":"#F2F4F8"}}}%%
  participant Nav as NavHost
  participant NavBuilder as CollectionSheetNavGraph
  participant Screen as PaymentDetailsScreenRoute
  participant UI as PaymentsDetailsScreen
  participant VM as PaymentDetailsViewModel
  participant Snackbar as SnackbarHost

  Nav ->> NavBuilder: navigateToPaymentDetailsScreen(payload)
  NavBuilder ->> Screen: paymentDetailsScreen(onBackPressed)
  Screen ->> UI: composable(payload, onBackPressed)
  UI ->> VM: loadPaymentData(clientId)
  VM -->> UI: paymentData
  UI ->> UI: user edits fields, toggles payment type
  UI ->> VM: onSaveAdditionalItem(payload)
  VM -->> Snackbar: emit success/failure
  UI ->> Snackbar: show message
  UI ->> Nav: onBackPressed()  --x back navigation
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • TheKalpeshPawar
  • Arinyadav1

Poem

🐰 I hopped through bars of TopApp, bright and new,
Cards polished clean, avatars in view,
Payments sorted in a tidy row,
Nav threads stitched so back buttons go—
Hooray, the UI hops anew!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 3.70% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Added toolbar for Navigation Drawer screens' accurately describes the main change across the PR—adding top app bars with back navigation to Navigation Drawer destination screens for improved navigation consistency.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
feature/collectionSheet/src/commonMain/kotlin/com/mifos/feature/individualCollectionSheet/newIndividualCollectionSheet/NewIndividualCollectionSheetScreen.kt (1)

151-213: Remove nested scroll modifiers to fix scrolling conflicts.

The outer Column (line 151) and the inner Column (line 210) both have verticalScroll(rememberScrollState()), creating nested scrollable containers in the same direction. This will cause scrolling conflicts and unpredictable behavior where touch events cannot determine which scrollable should respond.

🔎 Proposed fix

Remove the scroll modifier from the outer Column since the inner Column (which contains the actual content) should handle scrolling:

     Column(
         modifier = modifier
-            .fillMaxSize()
-            .verticalScroll(rememberScrollState()),
+            .fillMaxSize(),
     ) {
feature/report/src/commonMain/kotlin/com/mifos/feature/report/runReport/RunReportScreen.kt (1)

165-165: Use theme color instead of hardcoded White.

The DropdownMenu background uses a hardcoded White color, which won't adapt to theme changes (e.g., dark mode) and breaks theme consistency.

🔎 Proposed fix
                     DropdownMenu(
-                        modifier = Modifier.background(White),
+                        modifier = Modifier.background(MaterialTheme.colorScheme.surface),
                         expanded = showMenu,
                         onDismissRequest = { showMenu = false },
                     ) {
feature/collectionSheet/src/commonMain/kotlin/com/mifos/feature/individualCollectionSheet/paymentDetails/PaymentDetailsScreen.kt (1)

153-198: Validation flag isAnyDetailNull is computed but not enforced.

The saveAdditional function sets isAnyDetailNull = true when fields are empty, but then saves the transaction regardless. This allows incomplete payment details to be saved without user feedback.

Consider either:

  1. Preventing the save operation when isAnyDetailNull is true and showing a snackbar/error message to the user
  2. Removing the validation logic if partial details are acceptable
🔎 Proposed fix to enforce validation
         if (!isAnyDetailNull) {
             noPaymentVisibility = false
+            onSaveAdditionalItem(bulkRepaymentTransactions, position)
+            showAdditionalDetails = false
+        } else {
+            // Show error to user via snackbar
         }
-        onSaveAdditionalItem(bulkRepaymentTransactions, position)
-        showAdditionalDetails = false
     }
🧹 Nitpick comments (10)
feature/about/src/commonMain/kotlin/com/mifos/feature/about/AboutScreen.kt (1)

74-75: Consider localizing the contentDescription string.

The hardcoded string "Navigate back" should ideally be extracted to a string resource for proper localization support, consistent with other UI strings in the file.

💡 Example refactor

Add a string resource (e.g., feature_about_navigate_back) and use:

-                            contentDescription = "Navigate back"
+                            contentDescription = stringResource(Res.string.feature_about_navigate_back)
feature/path-tracking/src/commonMain/kotlin/com/mifos/feature/path/tracking/PathTrackingScreen.kt (1)

132-136: Use string resource for contentDescription.

The hardcoded string "Navigate back" should be externalized to a string resource for proper localization support.

🔎 Suggested approach

Add a string resource (e.g., feature_path_tracking_navigate_back) and reference it:

                 navigationIcon = {
                     IconButton(onClick = onBackPressed) {
                         Icon(
                             imageVector = MifosIcons.ArrowBack,
-                            contentDescription = "Navigate back"
+                            contentDescription = stringResource(Res.string.feature_path_tracking_navigate_back)
                         )
                     }
                 },
feature/report/src/commonMain/kotlin/com/mifos/feature/report/runReport/RunReportScreen.kt (1)

149-157: Use MaterialTheme typography instead of manual TextStyle.

The menu title Text uses a manually constructed TextStyle rather than MaterialTheme.typography, which reduces consistency with the app's design system.

🔎 Proposed fix
                         Text(
                             text = menuTitle,
-                            style = TextStyle(
-                                fontSize = 24.sp,
-                                fontWeight = FontWeight.Medium,
-                                fontStyle = FontStyle.Normal,
-                            ),
+                            style = MaterialTheme.typography.titleLarge,
                             textAlign = TextAlign.Start,
                         )
feature/offline/src/commonMain/kotlin/com/mifos/feature/offline/dashboard/OfflineDashboardScreen.kt (1)

135-140: Use string resource for contentDescription.

The hardcoded string "Navigate back" should be externalized to a string resource for proper localization support.

feature/settings/src/commonMain/kotlin/com/mifos/feature/settings/settings/SettingsScreen.kt (1)

124-129: Use string resource for contentDescription.

The hardcoded string "Navigate back" should be externalized to a string resource for proper localization support and consistency with other accessibility strings.

feature/collectionSheet/src/commonMain/kotlin/com/mifos/feature/individualCollectionSheet/individualCollectionSheet/IndividualCollectionSheetScreen.kt (1)

72-76: Use string resource for contentDescription.

The hardcoded string "Navigate back" should be externalized to a string resource for proper localization support.

feature/collectionSheet/src/commonMain/kotlin/com/mifos/feature/individualCollectionSheet/paymentDetails/PaymentDetailsScreen.kt (2)

216-216: Use string resource for the title.

The hardcoded "Payment Details" string should be externalized to a string resource for proper localization support.

🔎 Suggested approach

Add a string resource (e.g., feature_collection_sheet_payment_details) and reference it:

             TopAppBar(
-                title = { Text(text = "Payment Details") },
+                title = { Text(text = stringResource(Res.string.feature_collection_sheet_payment_details)) },
                 navigationIcon = {

218-223: Use string resource for contentDescription.

The hardcoded string "Navigate back" should be externalized to a string resource for proper localization support.

feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientList/ClientListScreen.kt (2)

319-321: Consider using Scaffold's contentPadding instead of hardcoded bottom padding.

The hardcoded 80.dp bottom padding likely accounts for the FAB, but this approach is fragile. The Scaffold already provides contentPadding through its lambda parameter, which automatically handles insets for FABs, bottom bars, etc. Consider using that instead for better adaptability across different screen configurations.

🔎 Suggested improvement
 @Composable
-private fun LazyColumnForClientListDb(clientList: List<ClientEntity>) {
+private fun LazyColumnForClientListDb(
+    clientList: List<ClientEntity>,
+    contentPadding: PaddingValues = PaddingValues(0.dp)
+) {
     LazyColumn(
-        contentPadding = PaddingValues(top = 8.dp, bottom = 80.dp)
+        contentPadding = PaddingValues(
+            top = 8.dp,
+            bottom = contentPadding.calculateBottomPadding()
+        )
     ) {

Then pass the scaffold's padding from the call site.


430-432: Column wrapper in preview appears unnecessary.

The Column wrapper around LazyColumnForClientListDb in the preview doesn't appear to serve a purpose. If it's not needed for future additions, consider removing it for simplicity.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 78b3242 and c144386.

📒 Files selected for processing (12)
  • feature/about/src/commonMain/kotlin/com/mifos/feature/about/AboutScreen.kt
  • feature/checker-inbox-task/src/commonMain/kotlin/com/mifos/feature/checker/inbox/task/checkerInboxTasks/CheckerInboxTasksScreen.kt
  • feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientList/ClientListScreen.kt
  • feature/collectionSheet/src/commonMain/kotlin/com/mifos/feature/individualCollectionSheet/individualCollectionSheet/IndividualCollectionSheetScreen.kt
  • feature/collectionSheet/src/commonMain/kotlin/com/mifos/feature/individualCollectionSheet/navigation/CollectionSheetNavigation.kt
  • feature/collectionSheet/src/commonMain/kotlin/com/mifos/feature/individualCollectionSheet/newIndividualCollectionSheet/NewIndividualCollectionSheetScreen.kt
  • feature/collectionSheet/src/commonMain/kotlin/com/mifos/feature/individualCollectionSheet/paymentDetails/PaymentDetailsScreen.kt
  • feature/offline/src/commonMain/composeResources/values/strings.xml
  • feature/offline/src/commonMain/kotlin/com/mifos/feature/offline/dashboard/OfflineDashboardScreen.kt
  • feature/path-tracking/src/commonMain/kotlin/com/mifos/feature/path/tracking/PathTrackingScreen.kt
  • feature/report/src/commonMain/kotlin/com/mifos/feature/report/runReport/RunReportScreen.kt
  • feature/settings/src/commonMain/kotlin/com/mifos/feature/settings/settings/SettingsScreen.kt
🧰 Additional context used
🧬 Code graph analysis (2)
feature/collectionSheet/src/commonMain/kotlin/com/mifos/feature/individualCollectionSheet/paymentDetails/PaymentDetailsScreen.kt (3)
core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosUserImage.kt (1)
  • MifosUserImage (31-68)
core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosButton.kt (2)
  • MifosButton (52-78)
  • MifosButton (91-117)
core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosTextFieldDropdown.kt (1)
  • MifosTextFieldDropdown (39-112)
feature/collectionSheet/src/commonMain/kotlin/com/mifos/feature/individualCollectionSheet/navigation/CollectionSheetNavigation.kt (1)
feature/collectionSheet/src/commonMain/kotlin/com/mifos/feature/individualCollectionSheet/paymentDetails/PaymentDetailsScreen.kt (1)
  • PaymentDetailsScreenRoute (76-93)
🪛 GitHub Actions: PR Checks
feature/about/src/commonMain/kotlin/com/mifos/feature/about/AboutScreen.kt

[error] 65-65: Spotless Kotlin formatting violations. Run './gradlew :feature:about:spotlessApply' to fix these violations.

🔇 Additional comments (9)
feature/offline/src/commonMain/composeResources/values/strings.xml (1)

13-13: LGTM! String cleanup aligns with the new TopAppBar pattern.

The removal of the asterisk from "Offline Sync *" to "Offline Sync" is appropriate for the consistent toolbar presentation introduced in this PR.

feature/checker-inbox-task/src/commonMain/kotlin/com/mifos/feature/checker/inbox/task/checkerInboxTasks/CheckerInboxTasksScreen.kt (1)

170-172: Verify the TaskOptions card transparency change.

The TaskOptions card's containerColor is now set to Color.Transparent. This styling change is not mentioned in the PR description, which focuses on adding toolbar navigation.

Please confirm whether this visual change is intentional and related to the toolbar addition, or if it should be documented separately.

feature/about/src/commonMain/kotlin/com/mifos/feature/about/AboutScreen.kt (4)

30-30: LGTM: Imports are correct.

The new imports are necessary for the TopAppBar implementation and follow the appropriate Material3 component structure.

Also applies to: 32-32, 36-37, 45-45


63-85: TopAppBar implementation achieves PR objectives.

The TopAppBar structure correctly implements the navigation drawer screen toolbar pattern, providing:

  • Consistent title display
  • Back navigation via IconButton
  • Proper Material3 theming

This aligns with the PR goal of adding toolbars to Navigation Drawer destination screens for improved navigation.


72-77: MifosIcons.ArrowBack is defined and available in the design system. It maps to Icons.Filled.ChevronLeft at line 198 of core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/icon/MifosIcons.kt and is used consistently across multiple screens in the codebase.


54-54: Remove the @OptIn(ExperimentalMaterial3Api::class) annotation or verify it's only needed for other experimental APIs in this file.

TopAppBar is stable in Jetpack Compose Material3 (as of 1.5.0-alpha11). The experimental APIs were promoted to stable in recent releases, making the OptIn annotation unnecessary for TopAppBar specifically. If this annotation is used for other experimental Material3 APIs in this file, keep it and add a comment clarifying which other APIs require it.

Likely an incorrect or invalid review comment.

feature/collectionSheet/src/commonMain/kotlin/com/mifos/feature/individualCollectionSheet/navigation/CollectionSheetNavigation.kt (1)

53-53: LGTM: Back navigation properly threaded through the navigation graph.

The onBackPressed parameter is correctly propagated from the navigation graph to the paymentDetailsScreen function and into PaymentDetailsScreenRoute, enabling proper back navigation handling.

Also applies to: 104-116

feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientList/ClientListScreen.kt (2)

1-433: Verify that these UI redesign changes belong in this PR.

The PR objectives describe adding toolbars to Navigation Drawer screens for back navigation, but this file contains client list UI redesign changes (card styling, avatar rendering, text formatting). These appear unrelated to the toolbar additions described in the PR objectives. Mixing unrelated changes in a single PR can complicate review, testing, and rollback if issues arise.


165-165: Verify the containerColor change is intentional.

The scaffold's containerColor was changed from surfaceContainer to surface. Ensure this change is intentional and maintains visual consistency with other screens in the app.

Comment on lines +60 to +61
// title = stringResource(Res.string.feature_about),
// onBackPressed = onBackPressed,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Remove commented-out code.

Dead code should be deleted rather than commented out. Version control preserves the history if needed.

🔎 Proposed fix
-//        title = stringResource(Res.string.feature_about),
-//        onBackPressed = onBackPressed,
         snackbarHostState = remember { SnackbarHostState() },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// title = stringResource(Res.string.feature_about),
// onBackPressed = onBackPressed,
snackbarHostState = remember { SnackbarHostState() },
🤖 Prompt for AI Agents
In feature/about/src/commonMain/kotlin/com/mifos/feature/about/AboutScreen.kt
around lines 60 to 61, there are two commented-out lines (title =
stringResource(Res.string.feature_about), onBackPressed = onBackPressed,) that
should be removed; just delete those commented lines so the file contains no
dead/commented-out code and keep surrounding indentation/formatting intact.

Comment on lines +63 to +85
topBar = {
TopAppBar(
title = {
Text(
text = stringResource(Res.string.feature_about),
style = MaterialTheme.typography.titleLarge
)
},
navigationIcon = {
IconButton(onClick = onBackPressed) {
Icon(
imageVector = MifosIcons.ArrowBack,
contentDescription = "Navigate back"
)
}
},
colors = TopAppBarDefaults.topAppBarColors(
containerColor = MaterialTheme.colorScheme.surface,
titleContentColor = MaterialTheme.colorScheme.onSurface,
navigationIconContentColor = MaterialTheme.colorScheme.onSurface
)
)
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix Spotless formatting violations before merge.

The pipeline indicates a formatting violation at line 65. Run the following command to auto-fix:

./gradlew :feature:about:spotlessApply
🧰 Tools
🪛 GitHub Actions: PR Checks

[error] 65-65: Spotless Kotlin formatting violations. Run './gradlew :feature:about:spotlessApply' to fix these violations.

🤖 Prompt for AI Agents
In feature/about/src/commonMain/kotlin/com/mifos/feature/about/AboutScreen.kt
around lines 63 to 85 the file fails Spotless formatting (violation reported at
line 65); run the auto-formatter to fix formatting by executing ./gradlew
:feature:about:spotlessApply, verify formatting with ./gradlew
:feature:about:spotlessCheck (or CI), then stage and commit the changed file and
push the branch so the PR passes the Spotless check.

Comment on lines +81 to +99
topBar = {
TopAppBar(
navigationIcon = {
IconButton(onClick = onBackPressed) {
Icon(
imageVector = MifosIcons.ArrowBack,
contentDescription = null,
)
}
},
title = {
Text(
text = stringResource(
Res.string.feature_checker_inbox_task_checker_Inbox
)
)
},
)
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Provide accessible label for back navigation button.

The back button's contentDescription is set to null, which prevents screen reader users from understanding the button's purpose.

🔎 Proposed fix
                navigationIcon = {
                    IconButton(onClick = onBackPressed) {
                        Icon(
                            imageVector = MifosIcons.ArrowBack,
-                           contentDescription = null,
+                           contentDescription = "Navigate back",
                        )
                    }
                },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
topBar = {
TopAppBar(
navigationIcon = {
IconButton(onClick = onBackPressed) {
Icon(
imageVector = MifosIcons.ArrowBack,
contentDescription = null,
)
}
},
title = {
Text(
text = stringResource(
Res.string.feature_checker_inbox_task_checker_Inbox
)
)
},
)
}
topBar = {
TopAppBar(
navigationIcon = {
IconButton(onClick = onBackPressed) {
Icon(
imageVector = MifosIcons.ArrowBack,
contentDescription = "Navigate back",
)
}
},
title = {
Text(
text = stringResource(
Res.string.feature_checker_inbox_task_checker_Inbox
)
)
},
)
}

Comment on lines +340 to +356
Surface(
shape = CircleShape,
color = MaterialTheme.colorScheme.primaryContainer,
modifier = Modifier.size(48.dp)
) {
Box(contentAlignment = Alignment.Center) {
Image(
painter = painterResource(Res.drawable.feature_client_ic_dp_placeholder),
contentDescription = null,
modifier = Modifier
.size(28.dp)
.fillMaxSize(),
contentScale = ContentScale.Fit,
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onPrimaryContainer)
)
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Remove redundant fillMaxSize() modifier.

Line 351 applies fillMaxSize() to an Image that already has a fixed size(28.dp) modifier on line 350. The fillMaxSize() is redundant and contradicts the fixed size. Remove it for clarity.

🔎 Proposed fix
                             Image(
                                 painter = painterResource(Res.drawable.feature_client_ic_dp_placeholder),
                                 contentDescription = null,
                                 modifier = Modifier
-                                    .size(28.dp)
-                                    .fillMaxSize(),
+                                    .size(28.dp),
                                 contentScale = ContentScale.Fit,
                                 colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onPrimaryContainer)
                             )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Surface(
shape = CircleShape,
color = MaterialTheme.colorScheme.primaryContainer,
modifier = Modifier.size(48.dp)
) {
Box(contentAlignment = Alignment.Center) {
Image(
painter = painterResource(Res.drawable.feature_client_ic_dp_placeholder),
contentDescription = null,
modifier = Modifier
.size(28.dp)
.fillMaxSize(),
contentScale = ContentScale.Fit,
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onPrimaryContainer)
)
}
}
Surface(
shape = CircleShape,
color = MaterialTheme.colorScheme.primaryContainer,
modifier = Modifier.size(48.dp)
) {
Box(contentAlignment = Alignment.Center) {
Image(
painter = painterResource(Res.drawable.feature_client_ic_dp_placeholder),
contentDescription = null,
modifier = Modifier
.size(28.dp),
contentScale = ContentScale.Fit,
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onPrimaryContainer)
)
}
}
🤖 Prompt for AI Agents
In
feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientList/ClientListScreen.kt
around lines 340 to 356, the Image has a redundant fillMaxSize() modifier
applied after size(28.dp) which contradicts the fixed size; remove the
fillMaxSize() call so the Image only uses size(28.dp) (and any other needed
modifiers) to enforce the intended fixed dimensions and avoid conflicting layout
behavior.

Spacer(modifier = Modifier.height(4.dp))
Text(
text = client.accountNo.toString(),
text = "Account: ${client.accountNo}",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# Check for string resource files
fd -t f -e xml | grep -E "(strings|resources)" | head -20

Repository: openMF/android-client

Length of output: 1202


🏁 Script executed:

# Check the project structure to understand localization setup
ls -la | head -20
find . -type d -name "values*" | head -10

Repository: openMF/android-client

Length of output: 1620


🏁 Script executed:

# Examine the ClientListScreen file to see how other UI text is handled
head -100 feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientList/ClientListScreen.kt

Repository: openMF/android-client

Length of output: 4528


🏁 Script executed:

# Search for similar patterns in the same file - how are other text strings handled
rg "text\s*=" feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientList/ClientListScreen.kt -A 1 -B 1 | head -40

Repository: openMF/android-client

Length of output: 536


🏁 Script executed:

# Check the feature/client strings.xml file to see existing localized strings
cat feature/client/src/commonMain/composeResources/values/strings.xml

Repository: openMF/android-client

Length of output: 44171


🏁 Script executed:

# Search for "Account" related strings in the project to see if similar strings are localized
rg -i "account" --type xml feature/client/src/ | head -20

Repository: openMF/android-client

Length of output: 3123


🏁 Script executed:

# Check how other similar labels/prefixes are handled in ClientListScreen context
rg -B 5 -A 2 "text = \"Account" feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientList/ClientListScreen.kt

Repository: openMF/android-client

Length of output: 500


Extract the "Account: " prefix to a string resource for localization.

The hardcoded text at line 375 should use stringResource() to support the project's localization framework. An existing string resource feature_client_account_number ("Account Number") is available in the feature module's strings.xml, or a new resource like feature_client_account_label can be created for the "Account: " prefix to align with the app's multi-language support (Catalan, English, Spanish, French, Hindi, Kannada, Swahili, Chinese).

🤖 Prompt for AI Agents
In
feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientList/ClientListScreen.kt
around line 375, the hardcoded "Account: " prefix should be moved to a string
resource and used via stringResource() for localization; add a new string
resource (e.g., feature_client_account_label with value "Account: %s") or reuse
feature_client_account_number appropriately, then replace the hardcoded literal
with stringResource(R.string.feature_client_account_label, client.accountNo)
(ensure androidx.compose.ui.res.stringResource is imported) so the prefix is
localized and the account number injected via formatting.

Comment on lines +326 to 331
OutlinedCard(
modifier = Modifier.padding(horizontal = 16.dp),
colors = CardDefaults.cardColors(
containerColor = Color.White,
),
) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Use theme color instead of hardcoded Color.White.

The OutlinedCard uses a hardcoded Color.White for the container color, which won't adapt to dark mode and breaks theme consistency.

🔎 Proposed fix
                 OutlinedCard(
                     modifier = Modifier.padding(horizontal = 16.dp),
                     colors = CardDefaults.cardColors(
-                        containerColor = Color.White,
+                        containerColor = MaterialTheme.colorScheme.surface,
                     ),
                 ) {
🤖 Prompt for AI Agents
In
feature/collectionSheet/src/commonMain/kotlin/com/mifos/feature/individualCollectionSheet/paymentDetails/PaymentDetailsScreen.kt
around lines 326-331, the OutlinedCard uses a hardcoded Color.White for
containerColor which breaks theme/dark-mode; replace the hardcoded Color.White
with the theme surface/background color (e.g., MaterialTheme.colorScheme.surface
or MaterialTheme.colorScheme.background depending on your design system) by
updating the CardDefaults.cardColors call to use MaterialTheme.colorScheme.* so
the card adapts to dark mode and the app theme.

Comment on lines +149 to +150
// onBackPressed = onBackPressed,
// title = stringResource(Res.string.feature_offline_offline_Sync),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Remove commented-out code.

The commented scaffold parameters should be removed as they're now handled by the TopAppBar.

🔎 Proposed fix
                 )
             )
         }
-//        onBackPressed = onBackPressed,
-//        title = stringResource(Res.string.feature_offline_offline_Sync),
     ) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// onBackPressed = onBackPressed,
// title = stringResource(Res.string.feature_offline_offline_Sync),
)
)
}
) {
🤖 Prompt for AI Agents
In
feature/offline/src/commonMain/kotlin/com/mifos/feature/offline/dashboard/OfflineDashboardScreen.kt
around lines 149 to 150, remove the two commented-out scaffold parameter lines
("onBackPressed = onBackPressed," and "title =
stringResource(Res.string.feature_offline_offline_Sync),") since the TopAppBar
now handles these; simply delete those commented lines so the file contains no
dead commented scaffold parameters.

Comment on lines +104 to +121
// title = stringResource(Res.string.feature_path_tracking_track_my_path),
// onBackPressed = onBackPressed,
// actions = {
// IconButton(
// onClick = {
// if (userStatus) {
// updateUserStatus(false)
// } else {
// checkPermission = true
// }
// },
// ) {
// Icon(
// imageVector = if (userStatus) MifosIcons.Stop else MifosIcons.MyLocation,
// contentDescription = null,
// )
// }
// },
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Remove commented-out code.

The commented scaffold configuration (lines 104-121) should be removed rather than left in the codebase. Commented code creates maintenance debt and can confuse future developers.

🔎 Proposed fix
     MifosScaffold(
         modifier = modifier,
-//        title = stringResource(Res.string.feature_path_tracking_track_my_path),
-//        onBackPressed = onBackPressed,
-//        actions = {
-//            IconButton(
-//                onClick = {
-//                    if (userStatus) {
-//                        updateUserStatus(false)
-//                    } else {
-//                        checkPermission = true
-//                    }
-//                },
-//            ) {
-//                Icon(
-//                    imageVector = if (userStatus) MifosIcons.Stop else MifosIcons.MyLocation,
-//                    contentDescription = null,
-//                )
-//            }
-//        },
         snackbarHostState = snackbarHostState,
         topBar = {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// title = stringResource(Res.string.feature_path_tracking_track_my_path),
// onBackPressed = onBackPressed,
// actions = {
// IconButton(
// onClick = {
// if (userStatus) {
// updateUserStatus(false)
// } else {
// checkPermission = true
// }
// },
// ) {
// Icon(
// imageVector = if (userStatus) MifosIcons.Stop else MifosIcons.MyLocation,
// contentDescription = null,
// )
// }
// },
🤖 Prompt for AI Agents
In
feature/path-tracking/src/commonMain/kotlin/com/mifos/feature/path/tracking/PathTrackingScreen.kt
around lines 104 to 121 the scaffold configuration is commented out; remove
these commented lines entirely to eliminate dead code and reduce maintenance
debt, ensuring no functional changes are made and the file compiles cleanly
after deletion.

Copy link
Contributor

@revanthkumarJ revanthkumarJ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MifosScaffold(
title = stringResource(Res.string.feature_collection_sheet_individual_collection_sheet),
onBackPressed = onBackPressed,
)

    don't remove above one
     internally to Mifos Scaffold we using top bar see why it not showing and do modifications to Mifos scaffold no need of changing in every screen

@kartikey004
Copy link
Contributor Author

MifosScaffold( title = stringResource(Res.string.feature_collection_sheet_individual_collection_sheet), onBackPressed = onBackPressed, )

    don't remove above one
     internally to Mifos Scaffold we using top bar see why it not showing and do modifications to Mifos scaffold no need of changing in every screen

Sure. I have made the changes. I'll create a fresh PR after passing the checks. Thanks.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c144386 and 80d1ad6.

📒 Files selected for processing (1)
  • core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosScaffold.kt
🔇 Additional comments (2)
core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosScaffold.kt (2)

23-24: LGTM! Necessary imports for the new top bar functionality.

The added imports support the new conditional top bar feature and follow standard Material3 patterns.

Also applies to: 30-32, 41-42


59-67: Well done! Conditional top bar rendering provides backward compatibility.

The implementation correctly renders the top bar only when a title is provided, maintaining backward compatibility with existing screens that don't use the title parameter.

Comment on lines +164 to +196
@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun MifosDetailTopBar(
title: String,
onBackPressed: (() -> Unit)?,
actions: @Composable RowScope.() -> Unit,
) {
TopAppBar(
title = {
Text(
text = title,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style = MaterialTheme.typography.titleMedium,
)
},
navigationIcon = {
IconButton(onClick = { onBackPressed?.invoke() }) {
Icon(
imageVector = MifosIcons.ArrowBack,
contentDescription = "Navigate back",
)
}
},
actions = actions,
colors = TopAppBarDefaults.topAppBarColors(
containerColor = AppColors.customWhite,
titleContentColor = MaterialTheme.colorScheme.onSurface,
navigationIconContentColor = MaterialTheme.colorScheme.onSurface,
actionIconContentColor = MaterialTheme.colorScheme.onSurface,
),
)
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Good implementation following Material3 patterns, with a minor i18n issue.

The top bar implementation is well-structured and properly styled. However, there's a localization concern.

Issue: Hardcoded content description at line 184

The string "Navigate back" should be externalized to a string resource for proper internationalization support.

🔎 Suggested fix

Assuming you have a string resource available (e.g., Res.string.navigate_back), update the content description:

                Icon(
                    imageVector = MifosIcons.ArrowBack,
-                    contentDescription = "Navigate back",
+                    contentDescription = stringResource(Res.string.navigate_back),
                )

If the string resource doesn't exist yet, add it to your strings file first.


Optional: Consider simplifying the nullable onBackPressed parameter

The onBackPressed parameter at line 168 is nullable, but it's always provided as non-null from the caller at line 63. You could simplify the signature:

🔎 Optional refactor
 @Composable
 private fun MifosDetailTopBar(
     title: String,
-    onBackPressed: (() -> Unit)?,
+    onBackPressed: () -> Unit,
     actions: @Composable RowScope.() -> Unit,
 ) {
     TopAppBar(
         // ...
         navigationIcon = {
-            IconButton(onClick = { onBackPressed?.invoke() }) {
+            IconButton(onClick = onBackPressed) {
                 Icon(
                     imageVector = MifosIcons.ArrowBack,
                     contentDescription = "Navigate back",
                 )
             }
         },
         // ...
     )
 }
🤖 Prompt for AI Agents
In
core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosScaffold.kt
around lines 164 to 196, the Icon's contentDescription is hardcoded as "Navigate
back" which breaks i18n; replace the hardcoded string with a string resource
lookup (use stringResource(R.string.navigate_back)) for the contentDescription,
and if the string resource doesn't exist add an entry like "navigate_back" to
your strings file with the appropriate translations; optionally, after this,
consider making onBackPressed non-null if all callers pass it, but the immediate
fix is to externalize the content description to resources.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants