Skip to content

Comments

improvement#3

Merged
MaestroDev19 merged 6 commits intofortune710:mainfrom
MaestroDev19:main
Dec 3, 2025
Merged

improvement#3
MaestroDev19 merged 6 commits intofortune710:mainfrom
MaestroDev19:main

Conversation

@MaestroDev19
Copy link
Collaborator

@MaestroDev19 MaestroDev19 commented Dec 3, 2025

implemented
WhatsApp Image 2025-12-03 at 11 20 36_5981be11
Phone Number Screen Needs to Allow User Select Country Code and fixed keyboard bug
WhatsApp Image 2025-12-03 at 11 22 50_6b510513

Summary by CodeRabbit

  • New Features

    • Country code selector added to phone input so users can pick their country when updating phone numbers.
    • Searchable country picker modal for selecting and highlighting countries.
  • Improvements

    • Better keyboard-aware scrolling for profile update forms on mobile.
    • Improved phone input normalization and validation; saved numbers include the selected country code.

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

@vercel
Copy link

vercel bot commented Dec 3, 2025

@MaestroDev19 is attempting to deploy a commit to the fortune710's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 3, 2025

Walkthrough

Adds a country picker and country-aware phone input: new CountryPickerModal, country data (JSON + mapping), phone form changes to select/format country codes, and popover keyboard handling updated to a ScrollView with animated bottom padding.

Changes

Cohort / File(s) Summary
Phone Form Country Picker Integration
frontend/components/profile/phone-update-form.tsx
Added state for countryCode/countryIso/isPickerVisible, useEffect to parse existing value by longest country-code prefix, country selector button UI with ChevronDown, integrated CountryPickerModal, input normalization/validation (strip spaces/punctuation), and handleSave now sends fullPhoneNumber (countryCode + digits).
Profile Popover Keyboard Handling
frontend/components/profile/profile-update-popover.tsx
Replaced KeyboardAvoidingView with a ScrollView; added useAnimatedKeyboard / useAnimatedStyle animated bottom padding and BASE_PADDING_BOTTOM; adjusted popover padding/maxHeight and container style composition.
Country Picker Modal Component
frontend/components/ui/country-picker-modal.tsx
New exported CountryPickerModal component: pageSheet modal with header, search input, filtered FlatList of countries (flag emoji, name, calling code), onSelect/onClose props, and selectedCountryIso highlighting.
Country Data Management
frontend/constants/countries.ts, frontend/constants/countries_raw.json
Added countries_raw.json dataset and countries.ts mapping: Country interface (name, code, emoji, iso), getFlagEmoji helper, and exported countries: Country[] derived from raw JSON.
TypeScript Config
frontend/tsconfig.json
Enabled JSON module resolution ("resolveJsonModule": true) to allow importing countries_raw.json.

Sequence Diagram

sequenceDiagram
    actor User
    participant PhoneForm as Phone Update Form
    participant Modal as Country Picker Modal
    participant CountryData as Countries (JSON/Module)

    User->>PhoneForm: Tap country selector
    PhoneForm->>Modal: set visible=true
    User->>Modal: Type search query
    Modal->>CountryData: Filter by name/code/iso
    CountryData-->>Modal: Return filtered list
    Modal-->>User: Display list (emoji, name, code)
    User->>Modal: Select country
    Modal->>PhoneForm: onSelect(country)
    PhoneForm->>PhoneForm: Update countryCode & countryIso
    PhoneForm->>Modal: Close modal
    User->>PhoneForm: Enter phone digits
    PhoneForm->>PhoneForm: Normalize digits (strip punctuation)
    User->>PhoneForm: Tap save
    PhoneForm->>PhoneForm: Combine countryCode + digits -> handleSave(fullPhoneNumber)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Pay attention to: longest-prefix parsing logic in phone-update-form.tsx
  • Search/filter performance and selected-state handling in country-picker-modal.tsx
  • getFlagEmoji correctness and resolveJsonModule usage in countries.ts / tsconfig.json
  • Animated keyboard padding integration and ScrollView behavior in profile-update-popover.tsx

Poem

🐰 I hopped in with flags and a curious tune,
A modal to choose from sun, sea, and dune.
Digits get tidy, prefixes align,
A country, a code — and your phone looks fine! 📱✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
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.
Title check ❓ Inconclusive The title 'improvement' is vague and generic, lacking specificity about what was actually improved. Use a more descriptive title that clearly identifies the main changes, such as 'Add country code selection to phone update form' or 'Implement phone number international support with country picker'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
🧪 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 e175c6d and 9113d13.

📒 Files selected for processing (1)
  • frontend/constants/countries_raw.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/constants/countries_raw.json

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

🧹 Nitpick comments (3)
frontend/components/profile/phone-update-form.tsx (1)

64-97: Consider adding accessibility labels.

The country picker button and modal integration work well, but adding accessibilityLabel and accessibilityHint props would improve screen reader support.

For example:

 <TouchableOpacity 
   style={styles.countryPickerButton}
   onPress={() => setIsPickerVisible(true)}
