Skip to content

Conversation

@Devasy
Copy link
Owner

@Devasy Devasy commented Aug 14, 2025

Introduce a centralized theming system for the application using react-native-paper and React Navigation, improving the UI components and overall user experience.

Summary by CodeRabbit

  • New Features

    • Automatic light/dark theme across the app, including navigation and components.
    • Swipe actions on group items: Open, Add Expense, and Settings.
    • Create Group modal with name input and auto-refresh on success.
    • Per-group settlement status (settled, you owe, you’re owed) with currency formatting.
  • UI/UX

    • Refreshed tab/stack styles, rounded cards, member chips, themed balance colors, and smoother animations.
    • Improved list performance and responsiveness.
  • Chores

    • Enabled gesture handling to support new interactions.

@Devasy Devasy requested a review from vrajpatelll as a code owner August 14, 2025 20:01
@Devasy Devasy added the run-preview To run Expo preview build on forks label Aug 14, 2025
@Devasy Devasy requested review from jinang17 and monkscode August 14, 2025 20:01
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 14, 2025

Walkthrough

Implements centralized light/dark theming for React Native Paper and React Navigation, integrates theme usage across App, navigators, and key screens, and adds gesture handling. HomeScreen is refactored with swipe actions, per-item settlement status, animations, and a create-group modal. Adds the gesture-handler dependency and required top-level import.

Changes

Cohort / File(s) Summary of changes
Theming Integration
frontend/utils/theme.js, frontend/App.js, frontend/navigation/AppNavigator.js, frontend/navigation/MainNavigator.js, frontend/screens/GroupDetailsScreen.js
Added centralized light/dark themes and tokens; App and NavigationContainer now select theme via useColorScheme; MainNavigator consumes theme colors; GroupDetailsScreen uses theme colors and memoized member lookup.
Gesture Handling Setup
frontend/index.js, frontend/App.js
Added top-level react-native-gesture-handler import; wrapped navigator with GestureHandlerRootView for gesture support.
Navigation Options Update
frontend/navigation/GroupsStackNavigator.js
Applied default screenOptions (slide_from_right, no header shadow); set explicit animation for GroupDetails.
HomeScreen Revamp
frontend/screens/HomeScreen.js
Introduced GroupItem with swipe actions, animations, and settlement status; batched settlement calculations; UI refinements and modal for creating groups.
Dependency Update
frontend/package.json
Added dependency: react-native-gesture-handler ^2.28.0.

Sequence Diagram(s)

sequenceDiagram
  participant OS as OS
  participant App as App (Providers)
  participant Theme as useColorScheme
  participant Paper as PaperProvider
  participant Nav as NavigationContainer
  participant GH as GestureHandlerRootView

  OS->>App: Launch
  App->>Theme: Get color scheme
  Theme-->>App: "light" or "dark"
  App->>Paper: Provide paperTheme or paperThemeDark
  App->>GH: Wrap navigator
  GH->>Nav: Mount with navTheme or navThemeDark
  Nav-->>App: Render screens
Loading
sequenceDiagram
  participant Home as HomeScreen
  participant API as fetchGroups()
  participant Settle as calculateSettlementStatus()
  participant UI as GroupItem
  participant Nav as Navigation

  Home->>API: Load groups
  loop batched (size=5)
    API->>Settle: For each group/user
    Settle-->>API: {isSettled, netBalance, owes/owed}
    API-->>Home: Partial statuses
    Home->>UI: Update list items
  end
  UI->>Nav: Swipe Right: AddExpense / Settings
  UI->>Nav: Swipe Left: GroupDetails
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

enhancement, level3

Suggested reviewers

  • vrajpatelll

Poem

A hop and a swipe, I theme through the night,
Dark turns to light with a gentle byte.
Tabs glow, cards flow, I nudge and I slide,
Balances whisper what’s owed and what’s right.
New groups sprout—tap!—with delight.
🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/ui-gpt5-changes

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@codecov
Copy link

codecov bot commented Aug 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.79%. Comparing base (2aacca8) to head (dc021a7).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #148   +/-   ##
=======================================
  Coverage   72.79%   72.79%           
=======================================
  Files          17       17           
  Lines        1669     1669           
  Branches      154      154           
=======================================
  Hits         1215     1215           
  Misses        400      400           
  Partials       54       54           
Components Coverage Δ
Authentication System 75.45% <ø> (ø)
Expense Management 69.88% <ø> (ø)
Group Management 69.49% <ø> (ø)
User Management 97.16% <ø> (ø)
Backend Core 69.41% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@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: 0

🧹 Nitpick comments (5)
frontend/navigation/GroupsStackNavigator.js (1)

19-19: Consider removing redundant animation option.

The GroupDetails screen already inherits animation: 'slide_from_right' from the navigator's screenOptions, so explicitly setting it again in the screen-specific options is redundant.

-      <Stack.Screen name="GroupDetails" component={GroupDetailsScreen} options={{ animation: 'slide_from_right' }} />
+      <Stack.Screen name="GroupDetails" component={GroupDetailsScreen} />
frontend/navigation/MainNavigator.js (1)

