Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughAdds pre-flight camera/microphone readiness checks and UI for KYC flows: new media permission utilities and types, a useKycCameraCheck hook, CameraPermissionWarningModal component, integrations into Bridge and Manteca KYC modals, Manteca flow now returns KYC URL, and dark-mode/tailwind CSS updates. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review in depth. Evaluate:
Also, write a very concise testing guide for QA |
There was a problem hiding this comment.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/components/Kyc/InitiateBridgeKYCModal.tsx (1)
1-1: Fix Prettier formatting.The pipeline detected code style issues.
Run the following command to fix:
pnpm prettier --write src/components/Kyc/InitiateBridgeKYCModal.tsx
🧹 Nitpick comments (2)
src/hooks/useMantecaKycFlow.ts (1)
79-100: Consider adding an explicit return type annotation.Adding a return type would make the discriminated union pattern more explicit and provide better IntelliSense for callers.
const openMantecaKyc = useCallback(async (countryParam?: CountryData): Promise< | { success: true; url: string } | { success: false; error: string } > => {Based on learnings.
src/components/Kyc/InitiateMantecaKYCModal.tsx (1)
50-62: Recommend stabilizing theonKycSuccesscallback.The
useEffectincludesonKycSuccessin its dependency array. If this callback isn't memoized by the parent, the message event handler will be re-registered on every render, which is inefficient.Consider either:
- Wrapping
onKycSuccessinuseCallbackat the call site, or- Using a ref pattern to avoid the dependency:
+ const onKycSuccessRef = useRef(onKycSuccess) + useEffect(() => { + onKycSuccessRef.current = onKycSuccess + }, [onKycSuccess]) + useEffect(() => { const handleMessage = (event: MessageEvent) => { if (event.data.source === 'peanut-kyc-success') { - onKycSuccess?.() + onKycSuccessRef.current?.() } } window.addEventListener('message', handleMessage) return () => { window.removeEventListener('message', handleMessage) } - }, [onKycSuccess]) + }, [])
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
src/components/Kyc/CameraPermissionWarningModal.tsx(1 hunks)src/components/Kyc/InitiateBridgeKYCModal.tsx(4 hunks)src/components/Kyc/InitiateMantecaKYCModal.tsx(5 hunks)src/hooks/useKycCameraCheck.ts(1 hunks)src/hooks/useMantecaKycFlow.ts(1 hunks)src/styles/globals.css(3 hunks)src/utils/mediaPermissions.utils.ts(1 hunks)tailwind.config.js(1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1396
File: src/app/(mobile-ui)/home/page.tsx:295-304
Timestamp: 2025-11-04T17:47:06.328Z
Learning: In src/app/(mobile-ui)/home/page.tsx, when closing the KycCompletedModal, updateUserById is called without awaiting to provide instant feedback to the user. This fire-and-forget pattern for modal dismissals and UI preference updates is intentional and consistent across the codebase—user experience with instant UI feedback takes priority over waiting for backend sync operations.
Learnt from: Hugo0
Repo: peanutprotocol/peanut-ui PR: 942
File: src/components/AddMoney/consts/index.ts:2151-2162
Timestamp: 2025-06-30T10:44:08.048Z
Learning: Hugo0 often agrees with refactoring suggestions but defers implementation due to time constraints, preferring to track improvements as follow-up issues when they're part of larger architectural changes.
📚 Learning: 2025-08-11T10:35:02.715Z
Learnt from: kushagrasarathe
Repo: peanutprotocol/peanut-ui PR: 1078
File: src/hooks/useKycFlow.ts:129-141
Timestamp: 2025-08-11T10:35:02.715Z
Learning: In the KYC flow implementation in `src/hooks/useKycFlow.ts`, when Terms of Service (ToS) is accepted, there will always be a KYC link available in the `apiResponse`. The system ensures this invariant, so defensive checks for missing KYC links after ToS acceptance are unnecessary.
Applied to files:
src/hooks/useKycCameraCheck.tssrc/components/Kyc/InitiateBridgeKYCModal.tsxsrc/hooks/useMantecaKycFlow.ts
📚 Learning: 2025-06-22T16:10:53.167Z
Learnt from: kushagrasarathe
Repo: peanutprotocol/peanut-ui PR: 915
File: src/hooks/useKycFlow.ts:96-124
Timestamp: 2025-06-22T16:10:53.167Z
Learning: The `initiateKyc` function in `src/app/actions/users.ts` already includes comprehensive error handling with try-catch blocks and returns structured responses with either `{ data }` or `{ error }` fields, so additional try-catch blocks around its usage are not needed.
Applied to files:
src/hooks/useKycCameraCheck.tssrc/components/Kyc/InitiateMantecaKYCModal.tsxsrc/hooks/useMantecaKycFlow.ts
📚 Learning: 2025-08-20T09:08:19.266Z
Learnt from: kushagrasarathe
Repo: peanutprotocol/peanut-ui PR: 1112
File: src/components/Claim/Link/views/BankFlowManager.view.tsx:336-343
Timestamp: 2025-08-20T09:08:19.266Z
Learning: In the KYC flow implementation, `setJustCompletedKyc` must be called after `await fetchUser()` in the `handleKycSuccess` callback. Setting `justCompletedKyc` before fetching the user would cause a re-fetching loop because `handleKycSuccess` is set in a useEffect inside the KYC hook, which would cause the UI flow to get stuck in one view.
Applied to files:
src/hooks/useKycCameraCheck.tssrc/components/Kyc/InitiateMantecaKYCModal.tsxsrc/components/Kyc/InitiateBridgeKYCModal.tsx
📚 Learning: 2025-11-04T17:47:06.328Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1396
File: src/app/(mobile-ui)/home/page.tsx:295-304
Timestamp: 2025-11-04T17:47:06.328Z
Learning: In src/app/(mobile-ui)/home/page.tsx, when closing the KycCompletedModal, updateUserById is called without awaiting to provide instant feedback to the user. This fire-and-forget pattern for modal dismissals and UI preference updates is intentional and consistent across the codebase—user experience with instant UI feedback takes priority over waiting for backend sync operations.
Applied to files:
src/components/Kyc/InitiateMantecaKYCModal.tsxsrc/components/Kyc/InitiateBridgeKYCModal.tsx
📚 Learning: 2025-05-21T18:52:22.958Z
Learnt from: kushagrasarathe
Repo: peanutprotocol/peanut-ui PR: 870
File: src/styles/globals.css:18-18
Timestamp: 2025-05-21T18:52:22.958Z
Learning: In the peanut-ui project, using `-webkit-tap-highlight-color: none` fixed an issue with blue highlights appearing when tapping inputs on mobile devices, even though `none` is not a technically valid value for this CSS property according to specifications. The valid alternative would be `transparent`.
Applied to files:
src/styles/globals.css
🧬 Code graph analysis (4)
src/components/Kyc/CameraPermissionWarningModal.tsx (3)
src/utils/mediaPermissions.utils.ts (1)
MediaCheckResult(6-12)src/components/Global/ActionModal/index.tsx (1)
ActionModalButtonProps(8-12)src/components/Global/Icons/Icon.tsx (1)
IconName(70-136)
src/hooks/useKycCameraCheck.ts (1)
src/utils/mediaPermissions.utils.ts (2)
MediaCheckResult(6-12)checkKycMediaReadiness(103-117)
src/components/Kyc/InitiateMantecaKYCModal.tsx (2)
src/hooks/useKycCameraCheck.ts (1)
useKycCameraCheck(14-64)src/components/Kyc/CameraPermissionWarningModal.tsx (1)
CameraPermissionWarningModal(19-79)
src/components/Kyc/InitiateBridgeKYCModal.tsx (3)
src/hooks/useKycCameraCheck.ts (1)
useKycCameraCheck(14-64)src/utils/general.utils.ts (1)
saveRedirectUrl(786-790)src/components/Kyc/CameraPermissionWarningModal.tsx (1)
CameraPermissionWarningModal(19-79)
🪛 GitHub Actions: Tests
src/components/Kyc/CameraPermissionWarningModal.tsx
[warning] 1-1: Code style issues found by Prettier. Run 'pnpm prettier --write' to fix.
src/components/Kyc/InitiateBridgeKYCModal.tsx
[warning] 1-1: Code style issues found by Prettier. Run 'pnpm prettier --write' to fix.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Deploy-Preview
🔇 Additional comments (8)
src/hooks/useMantecaKycFlow.ts (1)
92-92: LGTM! Returning the URL enables pre-flight checks.Exposing the
urlin the return value allows callers to perform camera permission checks or other validations before opening the iframe, which aligns well with the new KYC camera check flow.tailwind.config.js (1)
6-6: LGTM! Dark mode configuration correctly enabled.The dual-selector approach (class and data-theme attribute) provides flexible dark mode support throughout the application.
src/styles/globals.css (2)
393-393: LGTM! Consistent dark mode styling.The dark mode variants for
.panelare properly configured with matching border, background, and ring colors.
428-428: LGTM! Dark mode variants properly applied.The
.border-roundedand.ring-smclasses now correctly support dark mode with appropriate color adjustments.Also applies to: 432-432
src/components/Kyc/CameraPermissionWarningModal.tsx (1)
19-79: LGTM - Well-structured camera permission warning flow.The component correctly handles different severity levels (error vs. warning) and provides appropriate CTAs. The conditional "Try Anyway" button (only for warnings) is a good UX pattern.
src/utils/mediaPermissions.utils.ts (3)
18-83: LGTM - Comprehensive media capability detection.The
checkMediaAvailabilityfunction correctly handles various failure modes with appropriate severity levels. The decision to mark missing microphone as a warning (not error) is reasonable, as some KYC flows may proceed without it.
89-98: LGTM - Restricted environment detection.The user agent patterns for iOS WebView and in-app browsers are appropriate for detecting environments where iframe camera/mic access is typically restricted.
103-117: LGTM - Effective combined readiness check.The function appropriately combines capability checks with environment detection to provide a complete picture of KYC readiness.
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 21765 🏁 Script executed: Length of output: 18787 🏁 Script executed: Length of output: 18893 @Hugo0, I've completed the in-depth review. Here's my comprehensive analysis: 🚨 Critical Issues1. Runtime Error - Missing State SetterSeverity: CRITICAL 🔴 Both Fix required: 2. Double API Call IssueSeverity: HIGH 🟠 In This means in the "show warning" path, the KYC is initiated twice, wasting an API call. Fix: Store the result and reuse it: 3. Unstable useEffect DependencySeverity: MEDIUM 🟡
If parent doesn't memoize
|
| Category | Risk Level | Notes |
|---|---|---|
| Breaking existing functionality | 🔴 HIGH | Critical bug will cause runtime errors |
| UX degradation | 🟡 MEDIUM | 100-500ms latency added, but flow improves for restricted devices |
| Performance impact | 🟡 MEDIUM | One async API call per verification attempt |
| Edge cases | 🟡 MEDIUM | Several edge cases not fully handled |
| Code quality | 🟢 LOW | Good structure, minor DRY violations |
💡 Recommendations
- MUST FIX BEFORE MERGE: Export
setShowCameraWarningfrom hook - SHOULD FIX: Eliminate double API call
- CONSIDER: Add loading indicator during media check
- CONSIDER: Memoize
onKycSuccesscallback in parent components - CONSIDER: Feature flag dark mode changes for gradual rollout
Let me know if you want me to create follow-up issues for any of these findings! 🚀
🧠 Learnings used
Learnt from: Hugo0
Repo: peanutprotocol/peanut-ui PR: 852
File: src/hooks/useTransactionHistory.ts:177-239
Timestamp: 2025-05-14T21:16:06.369Z
Learning: When reviewing code, pay attention to and resolve CodeRabbit comments as they can contain useful refactoring suggestions and insights.
Learnt from: Hugo0
Repo: peanutprotocol/peanut-ui PR: 594
File: src/components/Request/Pay/Views/Initial.view.tsx:188-213
Timestamp: 2024-12-31T15:08:15.640Z
Learning: Always resolve coderabbit comments when reviewing code, since they can contain useful suggestions.
Learnt from: Hugo0
Repo: peanutprotocol/peanut-ui PR: 942
File: src/components/AddMoney/consts/index.ts:2151-2162
Timestamp: 2025-06-30T10:44:08.048Z
Learning: Hugo0 often agrees with refactoring suggestions but defers implementation due to time constraints, preferring to track improvements as follow-up issues when they're part of larger architectural changes.
|
@coderabbitai review in depth again. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 13775 @Hugo0, excellent work on the fixes! Here's my updated in-depth review: ✅ Critical Issues RESOLVED1. Missing State Setter - FIXED ✅The 2. Double API Call - FIXED ✅The logic was elegantly refactored (lines 23-45). Now 3. Loading State Added - FIXED ✅New 4. URL Security Validation - NEW IMPROVEMENT ✅Added URL validation in This prevents opening non-HTTPS URLs. Good security practice!
|
| Category | Previous | Current | Change |
|---|---|---|---|
| Breaking functionality | 🔴 HIGH | 🟢 LOW | ✅ FIXED |
| UX degradation | 🟡 MEDIUM | 🟢 LOW | ✅ IMPROVED |
| Performance impact | 🟡 MEDIUM | 🟢 LOW | ✅ IMPROVED |
| Edge cases | 🟡 MEDIUM | 🟡 LOW-MEDIUM | ✅ IMPROVED |
| Code quality | 🟢 LOW | 🟢 LOW | ✅ MAINTAINED |
Overall Risk: LOW ✅
🎯 Code Quality Observations
Positive Changes:
- Better separation of concerns -
isCheckingflag prevents race conditions - Security-conscious - HTTPS validation before opening URLs
- User experience - Loading states provide clear feedback
- DRY principle - Hook abstraction eliminated duplication effectively
Nitpicks (Optional):
- Could extract the URL validation logic to a utility function for reuse
- The
try-finallypattern inhandleVerifyClickis clean but could add error logging in catch block for debugging
🧪 Updated QA Testing Guide
Priority Test Scenarios:
1. Happy Path - Normal Device
- Device: Desktop with webcam
- Steps:
- Click "Verify now"
- Should see "Loading..." briefly
- Proceeds to KYC iframe (no warning)
- Expected: < 1 second total, smooth flow
2. No Camera - Error Modal
- Device: Desktop without camera OR browser permission denied
- Steps:
- Click "Verify now"
- "Loading..." → Error modal: "Camera or Microphone Required"
- Only "Open in Browser" visible
- Click "Open in Browser" → Opens in new HTTPS tab
- Expected: Modal closes, new tab opens
3. In-App Browser - Warning Modal
- Device: iPhone in Instagram/Facebook browser
- Steps:
- Click "Verify now"
- "Loading..." → Warning modal: "Camera Access May Be Limited"
- Two buttons: "Open in Browser" and "Try Anyway"
- Test "Try Anyway" → Proceeds to KYC
- Test "Open in Browser" → Opens in Safari
- Expected: Both paths work correctly
4. Double-Click Prevention
- Device: Any
- Steps:
- Click "Verify now" rapidly 5 times
- Expected: Only one KYC session initiated, button disabled during check
5. Manteca Flow (Country-Specific)
- Repeat tests 1-4 for Manteca KYC modal
- Additional: Test country selection persistence
- Expected: Same behavior as Bridge KYC
6. Dark Mode Comprehensive
- Toggle dark mode across:
- KYC modals
- Camera warning modal
- Input fields on other pages
- Panels and borders throughout app
- Expected: All text readable, proper contrast, no visual glitches
7. Edge Case - HTTP URL Attack
- Manual test (dev tools):
- Modify
kycUrlForBrowserto usehttp://instead ofhttps:// - Click "Open in Browser"
- Modify
- Expected: URL should NOT open (security check blocks it)
8. Regression Testing
- Verify existing users with completed KYC aren't affected
- Test KYC flows from different entry points (add money, withdraw, request)
- Confirm no console errors during normal flow
- Check analytics/tracking still fires correctly
💡 Final Recommendations
Pre-Merge:
✅ All critical issues resolved - SAFE TO MERGE
Optional Enhancements (Future PR):
- Memoize
onKycSuccessin parent components to fix useEffect dependency - Add error logging in
handleVerifyClickcatch block for production debugging - Feature flag dark mode if you want gradual rollout
- Add more in-app browser UA strings as you discover them
Monitoring Post-Deploy:
- Watch for any KYC flow drop-off spikes
- Monitor console errors related to media permissions
- Check if "Open in Browser" CTA gets high usage (indicates detection issues)
🎉 Summary
The PR went from HIGH RISK → LOW RISK after your fixes. The two critical bugs are resolved, performance is improved with loading states, and security is enhanced with URL validation. The remaining issues are minor and don't block merge.
Recommendation: ✅ APPROVE after successful QA testing
Great refactoring work! The code is now cleaner, safer, and more maintainable. 🚀
🧠 Learnings used
Learnt from: Hugo0
Repo: peanutprotocol/peanut-ui PR: 852
File: src/hooks/useTransactionHistory.ts:177-239
Timestamp: 2025-05-14T21:16:06.369Z
Learning: When reviewing code, pay attention to and resolve CodeRabbit comments as they can contain useful refactoring suggestions and insights.
Learnt from: Hugo0
Repo: peanutprotocol/peanut-ui PR: 594
File: src/components/Request/Pay/Views/Initial.view.tsx:188-213
Timestamp: 2024-12-31T15:08:15.640Z
Learning: Always resolve coderabbit comments when reviewing code, since they can contain useful suggestions.
Learnt from: Hugo0
Repo: peanutprotocol/peanut-ui PR: 942
File: src/components/AddMoney/consts/index.ts:2151-2162
Timestamp: 2025-06-30T10:44:08.048Z
Learning: Hugo0 often agrees with refactoring suggestions but defers implementation due to time constraints, preferring to track improvements as follow-up issues when they're part of larger architectural changes.
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/components/Kyc/InitiateMantecaKYCModal.tsx (1)
57-72: WraponKycSuccesscallbacks withuseCallbackin all parent components to prevent unnecessary event listener churn.The concern is valid and systematic: all 6 call sites pass non-memoized callbacks to
MantecaGeoSpecificKycModal, causing the message event listener to be removed and re-added on every parent render.Affected files require fixes:
src/components/Payment/Views/MantecaFulfillment.view.tsx:87–91src/components/AddMoney/components/MantecaAddMoney.tsx:155–159src/components/Profile/views/IdentityVerification.view.tsx:208(handleRedirect)src/components/Claim/Link/MantecaFlowManager.tsx:136–140src/app/(mobile-ui)/withdraw/manteca/page.tsx:561–565src/app/(mobile-ui)/qr-pay/page.tsx:873–881Wrap each callback with
useCallbackto stabilize the dependency and prevent listener churn.
🧹 Nitpick comments (1)
src/components/Kyc/InitiateMantecaKYCModal.tsx (1)
59-60: Origin validation is weak but acceptable.The origin validation checks if
event.origin.includes('manteca'), which is relatively permissive (e.g., would matchhttps://fake-manteca-phishing.com). For stricter security, consider validating against the exact expected origin.Example of stricter validation:
-if (!event.origin.includes('manteca')) return +const ALLOWED_ORIGINS = ['https://manteca.example.com', 'https://manteca-staging.example.com'] +if (!ALLOWED_ORIGINS.includes(event.origin)) returnHowever, if the actual Manteca domain includes "manteca" as a subdomain or path, the current approach may be sufficient for this use case.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/components/Kyc/InitiateBridgeKYCModal.tsx(5 hunks)src/components/Kyc/InitiateMantecaKYCModal.tsx(4 hunks)src/hooks/useKycCameraCheck.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (12)
📓 Common learnings
Learnt from: Hugo0
Repo: peanutprotocol/peanut-ui PR: 942
File: src/components/AddMoney/consts/index.ts:2151-2162
Timestamp: 2025-06-30T10:44:08.048Z
Learning: Hugo0 often agrees with refactoring suggestions but defers implementation due to time constraints, preferring to track improvements as follow-up issues when they're part of larger architectural changes.
📚 Learning: 2025-08-11T10:35:02.715Z
Learnt from: kushagrasarathe
Repo: peanutprotocol/peanut-ui PR: 1078
File: src/hooks/useKycFlow.ts:129-141
Timestamp: 2025-08-11T10:35:02.715Z
Learning: In the KYC flow implementation in `src/hooks/useKycFlow.ts`, when Terms of Service (ToS) is accepted, there will always be a KYC link available in the `apiResponse`. The system ensures this invariant, so defensive checks for missing KYC links after ToS acceptance are unnecessary.
Applied to files:
src/hooks/useKycCameraCheck.tssrc/components/Kyc/InitiateBridgeKYCModal.tsx
📚 Learning: 2025-11-04T17:47:06.328Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1396
File: src/app/(mobile-ui)/home/page.tsx:295-304
Timestamp: 2025-11-04T17:47:06.328Z
Learning: In src/app/(mobile-ui)/home/page.tsx, when closing the KycCompletedModal, updateUserById is called without awaiting to provide instant feedback to the user. This fire-and-forget pattern for modal dismissals and UI preference updates is intentional and consistent across the codebase—user experience with instant UI feedback takes priority over waiting for backend sync operations.
Applied to files:
src/hooks/useKycCameraCheck.tssrc/components/Kyc/InitiateBridgeKYCModal.tsxsrc/components/Kyc/InitiateMantecaKYCModal.tsx
📚 Learning: 2025-06-22T16:10:53.167Z
Learnt from: kushagrasarathe
Repo: peanutprotocol/peanut-ui PR: 915
File: src/hooks/useKycFlow.ts:96-124
Timestamp: 2025-06-22T16:10:53.167Z
Learning: The `initiateKyc` function in `src/app/actions/users.ts` already includes comprehensive error handling with try-catch blocks and returns structured responses with either `{ data }` or `{ error }` fields, so additional try-catch blocks around its usage are not needed.
Applied to files:
src/hooks/useKycCameraCheck.tssrc/components/Kyc/InitiateBridgeKYCModal.tsxsrc/components/Kyc/InitiateMantecaKYCModal.tsx
📚 Learning: 2025-08-20T09:08:19.266Z
Learnt from: kushagrasarathe
Repo: peanutprotocol/peanut-ui PR: 1112
File: src/components/Claim/Link/views/BankFlowManager.view.tsx:336-343
Timestamp: 2025-08-20T09:08:19.266Z
Learning: In the KYC flow implementation, `setJustCompletedKyc` must be called after `await fetchUser()` in the `handleKycSuccess` callback. Setting `justCompletedKyc` before fetching the user would cause a re-fetching loop because `handleKycSuccess` is set in a useEffect inside the KYC hook, which would cause the UI flow to get stuck in one view.
Applied to files:
src/hooks/useKycCameraCheck.tssrc/components/Kyc/InitiateBridgeKYCModal.tsxsrc/components/Kyc/InitiateMantecaKYCModal.tsx
📚 Learning: 2024-12-11T10:13:22.806Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 564
File: src/components/Request/Pay/Views/Initial.view.tsx:430-430
Timestamp: 2024-12-11T10:13:22.806Z
Learning: In the React TypeScript file `src/components/Request/Pay/Views/Initial.view.tsx`, when reviewing the `InitialView` component, do not flag potential issues with using non-null assertion `!` on the `slippagePercentage` variable, as handling undefined values in this context is considered out of scope.
Applied to files:
src/hooks/useKycCameraCheck.tssrc/components/Kyc/InitiateBridgeKYCModal.tsxsrc/components/Kyc/InitiateMantecaKYCModal.tsx
📚 Learning: 2024-10-24T12:45:22.708Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 478
File: src/components/Request/Create/Views/Initial.view.tsx:169-176
Timestamp: 2024-10-24T12:45:22.708Z
Learning: When calling `handleOnNext` in `src/components/Request/Create/Views/Initial.view.tsx`, it's acceptable to duplicate parameter lists for readability instead of refactoring to avoid duplication.
Applied to files:
src/hooks/useKycCameraCheck.ts
📚 Learning: 2024-10-08T20:13:42.967Z
Learnt from: Hugo0
Repo: peanutprotocol/peanut-ui PR: 413
File: src/components/Request/Pay/Views/Initial.view.tsx:71-72
Timestamp: 2024-10-08T20:13:42.967Z
Learning: In `src/components/Request/Pay/Views/Initial.view.tsx`, it's acceptable to use the `!` operator in TypeScript to assert that `selectedTokenData` is not `null` or `undefined`, and potential runtime errors from accessing its properties without checks can be disregarded.
Applied to files:
src/hooks/useKycCameraCheck.tssrc/components/Kyc/InitiateBridgeKYCModal.tsx
📚 Learning: 2024-10-23T09:38:27.670Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 469
File: src/app/request/pay/page.tsx:32-64
Timestamp: 2024-10-23T09:38:27.670Z
Learning: In `src/app/request/pay/page.tsx`, if `linkRes` is not OK in the `generateMetadata` function, the desired behavior is to use the standard title and preview image without throwing an error.
Applied to files:
src/hooks/useKycCameraCheck.tssrc/components/Kyc/InitiateMantecaKYCModal.tsx
📚 Learning: 2025-10-07T10:19:20.077Z
Learnt from: kushagrasarathe
Repo: peanutprotocol/peanut-ui PR: 1286
File: src/components/MultiStepBankAccountForm/FormInput.tsx:10-10
Timestamp: 2025-10-07T10:19:20.077Z
Learning: The codebase follows a strict policy of avoiding `any` types. Always use proper TypeScript types, particularly from libraries like react-hook-form (RegisterOptions, FieldErrors, UseFormSetValue, etc.) rather than using `any`.
Applied to files:
src/hooks/useKycCameraCheck.ts
📚 Learning: 2024-12-02T17:19:18.532Z
Learnt from: jjramirezn
Repo: peanutprotocol/peanut-ui PR: 551
File: src/components/Request/Create/Views/Initial.view.tsx:151-156
Timestamp: 2024-12-02T17:19:18.532Z
Learning: In the `InitialView` component at `src/components/Request/Create/Views/Initial.view.tsx`, when setting the default chain and token in the `useEffect` triggered by `isPeanutWallet`, it's acceptable to omit the setters from the dependency array and not include additional error handling for invalid defaults.
Applied to files:
src/components/Kyc/InitiateBridgeKYCModal.tsxsrc/components/Kyc/InitiateMantecaKYCModal.tsx
📚 Learning: 2025-09-18T09:30:42.901Z
Learnt from: Zishan-7
Repo: peanutprotocol/peanut-ui PR: 1230
File: src/app/(mobile-ui)/withdraw/page.tsx:92-97
Timestamp: 2025-09-18T09:30:42.901Z
Learning: In src/app/(mobile-ui)/withdraw/page.tsx, the useEffect that calls setShowAllWithdrawMethods(true) when amountFromContext exists is intentionally designed to run only on component mount (empty dependency array), not when amountFromContext changes. This is the correct behavior for the withdraw flow where showing all methods should only happen on initial load when an amount is already present.
Applied to files:
src/components/Kyc/InitiateBridgeKYCModal.tsxsrc/components/Kyc/InitiateMantecaKYCModal.tsx
🧬 Code graph analysis (3)
src/hooks/useKycCameraCheck.ts (1)
src/utils/mediaPermissions.utils.ts (2)
MediaCheckResult(6-12)checkKycMediaReadiness(103-117)
src/components/Kyc/InitiateBridgeKYCModal.tsx (3)
src/hooks/useKycCameraCheck.ts (1)
useKycCameraCheck(14-80)src/utils/general.utils.ts (1)
saveRedirectUrl(786-790)src/components/Kyc/CameraPermissionWarningModal.tsx (1)
CameraPermissionWarningModal(19-79)
src/components/Kyc/InitiateMantecaKYCModal.tsx (2)
src/hooks/useKycCameraCheck.ts (1)
useKycCameraCheck(14-80)src/components/Kyc/CameraPermissionWarningModal.tsx (1)
CameraPermissionWarningModal(19-79)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Deploy-Preview
🔇 Additional comments (4)
src/components/Kyc/InitiateBridgeKYCModal.tsx (1)
37-49: LGTM - Critical issue resolved.The previous critical issue regarding
setShowCameraWarningbeing undefined has been resolved. TheuseKycCameraCheckhook now correctly exportssetShowCameraWarning(line 73 in useKycCameraCheck.ts), so callingsetShowCameraWarning(false)on line 94 is valid and will not cause a runtime error.The camera check integration is well-implemented with proper loading states and flow control.
Also applies to: 94-94
src/hooks/useKycCameraCheck.ts (2)
20-47: LGTM - Duplicate API call issue resolved.The previous concern about duplicate
onInitiateKyc()calls has been properly addressed. The function now callsonInitiateKyc()exactly once (line 30) and reuses the result throughout the conditional logic. The comment "Always call KYC initiation once" accurately reflects the implementation.The flow correctly handles the camera warning path and ensures
shouldProceedis determined from a single API call.
71-79: LGTM - ExportssetShowCameraWarningas needed.The hook now correctly exports
setShowCameraWarning, resolving the critical issue flagged in previous reviews. Consumers of this hook (InitiateBridgeKYCModal and InitiateMantecaKYCModal) can now safely callsetShowCameraWarning(false)in theironClosehandlers.src/components/Kyc/InitiateMantecaKYCModal.tsx (1)
44-55: LGTM - Critical issue resolved.Similar to the Bridge KYC modal, the critical issue with
setShowCameraWarningbeing undefined has been resolved. TheuseKycCameraCheckhook now exportssetShowCameraWarning, making the call on line 104 valid.The camera check integration follows the same pattern as InitiateBridgeKYCModal and is properly implemented.
Also applies to: 104-104
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/styles/globals.css (1)
5-9: Inconsistency:color-scheme: light onlyconflicts with dark-mode enablement.The AI summary states the aggressive light-mode enforcement block was removed, but Line 7–9 still contains
color-scheme: light onlywithin@layer base. If the PR's goal is to enable dark mode (as evidenced by the Tailwind config change and dark: variants added throughout), this rule directly conflicts with it and may prevent dark mode rendering from working properly.Clarify intent: should this be updated to
color-scheme: light dark;or removed entirely to allow the Tailwind dark: classes to function as intended?
🧹 Nitpick comments (1)
src/styles/globals.css (1)
1-432: Visual QA required: dark-mode enablement is a design-level risk.Per PR objectives, enabling dark mode app-wide (via Tailwind config change and these CSS updates) requires comprehensive visual QA to prevent regressions. Ensure QA covers:
- All panel, input, border, and ring components in both light and dark modes.
- Modal and form layouts (especially KYC flows modified in this PR).
- Color contrast and readability in dark mode.
- Cross-browser and device testing (especially mobile dark-mode triggers).
Consider feature-flagged rollout or staged QA if regressions are detected.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/styles/globals.css(3 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: Hugo0
Repo: peanutprotocol/peanut-ui PR: 942
File: src/components/AddMoney/consts/index.ts:2151-2162
Timestamp: 2025-06-30T10:44:08.048Z
Learning: Hugo0 often agrees with refactoring suggestions but defers implementation due to time constraints, preferring to track improvements as follow-up issues when they're part of larger architectural changes.
📚 Learning: 2025-05-21T18:52:22.958Z
Learnt from: kushagrasarathe
Repo: peanutprotocol/peanut-ui PR: 870
File: src/styles/globals.css:18-18
Timestamp: 2025-05-21T18:52:22.958Z
Learning: In the peanut-ui project, using `-webkit-tap-highlight-color: none` fixed an issue with blue highlights appearing when tapping inputs on mobile devices, even though `none` is not a technically valid value for this CSS property according to specifications. The valid alternative would be `transparent`.
Applied to files:
src/styles/globals.css
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Deploy-Preview
🔇 Additional comments (2)
src/styles/globals.css (2)
393-393: Dark-mode utility classes are properly added and consistent.The dark: variants added to
.panel,.input-text,.border-rounded, and.ring-smfollow Tailwind conventions and are correctly formatted. The duplicatedark:border-whiteflagged in the past review of.input-texthas been resolved.Also applies to: 419-419, 428-428, 432-432
15-15: Tap-highlight styling uses correcttransparentvalue.The use of
-webkit-tap-highlight-color: transparent;is correct per CSS specs (an improvement from the non-standardnone). Placement is redundant across body and button selectors but functionally harmless.Also applies to: 23-23
Uh oh!
There was an error while loading. Please reload this page.