+  accessibilityLabel={`Selected country code: ${countryCode}`}
+  accessibilityHint="Double tap to change country"
 >
frontend/components/ui/country-picker-modal.tsx (2)

16-24: Consider adding an empty state for search results.

The search filtering logic is well-implemented with proper memoization. However, when filteredCountries is empty, users see a blank screen with no feedback.

Consider adding an empty state message after the FlatList:

<FlatList
  data={filteredCountries}
  keyExtractor={(item) => item.iso}
  renderItem={renderItem}
  contentContainerStyle={styles.listContent}
  keyboardShouldPersistTaps="handled"
  ListEmptyComponent={
    <View style={styles.emptyState}>
      <Text style={styles.emptyText}>No countries found</Text>
    </View>
  }
/>

26-41: Add accessibility support to country items.

The country items would benefit from proper accessibility labels and roles for screen reader users.

Apply these changes:

 const renderItem = ({ item }: { item: Country }) => (
   <TouchableOpacity
     style={[
       styles.countryItem,
       selectedCountryIso === item.iso && styles.selectedItem,
     ]}
     onPress={() => {
       onSelect(item);
       onClose();
     }}
+    accessibilityRole="button"
+    accessibilityLabel={`${item.name}, calling code ${item.code}`}
+    accessibilityState={{ selected: selectedCountryIso === item.iso }}
   >
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5e2789c and e175c6d.

⛔ Files ignored due to path filters (1)
  • frontend/bun.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • frontend/components/profile/phone-update-form.tsx (4 hunks)
  • frontend/components/profile/profile-update-popover.tsx (6 hunks)
  • frontend/components/ui/country-picker-modal.tsx (1 hunks)
  • frontend/constants/countries.ts (1 hunks)
  • frontend/constants/countries_raw.json (1 hunks)
  • frontend/tsconfig.json (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
frontend/components/ui/country-picker-modal.tsx (1)
frontend/constants/countries.ts (2)
  • Country (3-8)
  • countries (25-30)
frontend/components/profile/phone-update-form.tsx (3)
frontend/hooks/use-profile-operations.ts (1)
  • useProfileOperations (25-169)
frontend/constants/countries.ts (1)
  • countries (25-30)
frontend/components/ui/country-picker-modal.tsx (1)
  • CountryPickerModal (13-75)
🔇 Additional comments (10)
frontend/tsconfig.json (1)

9-10: LGTM!

Adding resolveJsonModule is the correct approach to enable importing the countries_raw.json file as a module. This is required for the country picker functionality.

frontend/components/profile/phone-update-form.tsx (3)

23-40: LGTM! Robust country code extraction logic.

The useEffect correctly handles country code extraction by:

  • Finding all matching prefixes
  • Sorting by length to get the longest match (handles ambiguous cases like +1 vs +1684)
  • Falling back to using the entire value if no match is found

The logic properly handles edge cases including empty values and non-prefixed numbers.


42-44: LGTM! Solid validation logic.

The validation correctly:

  • Normalizes input by removing formatting characters
  • Validates that the normalized value contains only digits
  • Ensures non-empty input

This handles various phone number formats users might enter.


46-58: LGTM! Proper phone number construction.

The handleSave function correctly constructs the full international phone number by concatenating the country code with the normalized digits, ensuring a consistent format is sent to the backend.

frontend/components/ui/country-picker-modal.tsx (1)

43-74: LGTM! Well-structured modal component.

The modal is properly configured with:

  • Appropriate animation and presentation style
  • Required onRequestClose handler for Android
  • Clean header with close button
  • Searchable country list with good UX

The component is reusable and follows React Native best practices.

frontend/components/profile/profile-update-popover.tsx (2)

35-39: LGTM! Modern keyboard handling approach.

Using useAnimatedKeyboard from react-native-reanimated provides smooth, reactive keyboard animations. The dynamic padding calculation ensures content remains visible when the keyboard is shown, which is especially important for the new country picker modal.


102-108: LGTM! ScrollView with proper keyboard handling.

Replacing KeyboardAvoidingView with ScrollView and keyboardShouldPersistTaps="handled" is a cleaner approach that works well with the animated keyboard padding. This ensures form inputs remain accessible when the keyboard is visible.

frontend/constants/countries.ts (3)

3-8: LGTM! Clean interface definition.

The Country interface is well-defined with appropriate fields for the country picker functionality. The distinction between code (dial code) and iso (country code) is clear.


16-23: LGTM! Correct flag emoji generation.

The getFlagEmoji function correctly converts ISO 3166-1 alpha-2 country codes to flag emojis using regional indicator symbols. The offset calculation (127397) is correct, and the length validation prevents errors for invalid codes.


25-30: LGTM! Correct data transformation.

The mapping from RawCountry to Country correctly:

  • Maps dial_code to code (the phone calling code)
  • Uses the ISO code for both emoji generation and the iso field
  • Preserves the country name

The transformation is clean and maintains data integrity.

@MaestroDev19 MaestroDev19 merged commit 4a5b821 into fortune710:main Dec 3, 2025
1 of 2 checks passed
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.

1 participant