17-17: Consider using theme colors for inactive tint.

The hardcoded hex color #64748B for tabBarInactiveTintColor could be replaced with a theme color for better consistency.

-        tabBarInactiveTintColor: '#64748B',
+        tabBarInactiveTintColor: colors.onSurfaceVariant || '#64748B',
frontend/screens/GroupDetailsScreen.js (1)

90-90: Consider using theme-based status colors.

The hardcoded success and error colors (#16A34A, #DC2626) could potentially use the theme's status colors for better consistency.

Consider referencing the theme's status colors defined in frontend/utils/theme.js:

-      balanceColor = "#16A34A";
+      balanceColor = colors.success || "#16A34A";
-      balanceColor = "#DC2626";
+      balanceColor = colors.error || "#DC2626";

However, this would require ensuring these status colors are available in the navigation theme or accessing them through a different method.

Also applies to: 93-93

frontend/screens/HomeScreen.js (2)

41-42: Consider adding URL validation for security

While the regex check for image URLs is functional, consider using a more robust URL validation to prevent potential security issues with malformed URLs.

-  const isImage = item.imageUrl && /^(https?:|data:image)/.test(item.imageUrl);
+  const isImage = item.imageUrl && /^(https?:\/\/|data:image\/)/.test(item.imageUrl);

244-252: Consider using individual animations per item

The current implementation uses a single shared itemAnim value for all list items, which means all items will animate together. For a more polished effect where items animate in sequence as they appear, consider using individual animation values per item.

This could be achieved by moving the animation initialization into the GroupItem component itself, or by using a library like react-native-reanimated for more sophisticated list animations.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2aacca8 and dc021a7.

⛔ Files ignored due to path filters (1)
  • frontend/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (9)
  • frontend/App.js (1 hunks)
  • frontend/index.js (1 hunks)
  • frontend/navigation/AppNavigator.js (2 hunks)
  • frontend/navigation/GroupsStackNavigator.js (1 hunks)
  • frontend/navigation/MainNavigator.js (3 hunks)
  • frontend/package.json (1 hunks)
  • frontend/screens/GroupDetailsScreen.js (4 hunks)
  • frontend/screens/HomeScreen.js (10 hunks)
  • frontend/utils/theme.js (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (6)
frontend/navigation/GroupsStackNavigator.js (2)
frontend/navigation/AccountStackNavigator.js (2)
  • Stack (6-6)
  • Stack (8-15)
frontend/navigation/AuthNavigator.js (2)
  • Stack (6-6)
  • Stack (8-15)
frontend/screens/HomeScreen.js (5)
frontend/screens/GroupDetailsScreen.js (2)
  • formatCurrency (31-31)
  • useTheme (54-54)
frontend/utils/currency.js (2)
  • formatCurrency (8-16)
  • formatCurrency (8-16)
frontend/utils/theme.js (2)
  • tokens (60-60)
  • tokens (60-60)
frontend/context/AuthContext.js (3)
  • AuthContext (10-10)
  • AuthContext (10-10)
  • token (14-14)
frontend/navigation/MainNavigator.js (1)
  • useTheme (11-11)
frontend/App.js (3)
frontend/navigation/AppNavigator.js (3)
  • scheme (11-11)
  • theme (12-12)
  • AppNavigator (9-27)
frontend/utils/theme.js (4)
  • paperThemeDark (74-91)
  • paperThemeDark (74-91)
  • paperTheme (28-45)
  • paperTheme (28-45)
frontend/context/AuthContext.js (2)
  • AuthProvider (12-190)
  • AuthProvider (12-190)
frontend/screens/GroupDetailsScreen.js (3)
frontend/screens/GroupSettingsScreen.js (1)
  • members (45-45)
frontend/utils/balanceCalculator.js (2)
  • members (46-46)
  • getMemberName (67-72)
frontend/utils/currency.js (2)
  • formatCurrency (8-16)
  • formatCurrency (8-16)
frontend/navigation/AppNavigator.js (3)
frontend/context/AuthContext.js (2)
  • AuthContext (10-10)
  • AuthContext (10-10)
frontend/App.js (2)
  • scheme (9-9)
  • theme (10-10)
frontend/utils/theme.js (4)
  • navThemeDark (93-104)
  • navThemeDark (93-104)
  • navTheme (47-58)
  • navTheme (47-58)
frontend/navigation/MainNavigator.js (5)
frontend/screens/HomeScreen.js (1)
  • useTheme (151-151)
frontend/screens/GroupDetailsScreen.js (1)
  • useTheme (54-54)
frontend/navigation/GroupsStackNavigator.js (1)
  • GroupsStackNavigator (10-25)
frontend/navigation/AuthNavigator.js (1)
  • Stack (8-15)
frontend/navigation/AccountStackNavigator.js (1)
  • Stack (8-15)
🔇 Additional comments (24)
frontend/package.json (1)

24-24: LGTM! Appropriate gesture handler dependency added.

The addition of react-native-gesture-handler v2.28.0 aligns well with the swipe functionality being introduced in HomeScreen and supports the overall gesture capabilities needed for the enhanced user interactions in this PR.

frontend/navigation/GroupsStackNavigator.js (1)

12-17: Good navigation styling consistency.

The global screenOptions configuration provides consistent animation and header styling across all screens in the Groups stack, which improves the overall user experience.

frontend/utils/theme.js (5)

7-26: Well-structured color palette with clear semantic naming.

The palette provides good semantic color definitions with appropriate contrast ratios for a finance app. The neutral, brand, status, and text color organization makes the theme maintainable and easy to understand.


28-45: Properly structured Paper theme configuration.

The theme correctly extends the default MD3 light theme and maps palette colors to appropriate Paper theme properties. The roundness value of 12 provides a modern, consistent look across UI components.


47-58: Navigation theme properly configured.

The navigation theme correctly maps palette colors to React Navigation's theme structure, ensuring consistent theming across navigation components.


63-72: Well-designed dark palette.

The dark theme maintains appropriate contrast ratios while preserving the brand identity. The background colors provide good readability in dark mode environments.


74-91: Dark themes properly implemented.

Both paperThemeDark and navThemeDark correctly extend their respective default dark themes and apply the dark palette colors appropriately, ensuring consistent theming across light and dark modes.

Also applies to: 93-104

frontend/navigation/MainNavigator.js (2)

3-3: Proper theme integration.

The addition of useTheme hook and its usage to extract colors provides dynamic theming support for the tab navigator, which integrates well with the centralized theme system.

Also applies to: 11-11


13-26: Well-implemented theme-aware tab styling.

The tab navigator properly uses theme colors for active tint, background, and borders while maintaining good visual hierarchy with appropriate padding and height adjustments.

frontend/screens/GroupDetailsScreen.js (4)

1-2: Good theme and performance optimizations.

The addition of useTheme for dynamic theming and useMemo for performance optimization shows attention to both UX and performance considerations.


71-77: Excellent performance optimization with memoized member lookup.

The membersMap implementation using useMemo and Map provides O(1) member name lookups, significantly improving performance over the previous O(n) array search pattern, especially for groups with many members.


86-86: Improved theme integration for balance colors.

Good use of theme colors as the base with appropriate hardcoded colors for positive/negative balances that maintain semantic meaning across light/dark themes.

Also applies to: 90-90, 93-93


237-237: Nice visual enhancement with increased border radius.

The increased border radius from the default to 16 provides a more modern, polished appearance that aligns well with the overall theme's roundness of 12.

frontend/screens/HomeScreen.js (5)

1-20: Good use of theming system!

The imports are properly organized and correctly import the new theming utilities. The use of useTheme from React Navigation and the tokens from the custom theme module shows proper integration with the centralized theming system.


23-147: Well-structured component refactoring with excellent separation of concerns!

The extraction of GroupItem as a separate component is a great architectural decision that:

  • Properly manages hooks per item (avoiding hook rules violations)
  • Encapsulates item-specific animations and gestures cleanly
  • Improves code organization and maintainability

The implementation of swipe gestures with clear action buttons is intuitive and the use of theme tokens for colors ensures consistency.


165-186: Robust error handling in settlement calculation

Good implementation with proper error handling that returns safe defaults when API calls fail. The graceful degradation ensures the UI remains functional even when settlement data is unavailable.


196-211: Excellent chunked processing implementation!

The chunked approach for fetching settlement statuses (processing 5 groups at a time) is a smart optimization that:

  • Prevents overwhelming the API with too many concurrent requests
  • Provides progressive updates to the UI
  • Maintains good performance characteristics

This is a well-thought-out solution for handling potentially large lists of groups.


298-301: Good FlatList optimizations!

The performance optimizations with initialNumToRender, windowSize, and removeClippedSubviews are appropriate for potentially long lists. These will help maintain smooth scrolling performance.

frontend/index.js (1)

1-10: Correct placement of gesture handler import

The import of react-native-gesture-handler is correctly placed at the top level, which is required for proper initialization of the gesture system before any other code runs.

frontend/navigation/AppNavigator.js (2)

9-13: Clean implementation of theme switching

The color scheme detection and theme selection logic is well-implemented. The conditional assignment based on the system's color scheme provides a seamless dark/light mode experience.


22-26: Proper theme integration with NavigationContainer

The theme is correctly applied to the NavigationContainer, ensuring consistent theming across all navigation UI elements.

frontend/App.js (3)

8-10: Consistent theme selection pattern

Good consistency with the theme selection logic used in AppNavigator. Both components use the same pattern for detecting and applying the appropriate theme based on the system color scheme.


14-16: Proper gesture handler setup

The GestureHandlerRootView is correctly placed as a wrapper with the required flex: 1 style, ensuring gestures work throughout the app hierarchy.


11-18: Well-structured component hierarchy

The component tree is properly organized:

  1. AuthProvider at the root for authentication context
  2. PaperProvider with dynamic theme for UI components
  3. GestureHandlerRootView for gesture support
  4. AppNavigator for navigation

This hierarchy ensures all features work correctly together.

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

Labels

run-preview To run Expo preview build on forks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants