Skip to content

various fixes#1329

Merged
Hugo0 merged 5 commits intopeanut-wallet-devfrom
chore/pts_fixes
Oct 16, 2025
Merged

various fixes#1329
Hugo0 merged 5 commits intopeanut-wallet-devfrom
chore/pts_fixes

Conversation

@Hugo0
Copy link
Contributor

@Hugo0 Hugo0 commented Oct 16, 2025

image

ALSO edits 270 files lmao. It improves the file importing for types for perf

@Hugo0 Hugo0 requested a review from jjramirezn October 16, 2025 05:03
@vercel
Copy link

vercel bot commented Oct 16, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
peanut-wallet Ready Ready Preview Comment Oct 16, 2025 3:31pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 16, 2025

Important

Review skipped

More than 25% of the files skipped due to max files limit. The review is being skipped to prevent a low-quality review.

153 files out of 260 files are above the max files limit of 100. Please upgrade to Pro plan to get higher limits.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Build and TypeScript configs adjusted for Turbopack/transpilation and analyzer behavior. Multiple UI and interaction changes: new NavigationArrow component and replacements, points page restyle, hold-to-claim timing with 500ms preview, setup flow adds Landing step and JoinWaitlist tweaks. Some metadata functions now await Promise params. Branding text shortened to “Peanut”.

Changes

Cohort / File(s) Summary of changes
Next.js & TS build config
next.config.js, tsconfig.json, package.json
Added Turbopack config, resolve alias, serverExternalPackages, transpilePackages (@squirrel-labs/peanut-sdk), experimental optimizePackageImports, webpackBuildWorker; tightened analyzer condition; disabled productionBrowserSourceMaps. TS: moduleResolution→bundler, tsBuildInfoFile, verbatimModuleSyntax, expanded includes. Jest/test transforms updated in package.json.
Hold interaction timing (mobile)
src/app/(mobile-ui)/dev/shake-test/page.tsx, src/app/(mobile-ui)/qr-pay/page.tsx
Track hold start time and implement time-aware cancel with 500ms quick-tap preview window; centralized reset/cleanup and adjusted haptics/progress/shake flows.
Metadata params → Promise
src/app/request/[...username]/layout.tsx, src/app/send/[...username]/layout.tsx, src/app/send/[...username]/page.tsx
generateMetadata signatures updated to accept { params: Promise<{ username: string[] }> }; functions now await params and derive username from resolved array.
Branding / copy updates
src/app/api/health/route.ts, src/app/api/og/route.tsx, src/components/Global/ShareButton/index.tsx, src/config/wagmi.config.tsx, src/lib/og/build-og-metadata.ts, src/utils/general.utils.ts
Replaced instances of “Peanut Protocol” with “Peanut” and updated related descriptions/strings.
New NavigationArrow + replacements
src/components/Global/NavigationArrow/index.tsx, src/components/Global/TokenSelector/Components/NetworkListItem.tsx, src/components/Profile/components/ProfileMenuItem.tsx, src/app/(mobile-ui)/points/page.tsx
Added NavigationArrow component (rotated chevron); replaced prior chevron/Icon fallbacks with NavigationArrow in multiple components; points page imports it.
Points page restyle & CopyToClipboard prop
src/app/(mobile-ui)/points/page.tsx, src/components/Profile/index.tsx
Visual and layout changes to tier header/progress/badges; conditional max-tier behavior; CopyToClipboard usage now passes iconSize="4".
Setup flow: Landing & JoinWaitlist changes
src/components/Setup/Setup.consts.tsx, src/components/Setup/Setup.types.ts, src/components/Setup/Views/Landing.tsx, src/components/Setup/Views/JoinWaitlist.tsx, src/components/Setup/Views/index.ts
Added LandingStep component and export; extended ScreenId/ScreenProps with landing; adjusted welcome copy/back button; JoinWaitlist placeholder, Next CTA, removed login button, and UI separators.
Jest mocks & test env defaults
jest.setup.ts, src/utils/__mocks__/reown-appkit.ts, src/utils/__mocks__/justaname.ts, src/utils/__mocks__/web-push.ts
Added default test env vars in jest.setup.ts and introduced mocks for @reown/appkit/react, @justaname.id/react, and web-push to support tests.
Payment / Transaction / UI interactivity tweaks
src/components/Payment/PaymentInfoRow.tsx, src/components/TransactionDetails/TransactionDetailsReceipt.tsx
PaymentInfoRow gains optional onClick?: () => void and clickable styling when provided. Points row in TransactionDetailsReceipt is clickable and navigates to /points.
Misc UI and banner tweaks
src/hooks/useBanners.tsx, src/components/Global/ShareButton/index.tsx
KYC banner description broadened; ShareButton default title shortened to “Peanut”.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • jjramirezn
  • kushagrasarathe

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title Check ❓ Inconclusive The pull request title is "various fixes," which is an extremely vague and generic term that does not convey meaningful information about the changeset. The PR contains numerous distinct changes including build configuration updates, branding changes across multiple files, a new landing page component, UI refactoring with new component introductions, metadata function signature updates for Next.js, and interaction logic modifications. The title "various fixes" provides no specificity about which aspects are being addressed or what the primary focus is, making it impossible for a teammate scanning history to understand the actual content of the changes. Consider updating the title to be more specific and descriptive. For example, a title like "Rebrand from 'Peanut Protocol' to 'Peanut' with landing page setup and build optimizations" would be significantly more informative. At minimum, the title should highlight the most important change from the developer's perspective—either the branding updates, the new setup screen, or the build configuration changes—rather than using a generic umbrella term.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Description Check ✅ Passed The PR description provided by the author is directly related to the changeset. The author mentions three main areas: (1) various fixes based on a QA Workshop document, which aligns with the numerous UI and functional improvements across components like shake-test, points page, and setup pages; (2) Turbopack optimization for local development, which corresponds to the expanded next.config.js with new Turbopack configuration and experimental optimizations; and (3) adding a new setup screen, which is clearly evident in the addition of Landing.tsx, updates to Setup.consts.tsx, Setup.types.ts, and JoinWaitlist.tsx refactoring. The mention of improving file importing for types performance also aligns with the tsconfig.json changes and Jest module resolution updates visible in the changeset.

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

