Skip to content

Conversation

@shashank-0-0
Copy link

@shashank-0-0 shashank-0-0 commented Nov 6, 2025

Fixes - Jira-#504

Screen_recording_20251106_222942.webm

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the static analysis check ./gradlew check or ci-prepush.sh to make sure you didn't break anything

  • If you have multiple commits please combine them into one commit by squashing them.

Summary by CodeRabbit

  • Improvements
    • Filter dialog now previews selection locally; changes are applied only when you tap Apply.
    • Selecting an option no longer immediately closes the dialog; you can review before confirming.
    • Added localized labels for Apply, Close, and All in the filter dialog UI.

@coderabbitai
Copy link

coderabbitai bot commented Nov 6, 2025

Walkthrough

FilterDialog now uses local state (selectedFilter) to track selection changes without immediately dismissing; confirm applies the local selection (including All → null) by emitting UpdateSelectedFilter and then dismisses. Three new localized strings were added: feature_search_apply, feature_search_close, and feature_search_all.

Changes

Cohort / File(s) Summary
FilterDialog State Management
feature/search/src/commonMain/kotlin/com/mifos/feature/search/components/FilterDialog.kt
Introduced local selectedFilter state initialized from the incoming selected parameter. Option taps update selectedFilter only (selecting "All" sets selectedFilter to null). Confirm button now emits SearchScreenEvent.UpdateSelectedFilter(selectedFilter) then calls onDismiss(). Option rendering and selection comparisons now use selectedFilter. Added imports for state utilities and localized resources.
Localization Resources
feature/search/src/commonMain/composeResources/values/feature_search_strings.xml
Added three string resources: feature_search_apply, feature_search_close, and feature_search_all for button and option text localization.

Sequence Diagram

sequenceDiagram
    participant User
    participant Dialog as FilterDialog (UI)
    participant State as LocalState\n(selectedFilter)
    participant Parent as ParentComponent

    User->>Dialog: Tap an option
    Dialog->>State: set selectedFilter (option or null for "All")
    Note over Dialog,State: Dialog stays open

    User->>Dialog: Tap Confirm
    Dialog->>State: read selectedFilter
    Dialog->>Parent: emit UpdateSelectedFilter(selectedFilter)
    Dialog->>Parent: call onDismiss()
    Parent->>Dialog: dismiss
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Focus review on FilterDialog.kt local state initialization and confirm/dismiss ordering.
  • Verify "All" maps to null consistently and UI selection highlights follow selectedFilter.
  • Confirm string resource keys are correct and referenced.

Poem

🐰 I nibbled options, held them near,
Saved each choice till "apply" was clear.
Three new strings hum, tidy and small,
A tidy dialog — hop, no fall! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 'Fix: Filter dialog confirmation button' directly addresses the main change: updating the filter dialog's confirmation button behavior with proper localization and state management.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d98f2f8 and f79d191.

📒 Files selected for processing (2)
  • feature/search/src/commonMain/composeResources/values/feature_search_strings.xml (1 hunks)
  • feature/search/src/commonMain/kotlin/com/mifos/feature/search/components/FilterDialog.kt (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • feature/search/src/commonMain/kotlin/com/mifos/feature/search/components/FilterDialog.kt
  • feature/search/src/commonMain/composeResources/values/feature_search_strings.xml

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: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a72352c and 5885d56.

📒 Files selected for processing (2)
  • feature/search/src/commonMain/kotlin/com/mifos/feature/search/SearchViewModel.kt (0 hunks)
  • feature/search/src/commonMain/kotlin/com/mifos/feature/search/components/FilterDialog.kt (1 hunks)
💤 Files with no reviewable changes (1)
  • feature/search/src/commonMain/kotlin/com/mifos/feature/search/SearchViewModel.kt
🧰 Additional context used
🧬 Code graph analysis (1)
feature/search/src/commonMain/kotlin/com/mifos/feature/search/components/FilterDialog.kt (1)
feature/search/src/commonMain/kotlin/com/mifos/feature/search/SearchViewModel.kt (1)
  • onEvent (40-88)
🔇 Additional comments (3)
feature/search/src/commonMain/kotlin/com/mifos/feature/search/components/FilterDialog.kt (3)

37-37: LGTM! Parameter type widened to support new event flow.

The change from (SearchScreenEvent.UpdateSelectedFilter) -> Unit to (SearchScreenEvent) -> Unit correctly enables the dialog to dispatch both UpdateSelectedFilter (for filter selection) and PerformSearch (for explicit search trigger) events, aligning with the PR objective to require explicit user action.


46-49: LGTM! Explicit search trigger correctly implemented.

The onConfirm handler now properly dispatches PerformSearch before dismissing the dialog. This aligns with the PR objective to require explicit user action and matches the SearchViewModel pattern where PerformSearch triggers getSearchResult().


62-73: LGTM! Filter selection correctly updates state without auto-dismissal.

The filter selection now only dispatches UpdateSelectedFilter events without automatically dismissing the dialog or triggering a search. This allows users to change their filter selection before explicitly applying it via the "Apply" button, improving the user experience and aligning with the PR objective.

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.

We can merge this one once you move those strings to string resources

showDialogState = true,
confirmButtonText = "",
confirmButtonText = "Apply",
dismissButtonText = "Close",
Copy link
Contributor

Choose a reason for hiding this comment

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

Move the strings to String Resources.

Copy link
Author

Choose a reason for hiding this comment

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

okay !!

Copy link
Author

Choose a reason for hiding this comment

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

I have made some changes can u plz review it again !!

Copy link
Contributor

Choose a reason for hiding this comment

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

chamge the All text also to string resources

@shashank-0-0 shashank-0-0 force-pushed the fix/search-filter-dialog branch from 5885d56 to 5f61f53 Compare November 10, 2025 02:40
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: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5885d56 and d98f2f8.

📒 Files selected for processing (2)
  • feature/search/src/commonMain/composeResources/values/feature_search_strings.xml (1 hunks)
  • feature/search/src/commonMain/kotlin/com/mifos/feature/search/components/FilterDialog.kt (4 hunks)
🔇 Additional comments (5)
feature/search/src/commonMain/composeResources/values/feature_search_strings.xml (1)

21-22: LGTM! String resources properly added for internationalization.

The addition of feature_search_apply and feature_search_close string resources correctly addresses the previous review feedback about hardcoded button labels and enables proper internationalization support.

feature/search/src/commonMain/kotlin/com/mifos/feature/search/components/FilterDialog.kt (4)

13-14: LGTM! Imports properly added for i18n and state management.

The string resource imports for feature_search_apply and feature_search_close enable proper internationalization, addressing previous review feedback. The state management imports (getValue, mutableStateOf, remember, setValue) are correctly added to support the local state pattern.

Also applies to: 27-30


47-47: LGTM! Local state management improves UX.

The introduction of selectedFilter local state is a good UX improvement. It allows users to preview and change their filter selection multiple times before applying, and dismissing the dialog without confirming will discard the changes. This follows the standard confirmation dialog pattern.


52-57: LGTM! Button configuration correctly implements confirmation pattern.

The button labels now properly use string resources for internationalization. The onConfirm callback correctly emits the filter update event with the local state and then dismisses the dialog, while the dismiss button discards changes. This implements the standard confirmation dialog pattern correctly.


69-71: LGTM! Selection logic correctly updates local state.

The filter option selection logic properly updates the local selectedFilter state instead of immediately emitting events. The "All" option correctly maps to null, and the rendering logic accurately reflects the local state. This ensures changes are only applied when the user clicks "Apply".

Also applies to: 78-80

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