Caution

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

⚠️ Outside diff range comments (3)
src/components/Setup/Views/JoinWaitlist.tsx (1)

15-15: Clean up unused login-related code.

The handleLoginClick, isLoggingIn, handleError, and onLoginClick functions are defined but never used after the UI refactor removed the login button. These should be removed to reduce code clutter and bundle size.

Apply this diff to remove the unused code:

 import { invitesApi } from '@/services/invites'
 import ErrorAlert from '@/components/Global/ErrorAlert'
-import { useLogin } from '@/hooks/useLogin'
 
 const JoinWaitlist = () => {
     const [inviteCode, setInviteCode] = useState('')
     const [isValid, setIsValid] = useState(false)
     const [isChanging, setIsChanging] = useState(false)
     const [isLoading, setisLoading] = useState(false)
     const [error, setError] = useState('')
 
     const toast = useToast()
     const { handleNext } = useSetupFlow()
     const dispatch = useAppDispatch()
-    const { handleLoginClick, isLoggingIn } = useLogin()
 
     const validateInviteCode = async (inviteCode: string): Promise<boolean> => {
         try {
             setError('')
             setisLoading(true)
             const res = await invitesApi.validateInviteCode(inviteCode)
             const isValid = res.success
             if (!isValid) {
                 setError('Invalid invite code')
             }
             return isValid
         } catch (e) {
             setError('Invalid invite code')
             return false
         } finally {
             setisLoading(false)
         }
     }
 
-    const handleError = (error: any) => {
-        const errorMessage =
-            error.code === 'LOGIN_CANCELED'
-                ? 'Login was canceled. Please try again.'
-                : error.code === 'NO_PASSKEY'
-                  ? 'No passkey found. Please create a wallet first.'
-                  : 'An unexpected error occurred during login.'
-        toast.error(errorMessage)
-        Sentry.captureException(error, { extra: { errorCode: error.code } })
-    }
-
-    const onLoginClick = async () => {
-        try {
-            await handleLoginClick()
-        } catch (e) {
-            handleError(e)
-        }
-    }
-
     return (
         <div className="flex flex-col gap-4">

Also applies to: 27-27, 47-64

src/app/(mobile-ui)/qr-pay/page.tsx (1)

598-659: Clear existing preview timers before starting a new hold

A quick tap schedules the preview reset timer. If the user presses again within that 500 ms window, startHold doesn’t clear the pending timeout or interval, so the old preview timer still fires and wipes the new hold’s progress/haptics mid-press. That leaves the hold interaction unreliable. Please clear any existing timeout/interval before starting the next hold.

     const startHold = useCallback(() => {
+        if (holdTimerRef.current) {
+            clearTimeout(holdTimerRef.current)
+            holdTimerRef.current = null
+        }
+        if (progressIntervalRef.current) {
+            clearInterval(progressIntervalRef.current)
+            progressIntervalRef.current = null
+        }
         setHoldProgress(0)
         setIsShaking(true)
 
         const startTime = Date.now()
         holdStartTimeRef.current = startTime
src/app/(mobile-ui)/dev/shake-test/page.tsx (1)

20-96: Cancel pending preview timers before restarting the hold

After a quick tap, the preview reset timeout remains scheduled. If a tester presses again before that timeout fires, the old timer still executes and zeroes out the new hold’s progress/intensity. Clear any existing timeout/interval before wiring up the next hold to keep the demo reliable.

     const startHold = useCallback(() => {
+        setHoldTimer((existing) => {
+            if (existing) clearTimeout(existing)
+            return null
+        })
+        setProgressInterval((existing) => {
+            if (existing) clearInterval(existing)
+            return null
+        })
         setHoldProgress(0)
         setIsShaking(true)
         setShowSuccess(false)
 
         const startTime = Date.now()
🧹 Nitpick comments (2)
next.config.js (2)

50-50: Verify the need for empty serverExternalPackages.

The empty array declaration is valid but has no effect. If no packages need to be externalized, this line could be removed to reduce configuration noise. If it's a placeholder for future use, consider adding a comment.

If this is a placeholder, add a clarifying comment:

-    // External packages that shouldn't be bundled (server-side only)
+    // External packages that shouldn't be bundled (server-side only)
+    // Currently empty - add packages here if needed
     serverExternalPackages: [],

Or remove it entirely if not needed:

-    // External packages that shouldn't be bundled (server-side only)
-    serverExternalPackages: [],
-

55-56: Remove '@squirrel-labs/peanut-sdk' from transpilePackages (next.config.js:55-56). This SDK ships a pre-compiled bundle (main: "dist/index.js") and doesn’t require Babel transpilation.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5b20c5b and d7291db.

📒 Files selected for processing (26)
  • next.config.js (2 hunks)
  • src/app/(mobile-ui)/dev/shake-test/page.tsx (4 hunks)
  • src/app/(mobile-ui)/points/page.tsx (5 hunks)
  • src/app/(mobile-ui)/qr-pay/page.tsx (4 hunks)
  • src/app/api/health/route.ts (1 hunks)
  • src/app/api/og/route.tsx (1 hunks)
  • src/app/request/[...username]/layout.tsx (1 hunks)
  • src/app/send/[...username]/layout.tsx (1 hunks)
  • src/app/send/[...username]/page.tsx (1 hunks)
  • src/components/Global/NavigationArrow/index.tsx (1 hunks)
  • src/components/Global/ShareButton/index.tsx (1 hunks)
  • src/components/Global/TokenSelector/Components/NetworkListItem.tsx (2 hunks)
  • src/components/Payment/PaymentInfoRow.tsx (3 hunks)
  • src/components/Profile/components/ProfileMenuItem.tsx (2 hunks)
  • src/components/Profile/index.tsx (1 hunks)
  • src/components/Setup/Setup.consts.tsx (2 hunks)
  • src/components/Setup/Setup.types.ts (2 hunks)
  • src/components/Setup/Views/JoinWaitlist.tsx (3 hunks)
  • src/components/Setup/Views/Landing.tsx (1 hunks)
  • src/components/Setup/Views/index.ts (1 hunks)
  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx (1 hunks)
  • src/config/wagmi.config.tsx (1 hunks)
  • src/hooks/useBanners.tsx (1 hunks)
  • src/lib/og/build-og-metadata.ts (1 hunks)
  • src/utils/general.utils.ts (1 hunks)
  • tsconfig.json (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-07-24T13:26:10.290Z
Learnt from: Hugo0
PR: peanutprotocol/peanut-ui#1014
File: src/components/Claim/Link/Initial.view.tsx:413-413
Timestamp: 2025-07-24T13:26:10.290Z
Learning: In the peanut-ui repository, the change from `${SQUID_API_URL}/route` to `${SQUID_API_URL}/v2/route` in src/components/Claim/Link/Initial.view.tsx was a typo fix, not an API migration, as the codebase was already using Squid API v2.

Applied to files:

  • src/app/api/og/route.tsx
📚 Learning: 2025-10-08T17:13:13.155Z
Learnt from: Zishan-7
PR: peanutprotocol/peanut-ui#1299
File: src/app/(mobile-ui)/points/page.tsx:41-51
Timestamp: 2025-10-08T17:13:13.155Z
Learning: In `src/app/(mobile-ui)/points/page.tsx`, the icon name "invite-heart" is intentionally used (not "inviter-heart") when displaying who invited the current user, as this is a deliberate design choice despite semantic differences with UserHeader usage.

Applied to files:

  • src/app/(mobile-ui)/points/page.tsx
🧬 Code graph analysis (8)
src/components/Profile/components/ProfileMenuItem.tsx (1)
src/components/Global/Icons/Icon.tsx (1)
  • Icon (206-215)
src/app/send/[...username]/layout.tsx (2)
src/app/request/[...username]/layout.tsx (1)
  • generateMetadata (5-34)
src/app/send/[...username]/page.tsx (1)
  • generateMetadata (24-51)
src/components/Global/NavigationArrow/index.tsx (1)
src/components/Global/Icons/Icon.tsx (1)
  • Icon (206-215)
src/app/request/[...username]/layout.tsx (2)
src/app/send/[...username]/layout.tsx (1)
  • generateMetadata (5-34)
src/app/metadata.ts (1)
  • generateMetadata (4-39)
src/components/Setup/Views/JoinWaitlist.tsx (2)
src/components/0_Bruddle/Button.tsx (1)
  • Button (76-267)
src/redux/slices/setup-slice.ts (1)
  • setupActions (65-65)
src/components/Setup/Views/Landing.tsx (5)
src/hooks/useSetupFlow.ts (1)
  • useSetupFlow (6-68)
src/hooks/useLogin.tsx (1)
  • useLogin (23-52)
src/context/authContext.tsx (1)
  • useAuth (191-197)
src/components/0_Bruddle/Toast.tsx (1)
  • useToast (111-117)
src/utils/general.utils.ts (2)
  • getFromLocalStorage (112-134)
  • sanitizeRedirectURL (1217-1238)
src/app/(mobile-ui)/points/page.tsx (1)
src/components/Global/Icons/Icon.tsx (1)
  • Icon (206-215)
src/app/send/[...username]/page.tsx (3)
src/app/request/[...username]/layout.tsx (1)
  • generateMetadata (5-34)
src/app/send/[...username]/layout.tsx (1)
  • generateMetadata (5-34)
src/app/[...recipient]/page.tsx (1)
  • generateMetadata (15-162)
⏰ 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 (29)
src/utils/general.utils.ts (1)

1073-1073: LGTM! Branding update is consistent.

The change from 'Peanut Protocol' to 'Peanut' aligns with the branding updates across the codebase.

src/components/Global/ShareButton/index.tsx (1)

32-32: LGTM! Branding update is consistent.

The default title change from 'Peanut Protocol' to 'Peanut' aligns with the broader branding updates in this PR.

src/config/wagmi.config.tsx (1)

33-34: LGTM! Metadata updates are consistent.

The metadata changes reflect the new branding ('Peanut' instead of 'Peanut Protocol') and updated product description. These will be displayed in wallet connection interfaces.

src/components/Setup/Setup.types.ts (1)

2-2: LGTM! Type additions follow existing patterns.

The new 'landing' screen type is properly added to both ScreenId and ScreenProps, following the same pattern as other screens with no required props.

Also applies to: 20-20

src/app/api/health/route.ts (1)

41-41: LGTM! Alert message branding updated.

The Discord notification header has been updated to reflect the new 'Peanut' branding, consistent with changes throughout the codebase.

src/hooks/useBanners.tsx (1)

55-55: LGTM! Banner description expanded appropriately.

The updated description now mentions Banks and other payment methods alongside Mercado Pago, providing users with a more comprehensive understanding of the verification benefits.

src/components/Setup/Views/JoinWaitlist.tsx (2)

70-70: LGTM! Placeholder text is clearer.

The new placeholder "Enter invite code" is more direct and actionable than "Do you have an invite code?".


87-119: LGTM! Flow separation improves UX.

The refactored UI clearly separates two flows:

  1. Invite code path: Input + Next button (lines 87-97) validates and dispatches the code
  2. Waitlist path: Join waitlist button (lines 112-119) proceeds without an invite code

The "or" divider (lines 106-110) visually separates these options, making the choice clear to users.

src/components/Payment/PaymentInfoRow.tsx (1)

15-15: LGTM! Clean implementation of clickable row behavior.

The changes properly add onClick support with appropriate visual feedback:

  • Pointer cursor indicates interactivity
  • Hover and active states provide visual feedback
  • Conditional styling only applies when onClick is provided
  • No breaking changes for existing usage

Also applies to: 26-27, 36-38

src/app/request/[...username]/layout.tsx (1)

5-7: LGTM! Next.js 15 async params migration implemented correctly.

The signature change to accept Promise<{ username: string[] }> and the await of params before destructuring aligns with Next.js 15 requirements. The fallback logic and metadata generation remain unchanged, ensuring backward compatibility.

src/app/api/og/route.tsx (1)

105-111: LGTM! Branding update applied consistently.

The text change from "Peanut Protocol" to "Peanut" aligns with the branding updates mentioned in the PR objectives and is consistent with similar changes across the codebase.

src/components/Setup/Views/index.ts (1)

5-5: LGTM! Export added for the new LandingStep component.

The export follows the established pattern and enables the new setup screen mentioned in the PR objectives.

src/lib/og/build-og-metadata.ts (1)

33-34: LGTM! Branding update in metadata description.

The change from "Peanut Protocol" to "Peanut" in the description maintains consistency with the global branding updates across the application.

src/components/Global/TokenSelector/Components/NetworkListItem.tsx (1)

7-7: LGTM! Good refactor using the new NavigationArrow component.

Replacing the inline icon with the dedicated NavigationArrow component improves consistency across the UI. This change aligns with the introduction of the reusable navigation arrow pattern.

Also applies to: 84-84

src/components/Global/NavigationArrow/index.tsx (1)

1-17: LGTM! Well-designed component for UI consistency.

The NavigationArrow component provides a clean abstraction for the right-pointing chevron pattern used throughout the app. The implementation is straightforward:

  • Properly typed props with sensible defaults
  • Uses twMerge to allow className customization
  • Well-documented with JSDoc comment

This improves maintainability by centralizing this UI pattern.

src/components/TransactionDetails/TransactionDetailsReceipt.tsx (1)

856-867: PaymentInfoRow onClick support verified
PaymentInfoRowProps defines an optional onClick handler and the component applies it with the appropriate styles, so the Points row navigation will work as intended.

src/components/Profile/components/ProfileMenuItem.tsx (1)

49-58: Incorrect rotation assumption: custom endIcon props were never rotated; only the default arrow was. No action required.

Likely an incorrect or invalid review comment.

src/app/(mobile-ui)/points/page.tsx (7)

8-8: LGTM!

The NavigationArrow import is correctly added and used appropriately on line 182.


84-90: LGTM!

The enhanced visual hierarchy with larger padding, prominent star icon, and bolder text effectively emphasizes the total points metric, aligning well with gamification UX patterns.


100-116: Verify the non-linear progress calculation is intentional.

The progress bar uses a non-linear calculation with a 0.6 exponent: Math.pow(ratio, 0.6). This creates an easing effect where the bar fills faster initially (e.g., 50% actual progress displays as ~57% visual progress).

While this is a common gamification pattern to make early progress feel more rewarding, it adds complexity. Please confirm this non-linear progression is intentional rather than a simpler linear calculation.


130-140: LGTM!

The centered tier status with conditional messaging provides clear feedback to users. The logic is consistent with the progress bar behavior, and the singular/plural handling is correct.


153-159: LGTM!

The flex layout with flex-shrink-0 on the icon ensures proper sizing and prevents the icon from shrinking. The smaller icon size is appropriate for an informational context.


182-182: LGTM!

The NavigationArrow component usage is appropriate here, providing consistent navigation affordance. The text-black className ensures proper color contrast.


165-165: The iconSize prop is correctly typed and the usage is valid.

The CopyToClipboard component defines iconSize as an optional prop with a strict union type: '2' | '4' | '6' | '8'. The value "4" passed on line 165 of src/app/(mobile-ui)/points/page.tsx is one of the allowed literal values, and the prop is properly documented in the component's interface.

tsconfig.json (2)

12-12: LGTM: Modern module resolution for bundlers.

Switching to "bundler" is appropriate for Next.js projects and aligns with the Turbopack configuration added in next.config.js. This resolution strategy is optimized for bundlers like webpack and Turbopack.


17-17: LGTM: Incremental build tracking in Next.js output directory.

Placing the TypeScript build info file in .next/ follows Next.js conventions and ensures it's cleaned up with other build artifacts.

next.config.js (3)

41-47: LGTM: Turbopack alias aligns with TypeScript paths.

The @ alias configuration matches the paths in tsconfig.json (line 24), ensuring consistency between TypeScript resolution and Turbopack's module resolution.


52-53: LGTM: Source maps handled by Sentry.

Disabling production browser source maps while Sentry handles source map uploads (lines 159, 173, 184) is the correct pattern for security and performance. Source maps are uploaded to Sentry for error debugging without exposing them to end users.


59-64: LGTM: Appropriate optimization features.

The experimental features are well-suited for this project:

  • optimizePackageImports targets large UI libraries that benefit from tree-shaking
  • webpackBuildWorker speeds up builds when not using Turbopack (as noted in the comment)

These optimizations should improve build performance without breaking existing functionality.

Comment on lines +3 to +4
// Only enable in production builds when explicitly requested
enabled: process.env.ANALYZE === 'true' && process.env.NODE_ENV !== 'development',
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Minor: Comment doesn't match condition.

The comment states "Only enable in production builds" but the condition NODE_ENV !== 'development' would also enable the analyzer in test or staging environments (not just production). If the intent is production-only, use NODE_ENV === 'production'. Otherwise, update the comment to reflect the actual behavior (e.g., "Only enable in non-development builds").

Apply this diff if production-only is the intent:

-    // Only enable in production builds when explicitly requested
-    enabled: process.env.ANALYZE === 'true' && process.env.NODE_ENV !== 'development',
+    // Only enable in production builds when explicitly requested
+    enabled: process.env.ANALYZE === 'true' && process.env.NODE_ENV === 'production',

Or update the comment if the current behavior is intentional:

-    // Only enable in production builds when explicitly requested
+    // Only enable in non-development builds when explicitly requested
     enabled: process.env.ANALYZE === 'true' && process.env.NODE_ENV !== 'development',
📝 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
// Only enable in production builds when explicitly requested
enabled: process.env.ANALYZE === 'true' && process.env.NODE_ENV !== 'development',
// Only enable in production builds when explicitly requested
enabled: process.env.ANALYZE === 'true' && process.env.NODE_ENV === 'production',
Suggested change
// Only enable in production builds when explicitly requested
enabled: process.env.ANALYZE === 'true' && process.env.NODE_ENV !== 'development',
// Only enable in non-development builds when explicitly requested
enabled: process.env.ANALYZE === 'true' && process.env.NODE_ENV !== 'development',
🤖 Prompt for AI Agents
In next.config.js around lines 3 to 4 the comment "Only enable in production
builds" is misleading because the condition uses NODE_ENV !== 'development'
which also enables the analyzer in test/staging; either change the condition to
NODE_ENV === 'production' to enforce production-only, or update the comment to
"Only enable in non-development builds" to reflect current behavior—pick one and
make the corresponding change so comment and condition match.

},
"types": ["@serwist/next/typings", "jest"]
"types": ["@serwist/next/typings", "jest"],
"verbatimModuleSyntax": true
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

LGTM: Stricter type-only import enforcement.

Enabling verbatimModuleSyntax requires type-only imports to use import type syntax, which improves tree-shaking and prevents runtime import side effects from type-only modules. Ensure the codebase consistently uses import type for type-only imports.

Run the following to check if there are type-only imports that need updating:


🏁 Script executed:

#!/bin/bash
# Description: Find imports that might need to be converted to type-only imports.
# Look for common type-only import patterns that aren't using 'import type'.

# Search for imports of types that should probably use 'import type'
rg -n --type=ts --type=tsx -C2 "^import \{[^}]*\} from ['\"]react['\"]" | rg -v "import type"

# Search for imports from type definition files
rg -n --type=ts --type=tsx "^import.*from ['\"].*\.d\.ts['\"]" | rg -v "import type"

Length of output: 55


I'll run corrected shell scripts to verify the import patterns in the codebase.


🏁 Script executed:

#!/bin/bash
# Search for imports that might be type-only but aren't using 'import type'
# Use broader file matching without specifying tsx type

# Search for React imports without 'import type'
echo "=== React imports (checking for type-only patterns) ==="
rg -n "^import.*from ['\"]react['\"]" --type=ts | head -20

# Search for imports from @types packages or .d.ts files
echo "=== Type definition imports ==="
rg -n "^import.*from ['\"]@types/|^import.*from ['\"].*\.d\.ts" --type=ts | head -20

# Search for any import type statements to see what's already compliant
echo "=== Already using 'import type' ==="
rg -n "^import type" --type=ts | head -20

# Search for TypeScript/React type imports that might need the 'import type' keyword
echo "=== Potential type-only imports (React types, interfaces, etc.) ==="
rg -n "^import \{.*(?:FC|ReactNode|ReactElement|PropsWithChildren|CSSProperties|Ref)" --type=ts -o | head -20

Length of output: 5371


Enforce import type for type-only React imports. Update any import statements that only pull types (e.g. FC, ReactNode, ReactElement, Ref) to use

import type { FC, ReactNode, ReactElement, Ref } from 'react'
🤖 Prompt for AI Agents
In tsconfig.json around line 28, verbatimModuleSyntax is enabled but the
codebase still uses value imports for type-only React symbols; update all React
imports that only import types (e.g., FC, ReactNode, ReactElement, Ref) to use
the TypeScript type-only import form. Find every import from 'react' that only
brings types and change them to "import type { ... } from 'react'", leaving
runtime imports (useState, useEffect, default React) unchanged, and run
TypeScript/ESLint to ensure no remaining non-type imports remain.

@notion-workspace
Copy link

Points Fixes

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 (3)
src/utils/__mocks__/justaname.ts (1)

6-22: Consider adding TypeScript return types for better maintainability.

The mock implementations are correct and follow Jest best practices. However, adding explicit return types would improve IDE support and catch potential mismatches between mocks and real implementations.

Example enhancement:

interface UsePrimaryNameReturn {
    primaryName: string | undefined
    isLoading: boolean
    error: Error | null
}

export const usePrimaryName = jest.fn((): UsePrimaryNameReturn => ({
    primaryName: undefined,
    isLoading: false,
    error: null,
}))

Apply similar patterns to useRecords and useAddresses.

src/utils/__mocks__/web-push.ts (1)

6-19: Consider adding TypeScript types for consistency.

The mock implementations correctly mimic the web-push API:

  • sendNotification properly returns a resolved Promise
  • generateVAPIDKeys returns mock keys with the expected structure
  • Default export matches the module's API surface

For better type safety, consider adding explicit types:

export const setVapidDetails = jest.fn((subject: string, publicKey: string, privateKey: string): void => {})
export const sendNotification = jest.fn((subscription: any, payload?: string | Buffer): Promise<void> => 
    Promise.resolve()
)
src/utils/__mocks__/reown-appkit.ts (1)

6-43: LGTM! Comprehensive mock implementation.

The mock correctly implements all major hooks from @reown/appkit/react:

  • Properly nests jest.fn() for callback functions (e.g., open, close, switchNetwork)
  • Uses appropriate default values (status: 'disconnected', isConnected: false)
  • Covers the full API surface needed for testing

For improved maintainability, consider adding explicit return types:

interface UseAppKitReturn {
    open: () => void
    close: () => void
}

export const useAppKit = jest.fn((): UseAppKitReturn => ({
    open: jest.fn(),
    close: jest.fn(),
}))

Apply similar patterns to other hooks for better type safety.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d7291db and a5951ca.

📒 Files selected for processing (5)
  • jest.setup.ts (1 hunks)
  • package.json (1 hunks)
  • src/utils/__mocks__/justaname.ts (1 hunks)
  • src/utils/__mocks__/reown-appkit.ts (1 hunks)
  • src/utils/__mocks__/web-push.ts (1 hunks)
⏰ 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 (3)
jest.setup.ts (1)

10-15: LGTM!

The default environment variable setup follows best practices:

  • Uses the safe fallback pattern process.env.VAR || 'default' to preserve existing values
  • Provides sensible test-only defaults for all required variables
  • Properly segregates public and private variables
package.json (2)

140-140: LGTM!

The transformIgnorePatterns correctly excludes the new ESM packages from being ignored during transformation:

  • Properly escapes @justaname\.id with a backslash
  • Uses negative lookahead (?!...) to allow transformation of listed packages
  • Maintains consistency with existing patterns

147-149: LGTM!

The new moduleNameMapper entries correctly wire up the mock modules:

  • Maps ESM packages to their Jest-compatible mocks
  • Follows the established pattern of other mock mappings
  • Properly escapes the regex special character in @justaname\.id

Copy link
Contributor

@jjramirezn jjramirezn left a comment

Choose a reason for hiding this comment

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

Lets gooo

Please fix tests before merging

Comment on lines 16 to 23
import {
CreateChargeRequest,
CreateRequestRequest as CreateRequestPayloadServices,
TCharge,
TRequestChargeResponse,
TRequestResponse,
type CreateChargeRequest,
type CreateRequestRequest as CreateRequestPayloadServices,
type TCharge,
type TRequestChargeResponse,
type TRequestResponse,
} from '@/services/services.types'
import { NATIVE_TOKEN_ADDRESS } from '@/utils/token.utils'
Copy link
Contributor

Choose a reason for hiding this comment

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

comment: this can be import type { blah, bleh } from 'blah'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice

@Hugo0 Hugo0 merged commit 385d29c into peanut-wallet-dev Oct 16, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants