-
Notifications
You must be signed in to change notification settings - Fork 13
fix : remove unused code #789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe pull request removes numerous asset exports, pages, and UI components, while updating configuration files. Many SVG/PNG and Lottie assets, as well as legacy pages such as KYC, About, Blog, Dashboard, and SDK, are deleted. Additionally, several landing page and welcome components have been removed. In configuration files, Next.js settings are updated with conditional redirects (sourced from an external JSON file), bundle analyzer integration, and dependency changes. Minor export adjustments and reordering of imports are also applied to some components, streamlining the codebase. Changes
Sequence Diagram(s)sequenceDiagram
participant NC as next.config.js
participant Env as Environment
participant R as redirects.json
participant SA as Sentry & Analyzer
NC->>Env: Check if Development or Production
alt Development Mode
NC->>NC: Set reactStrictMode to true
NC->>NC: Return empty redirects array
else Production Mode
NC->>R: Load redirect rules from JSON
NC->>NC: Set reactStrictMode to false
end
NC->>SA: Configure sourcemaps deletion
NC->>SA: Wrap configuration with bundle analyzer (if ANALYZE enabled)
Possibly related PRs
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
src/components/Claim/useClaimLink.tsx (1)
96-118
:⚠️ Potential issueMissing return value for error case in getAttachmentInfo.
When an error occurs, the function doesn't return any value. This could lead to undefined behavior in calling code.
} catch (error) { console.error('Failed to get attachment:', error) Sentry.captureException(error) + return { fileUrl: '', message: '' } }
🧹 Nitpick comments (5)
src/components/Claim/useClaimLink.tsx (2)
21-42
: Consider improving error handling in claimLink function.The error is logged but rethrown without any additional context that would help identify the issue. Consider wrapping the error with additional context information before rethrowing.
} catch (error) { console.error('Error claiming link:', error) - - throw error + + throw new Error(`Failed to claim link: ${error instanceof Error ? error.message : String(error)}`, { cause: error }) } finally {
44-77
: Similar error handling improvement needed in claimLinkXchain function.The same error handling improvement recommended for claimLink should be applied here for consistency.
} catch (error) { console.error('Error claiming link:', error) - throw error + throw new Error(`Failed to claim cross-chain link: ${error instanceof Error ? error.message : String(error)}`, { cause: error }) } finally {next.config.js (1)
45-45
: Simplify conditional reactStrictModeThe ternary expression can be simplified for better readability.
- reactStrictMode: process.env.NODE_ENV !== 'development' ? false : true, + reactStrictMode: process.env.NODE_ENV === 'development',🧰 Tools
🪛 Biome (1.9.4)
[error] 45-45: Unnecessary use of boolean literals in conditional expression.
Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with(lint/complexity/noUselessTernary)
src/components/LandingPage/imageAssets.tsx (2)
134-141
: Consider removing commented-out code completelyThere's commented-out code for the HandToken image that's no longer being used. Since the PR objective is to remove unused code, consider removing this commented-out section entirely rather than keeping it as a comment.
- {/* <motion.img - initial={{ rotate: 5, opacity: 0, translateY: 28, translateX: -5, transformOrigin: 'top left' }} - whileInView={{ rotate: 0, opacity: 1, translateY: 0, translateX: 0, transformOrigin: 'top left' }} - whileHover={{ rotate: 5, transformOrigin: 'top left' }} - transition={{ type: 'spring', damping: 10 }} - src={HandToken.src} - className="absolute left-[7%] top-[63%] hidden w-36 md:left-[1%] md:top-[70%] lg:left-[7%] lg:top-[63%] lg:block xl:left-[11%]" - /> */}
73-81
: Remove commented-out CloudAnimation instances for consistencyThere are two commented-out
CloudAnimation
instances in theCloudImages
component. For consistency with the PR's goal of removing unused code, these should also be removed.- {/* <CloudAnimation - side="right" - top="65%" - duration={14} - imageSrc={Cloud.src} - screenWidth={screenWidth} - startXOffset={300} - speed={60} - /> */} - {/* <CloudAnimation - side="left" - top="75%" - duration={20} - imageSrc={Cloud.src} - styleMod="z-[99]" - screenWidth={screenWidth} - startXOffset={50} - speed={45} - /> */}Also applies to: 103-112
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (99)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
src/assets/bg/bg.svg
is excluded by!**/*.svg
src/assets/chains/avalanche.svg
is excluded by!**/*.svg
src/assets/chains/base.svg
is excluded by!**/*.svg
src/assets/chains/bsc.svg
is excluded by!**/*.svg
src/assets/chains/gnosis.svg
is excluded by!**/*.svg
src/assets/chains/mainnet.svg
is excluded by!**/*.svg
src/assets/chains/manta-pacific.png
is excluded by!**/*.png
src/assets/chains/matic.svg
is excluded by!**/*.svg
src/assets/chains/milkomeda.svg
is excluded by!**/*.svg
src/assets/chains/optimism.svg
is excluded by!**/*.svg
src/assets/icons/checkbox.svg
is excluded by!**/*.svg
src/assets/icons/clipboard.svg
is excluded by!**/*.svg
src/assets/icons/eyes.png
is excluded by!**/*.png
src/assets/icons/fingerprint.png
is excluded by!**/*.png
src/assets/icons/gas.svg
is excluded by!**/*.svg
src/assets/icons/github-inverted.png
is excluded by!**/*.png
src/assets/icons/mail-icon.svg
is excluded by!**/*.svg
src/assets/icons/peanut-wallet.png
is excluded by!**/*.png
src/assets/icons/share.svg
is excluded by!**/*.svg
src/assets/icons/switch.svg
is excluded by!**/*.svg
src/assets/icons/telegram-icon.svg
is excluded by!**/*.svg
src/assets/icons/trapezoid.svg
is excluded by!**/*.svg
src/assets/icons/triangle.svg
is excluded by!**/*.svg
src/assets/icons/wallet.svg
is excluded by!**/*.svg
src/assets/icons/whatsapp-icon.svg
is excluded by!**/*.svg
src/assets/icons/x-icon.svg
is excluded by!**/*.svg
src/assets/illustrations/build_on_us_now.svg
is excluded by!**/*.svg
src/assets/illustrations/cashout_now.svg
is excluded by!**/*.svg
src/assets/illustrations/cloud_left.svg
is excluded by!**/*.svg
src/assets/illustrations/cloud_right.svg
is excluded by!**/*.svg
src/assets/illustrations/diagonal-lines.svg
is excluded by!**/*.svg
src/assets/illustrations/easy-tight.svg
is excluded by!**/*.svg
src/assets/illustrations/easy.svg
is excluded by!**/*.svg
src/assets/illustrations/good-idea.svg
is excluded by!**/*.svg
src/assets/illustrations/hand-bag.svg
is excluded by!**/*.svg
src/assets/illustrations/hand-peace.svg
is excluded by!**/*.svg
src/assets/illustrations/hand-rad.svg
is excluded by!**/*.svg
src/assets/illustrations/hand-snap.svg
is excluded by!**/*.svg
src/assets/illustrations/hand-thumbs-right.svg
is excluded by!**/*.svg
src/assets/illustrations/hand-thumbs.svg
is excluded by!**/*.svg
src/assets/illustrations/hey-dude.svg
is excluded by!**/*.svg
src/assets/illustrations/new.svg
is excluded by!**/*.svg
src/assets/illustrations/peace-fingers.svg
is excluded by!**/*.svg
src/assets/illustrations/smile-finder.svg
is excluded by!**/*.svg
src/assets/illustrations/smile-high.svg
is excluded by!**/*.svg
src/assets/illustrations/smile-pink.svg
is excluded by!**/*.svg
src/assets/illustrations/smile-side.svg
is excluded by!**/*.svg
src/assets/illustrations/smile-stars.svg
is excluded by!**/*.svg
src/assets/illustrations/star-blue.svg
is excluded by!**/*.svg
src/assets/illustrations/stop-sign.svg
is excluded by!**/*.svg
src/assets/illustrations/thumbs_up.svg
is excluded by!**/*.svg
src/assets/illustrations/vibes.svg
is excluded by!**/*.svg
src/assets/logos/integrators/beam-logo.jpeg
is excluded by!**/*.jpeg
src/assets/logos/integrators/blockscout-logo.svg
is excluded by!**/*.svg
src/assets/logos/integrators/brume-logo.png
is excluded by!**/*.png
src/assets/logos/integrators/clave-logo.jpeg
is excluded by!**/*.jpeg
src/assets/logos/integrators/eco-logo.png
is excluded by!**/*.png
src/assets/logos/integrators/kofime-logo.png
is excluded by!**/*.png
src/assets/logos/investors/hypersphere-logo-square.jpeg
is excluded by!**/*.jpeg
src/assets/logos/investors/hypersphere-logo.png
is excluded by!**/*.png
src/assets/logos/investors/longhash-logo-square.jpeg
is excluded by!**/*.jpeg
src/assets/logos/investors/longhash-logo.png
is excluded by!**/*.png
src/assets/logos/investors/nazare-logo-square.jpg
is excluded by!**/*.jpg
src/assets/logos/investors/nazare-logo.svg
is excluded by!**/*.svg
src/assets/logos/investors/zeeprime-logo-square.png
is excluded by!**/*.png
src/assets/logos/investors/zeeprime-logo.png
is excluded by!**/*.png
src/assets/logos/partners/0xsquid.jpg
is excluded by!**/*.jpg
src/assets/logos/partners/axelar.png
is excluded by!**/*.png
src/assets/logos/partners/bybit-logo.jpeg
is excluded by!**/*.jpeg
src/assets/logos/partners/cleo-logo.jpeg
is excluded by!**/*.jpeg
src/assets/logos/partners/izumi-logo.jpeg
is excluded by!**/*.jpeg
src/assets/logos/partners/ktx-logo.jpeg
is excluded by!**/*.jpeg
src/assets/logos/partners/lendle-logo.jpeg
is excluded by!**/*.jpeg
src/assets/logos/partners/logx-logo.jpeg
is excluded by!**/*.jpeg
src/assets/logos/partners/timeswap-logo.jpeg
is excluded by!**/*.jpeg
src/assets/logos/partners/wallet-connect-logo.png
is excluded by!**/*.png
src/assets/logos/partners/web3inbox-logo.svg
is excluded by!**/*.svg
src/assets/mockups/teal-wallet-1.png
is excluded by!**/*.png
src/assets/mockups/teal-wallet-2.png
is excluded by!**/*.png
src/assets/peanut/peanut-holding-mantle-logo.svg
is excluded by!**/*.svg
src/assets/peanut/peanutman-logo-dark.svg
is excluded by!**/*.svg
src/assets/peanut/peanutman-redpacket.svg
is excluded by!**/*.svg
src/assets/peanut/peanutman-thinking.svg
is excluded by!**/*.svg
src/assets/peanut/peanutman-wallets.svg
is excluded by!**/*.svg
src/assets/people/Steven.jpg
is excluded by!**/*.jpg
src/assets/people/derek.png
is excluded by!**/*.png
src/assets/people/hugo0-no-bg.png
is excluded by!**/*.png
src/assets/people/hugo0-with-bg.png
is excluded by!**/*.png
src/assets/people/kkonrad-no-bg.png
is excluded by!**/*.png
src/assets/people/kkonrad-with-bg.png
is excluded by!**/*.png
src/assets/people/kofime-icon.jpeg
is excluded by!**/*.jpeg
src/assets/people/konrad_cubism.jpg
is excluded by!**/*.jpg
src/assets/people/mydas.jpg
is excluded by!**/*.jpg
src/assets/people/orest.jpg
is excluded by!**/*.jpg
src/assets/people/sbf.jpeg
is excluded by!**/*.jpeg
src/assets/people/sharuk.png
is excluded by!**/*.png
src/assets/redpacket/red-packet-naked.svg
is excluded by!**/*.svg
src/assets/redpacket/red-packet.svg
is excluded by!**/*.svg
📒 Files selected for processing (41)
index.ts
(0 hunks)next.config.js
(4 hunks)package.json
(3 hunks)redirects.json
(1 hunks)src/app/(mobile-ui)/kyc/page.tsx
(0 hunks)src/app/legacy/_about/page.tsx
(0 hunks)src/app/legacy/_blog/page.tsx
(0 hunks)src/app/legacy/_dashboard/page.tsx
(0 hunks)src/app/legacy/_sdk/page.tsx
(0 hunks)src/assets/bg/index.ts
(1 hunks)src/assets/chains/index.ts
(1 hunks)src/assets/icons/index.ts
(1 hunks)src/assets/illustrations/index.ts
(1 hunks)src/assets/index.ts
(0 hunks)src/assets/logos/index.ts
(1 hunks)src/assets/logos/integrators/index.ts
(0 hunks)src/assets/logos/investors/index.ts
(0 hunks)src/assets/logos/partners/index.ts
(0 hunks)src/assets/lottie/hamburger-lottie.json
(0 hunks)src/assets/lottie/index.ts
(0 hunks)src/assets/mockups/index.ts
(0 hunks)src/assets/peanut/index.ts
(1 hunks)src/assets/people/index.ts
(0 hunks)src/assets/redpacket/index.ts
(0 hunks)src/components/About/index.tsx
(0 hunks)src/components/Claim/useClaimLink.tsx
(1 hunks)src/components/Global/Header/components/index.tsx
(0 hunks)src/components/Global/Header/index.tsx
(0 hunks)src/components/LandingPage/BuildOnUs/index.tsx
(0 hunks)src/components/LandingPage/cashoutSection.tsx
(0 hunks)src/components/LandingPage/features.tsx
(0 hunks)src/components/LandingPage/imageAssets.tsx
(1 hunks)src/components/LandingPage/index.ts
(0 hunks)src/components/LandingPage/intro.tsx
(0 hunks)src/components/LandingPage/mike.tsx
(0 hunks)src/components/LandingPage/story.tsx
(0 hunks)src/components/Welcome/index.ts
(0 hunks)src/components/Welcome/welcome.tsx
(0 hunks)src/components/Welcome/welcomeSDK.tsx
(0 hunks)src/components/index.ts
(0 hunks)src/config/theme.config.tsx
(1 hunks)
💤 Files with no reviewable changes (29)
- src/components/index.ts
- src/components/LandingPage/cashoutSection.tsx
- src/assets/index.ts
- src/assets/lottie/hamburger-lottie.json
- src/app/legacy/_blog/page.tsx
- src/components/Global/Header/components/index.tsx
- src/assets/redpacket/index.ts
- src/app/legacy/_dashboard/page.tsx
- src/assets/lottie/index.ts
- src/components/Welcome/index.ts
- src/app/(mobile-ui)/kyc/page.tsx
- src/assets/mockups/index.ts
- src/components/LandingPage/story.tsx
- src/components/LandingPage/index.ts
- src/app/legacy/_about/page.tsx
- src/components/LandingPage/features.tsx
- src/components/LandingPage/intro.tsx
- src/components/Welcome/welcomeSDK.tsx
- src/components/LandingPage/mike.tsx
- src/components/LandingPage/BuildOnUs/index.tsx
- src/app/legacy/_sdk/page.tsx
- src/assets/people/index.ts
- src/components/Welcome/welcome.tsx
- src/assets/logos/investors/index.ts
- src/components/Global/Header/index.tsx
- src/components/About/index.tsx
- src/assets/logos/integrators/index.ts
- src/assets/logos/partners/index.ts
- index.ts
🧰 Additional context used
🪛 Biome (1.9.4)
next.config.js
[error] 45-45: Unnecessary use of boolean literals in conditional expression.
Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with
(lint/complexity/noUselessTernary)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Deploy-Preview
🔇 Additional comments (18)
src/components/Claim/useClaimLink.tsx (1)
3-3
:❓ Verification inconclusive
Export type changed from named to default export.
This change from a named export to a default export will require updates to import statements in any files that consume this hook. Ensure all imports are updated across the codebase to avoid runtime errors.
Also applies to: 15-15, 128-128
🏁 Script executed:
#!/bin/bash # Search for files that might be importing the useClaimLink hook with named import syntax echo "Files potentially importing useClaimLink with named import:" rg "import \{.*useClaimLink.*\} from ['\"]@/components/Claim/useClaimLink['\"]" --type ts --type tsx # Search for files that might be importing from an index file that re-exports useClaimLink echo -e "\nFiles potentially importing useClaimLink through an index file:" rg "import \{.*useClaimLink.*\} from ['\"]@/components/Claim['\"]" --type ts --type tsxLength of output: 528
Below is an updated shell script to re-run the search commands using glob patterns for TypeScript files. This should correctly catch any files importing the hook with a named import. Please run these commands and manually verify that all imports of
useClaimLink
have been updated to use the default export:#!/bin/bash echo "Files potentially importing useClaimLink with named import:" rg "import \{.*useClaimLink.*\} from ['\"]@/components/Claim/useClaimLink['\"]" -g "*.ts" -g "*.tsx" echo -e "\nFiles potentially importing useClaimLink through an index file:" rg "import \{.*useClaimLink.*\} from ['\"]@/components/Claim['\"]" -g "*.ts" -g "*.tsx"Once you’ve confirmed that no files (or only the appropriate default-import usage remains) are importing
useClaimLink
via a named import, you can be confident that the export change won’t cause runtime errors.Next steps:
- Verify the output of the above commands.
- Update any lingering named imports as needed.
src/config/theme.config.tsx (1)
4-4
: Import reordering and default export removalThe import statement has been reordered to list
ColorModeProvider
beforeColorModeScript
. More importantly, the default export forThemeProvider
has been removed from this file, leaving only the named export. This change aligns with the PR objective of removing unused code.Any components that previously imported
ThemeProvider
as a default export will need to update their import statements to use the named export instead:- import ThemeProvider from '@/config/theme.config' + import { ThemeProvider } from '@/config/theme.config'redirects.json (1)
1-43
: LGTM: New redirects configuration fileThis newly added file centralizes all redirect rules in a clean JSON format, making them easier to maintain separately from the Next.js configuration. The structure is valid and follows proper JSON formatting with each redirect rule clearly defined.
It's worth noting that these redirects appear to be migrating users from older routes to either new internal routes or to a legacy site, which aligns with the PR objective of removing unused code/pages.
package.json (2)
82-82
: Added bundle analysis and size-limit toolsGood addition of development tools for monitoring and optimizing bundle sizes:
@next/bundle-analyzer
: Helps visualize the composition of JS bundlessize-limit
and@size-limit/preset-app
: Enforce size limits on bundlesThese additions complement the PR's objective of removing unused code by providing tools to monitor and maintain code size.
Also applies to: 84-84, 109-109
152-157
: New size-limit configurationThe size-limit configuration establishes a 500KB limit for JavaScript chunks, which is a good practice for maintaining performance. This will help prevent bundle bloat in the future.
This configuration works with the newly added size-limit dependencies and integrates well with your existing build process.
next.config.js (6)
2-4
: Bundle analyzer integrationGood addition of the bundle analyzer tool, which works with the
ANALYZE=true
environment flag. This integrates with theanalyze
script in your package.json to provide visualization of your bundle sizes.
6-6
: External redirects configurationGood move to externalize the redirects configuration into a separate JSON file. This makes the redirects easier to manage and update without modifying the Next.js configuration code.
65-65
: Conditional redirects based on environmentGood implementation to skip redirects in development mode while using the externalized redirects configuration in production. This improves the developer experience by not redirecting local development URLs.
153-155
: Sentry sourcemaps cleanupGood addition of the
deleteSourcemapsAfterUpload
option to clean up sourcemaps after they've been uploaded to Sentry. This helps reduce build artifacts and storage requirements.
161-169
: Conditional Serwist service worker integrationGood implementation to conditionally apply Serwist (service worker) configuration only in non-development environments. This simplifies the development environment while ensuring production builds have proper service worker support.
171-171
: Bundle analyzer wrapperThis line appropriately wraps the Next.js configuration with the bundle analyzer, enabling bundle analysis when the ANALYZE environment variable is set to 'true'.
Note that this line will always apply the bundle analyzer wrapper, regardless of environment. Since it's configured to be enabled only when the ANALYZE flag is set, this is fine, but you might want to make it conditional in the future if needed.
src/assets/peanut/index.ts (1)
1-12
: LGTM: Successfully removed unused Peanutman assets.The file now retains only the Peanutman assets that are actively used in the application, removing PEANUTMAN_MANTLE, PEANUTMAN_LOGO_BLACK, PEANUTMAN_REDPACKET, PEANUTMAN_THINKING, and PEANUTMAN_WALLET. This change aligns well with the PR objective of removing unused code.
src/assets/icons/index.ts (1)
1-11
: Cleanup of unused icon exports looks good!The removal of unused icon exports aligns well with the PR objective of removing unused code. This helps reduce bundle size and improves maintainability by keeping only the necessary icons in the codebase.
src/components/LandingPage/imageAssets.tsx (1)
2-2
: Import statement simplified to include only used assetsThe imports have been correctly reduced to only include the
Cloud
andStar
assets that are actually used in the remaining components, removing all unused imports.src/assets/illustrations/index.ts (1)
1-14
:❓ Verification inconclusive
Cleanup of illustration assets with PeanutGuyGIF replacement
The removal of 30 unused SVG exports aligns with the PR objective of removing unused code, which helps reduce bundle size and improves maintainability. The addition of
PeanutGuyGIF
appears to be a replacement for the removedPeanutGuy
export, which is acceptable if this asset is still needed in the application.Could you confirm that
PeanutGuyGIF
is indeed a necessary replacement for the removedPeanutGuy
export and that it's used somewhere in the codebase?
🏁 Script executed:
#!/bin/bash # Search for PeanutGuyGIF usage in the codebase echo "Searching for PeanutGuyGIF usage..." rg -i "PeanutGuyGIF" --type ts --type tsxLength of output: 150
Verify "PeanutGuyGIF" Usage in the Codebase
The cleanup of illustration exports (removing unused SVGs) is in line with our goal to reduce bundle size and improve maintainability. However, before we fully accept the replacement of
PeanutGuy
withPeanutGuyGIF
, we need to be absolutely sure thatPeanutGuyGIF
is in active use somewhere in the codebase.The initial search encountered an error with the TSX file type. Please run the following updated script to verify its usage in both
.ts
and.tsx
files:#!/bin/bash echo "Searching for PeanutGuyGIF usage in .ts files..." rg -i "PeanutGuyGIF" --type ts echo "Searching for PeanutGuyGIF usage in .tsx files..." rg -i "PeanutGuyGIF" --type-add 'tsx:*.tsx' --type tsxOnce you confirm that
PeanutGuyGIF
is indeed referenced, this replacement is valid. Otherwise, consider whether the asset is needed or if further cleanup is required.src/assets/logos/index.ts (1)
1-3
:❓ Verification inconclusive
Code cleanup looks good
The removal of the exports from './integrators', './investors', and './partners' aligns with the PR objective to remove unused code. The semicolon addition to the PEANUT_LOGO export improves code consistency.
🏁 Script executed:
#!/bin/bash # Verify that the removed exports aren't referenced elsewhere in the codebase echo "Checking for references to removed logo exports..." rg -i "integrators|investors|partners" --type ts --type tsx src/ | grep -v "src/assets/logos/index.ts"Length of output: 241
Manual Verification Requested: Verify Removed Exports
The removal of unused exports from
./integrators
,./investors
, and./partners
, along with the semicolon addition for thePEANUT_LOGO
export, aligns with the PR objective and improves code consistency. However, the initial verification script encountered an error with thetsx
file type. Please run the updated verification command below to ensure that no references to the removed exports exist:#!/bin/bash # Improved verification script to account for TSX files rg --type-add "tsx:*.tsx" -i "integrators|investors|partners" src/ | grep -v "src/assets/logos/index.ts"After running this updated script, kindly confirm manually that there are indeed no lingering references.
src/assets/chains/index.ts (1)
1-4
:✅ Verification successful
LGTM, unused chain icons removed
The simplified export list now only includes ARBITRUM_ICON and MANTLE_ICON, with all other chain icons properly removed. This aligns with the PR objective to clean up unused code.
🏁 Script executed:
#!/bin/bash # Verify that the removed chain icons aren't referenced elsewhere in the codebase echo "Checking for references to removed chain icons..." rg -i "BINANCE_ICON|MAINNET_ICON|POLYGON_ICON|GNOSIS_ICON|AVALANCHE_ICON|BASE_ICON|MILKOMEDA_ICON|OPTIMISM_ICON|MANTA_ICON" --type ts --type tsx src/ | grep -v "src/assets/chains/index.ts"Length of output: 325
LGTM, unused chain icons removed
The export list now only includesARBITRUM_ICON
andMANTLE_ICON
, with all other chain icons removed. An updated shell script (shown above) has been provided to search for any lingering references to the removed icons using explicit glob patterns for both.ts
and.tsx
files. Please re-run this updated verification script and manually verify that no references to the removed chain icons exist before finalizing the changes.
🏁 Script executed:
#!/bin/bash echo "Re-checking for references to removed chain icons with corrected file type flags..." rg -i "BINANCE_ICON|MAINNET_ICON|POLYGON_ICON|GNOSIS_ICON|AVALANCHE_ICON|BASE_ICON|MILKOMEDA_ICON|OPTIMISM_ICON|MANTA_ICON" -g "*.ts" -g "*.tsx" src/ | grep -v "src/assets/chains/index.ts"Length of output: 487
Final Approval: Chain Icon Cleanup Verified
The re-run script with explicit glob patterns produced no output, confirming that there are no lingering references to the removed icons. With onlyARBITRUM_ICON
andMANTLE_ICON
exported in src/assets/chains/index.ts, the cleanup aligns with the PR objective.src/assets/bg/index.ts (1)
1-3
:❓ Verification inconclusive
Clean removal of unused background asset
The removal of the BG_SVG export while keeping the BG_WALLET_CARD_SVG export with proper semicolon formatting is appropriate. This change aligns with the PR objective of removing unused code.
🏁 Script executed:
#!/bin/bash # Verify that the removed BG_SVG isn't referenced elsewhere in the codebase echo "Checking for references to removed background SVG..." rg -i "BG_SVG" --type ts --type tsx src/ | grep -v "src/assets/bg/index.ts"Length of output: 216
Below is an updated verification script and review comment that addresses the earlier error with the TSX file type. The new script uses a glob pattern for TSX files instead of the unrecognized
--type tsx
flag. Please run the updated script to manually verify that no references to the removedBG_SVG
exist outside ofsrc/assets/bg/index.ts
.
Revised Verification Script
#!/bin/bash echo "Checking for references to removed background SVG in TS files..." rg -i "BG_SVG" --type ts src/ | grep -v "src/assets/bg/index.ts" echo "Checking for references to removed background SVG in TSX files..." rg -i "BG_SVG" --glob "*.tsx" src/ | grep -v "src/assets/bg/index.ts"
Rewritten Review Comment
Action Required: Verify Unused BG_SVG Removal
The removal of the
BG_SVG
export is appropriate and aligns with the PR objective of cleaning up unused code while preserving the correctly formattedBG_WALLET_CARD_SVG
export insrc/assets/bg/index.ts
.To ensure that the removed asset is not referenced elsewhere in the codebase, please run the updated verification script (shown above). The new command handles TSX files correctly by using a glob pattern. Manual confirmation of the results is required.
@@ -1,18 +1,18 @@ | |||
'useClient' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in client directive.
The directive should be 'use client'
with a space instead of 'useClient'
.
-'useClient'
+'use client'
📝 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.
'useClient' | |
'use client' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
next.config.js
(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Deploy-Preview
🔇 Additional comments (4)
next.config.js (4)
2-4
: Bundle analyzer integration looks good.Adding
@next/bundle-analyzer
is a good practice for monitoring bundle sizes, and I like that it's conditionally enabled based on theANALYZE
environment variable.
6-6
: Good separation of configuration with external redirects file.Moving redirects to a separate JSON file improves maintainability by separating configuration from code.
65-65
: Clean implementation of environment-specific redirects.The ternary operator provides a clean way to have different redirect behaviors between environments.
153-155
: Good security practice for Sentry sourcemaps.Deleting sourcemaps after upload prevents exposing source code in production environments.
if (process.env.NODE_ENV !== 'development') { | ||
module.exports = async () => { | ||
const withSerwist = (await import('@serwist/next')).default({ | ||
swSrc: './src/app/sw.ts', | ||
swDest: 'public/sw.js', | ||
}) | ||
return withSerwist(nextConfig) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical issue: Multiple module.exports statements will cause conflicts.
There are multiple module.exports
statements in the file (lines 158, 161-169, and 171). Only the last export (line 171) will be effective, potentially bypassing the service worker configuration in non-development environments.
Consider refactoring the exports to ensure all configurations are properly applied:
if (process.env.NODE_ENV !== 'development') {
- module.exports = async () => {
+ const withSerwist = async () => {
const withSerwistModule = (await import('@serwist/next')).default({
swSrc: './src/app/sw.ts',
swDest: 'public/sw.js',
})
return withSerwistModule(nextConfig)
}
+ nextConfig = withSerwist
}
-module.exports = withBundleAnalyzer(nextConfig)
+// Apply all wrappers in the correct order
+let wrappedConfig = nextConfig;
+if (process.env.NODE_ENV !== 'development') {
+ wrappedConfig = withSerwist(wrappedConfig);
+}
+wrappedConfig = withBundleAnalyzer(wrappedConfig);
+module.exports = wrappedConfig;
Alternatively, you could use a composition pattern to ensure all wrappers are applied:
// At the end of the file
const wrappers = [withBundleAnalyzer];
if (process.env.NODE_ENV !== 'development') {
wrappers.push(async (config) => {
const withSerwist = (await import('@serwist/next')).default({
swSrc: './src/app/sw.ts',
swDest: 'public/sw.js',
});
return withSerwist(config);
});
}
// Apply all wrappers in sequence
let finalConfig = nextConfig;
for (const wrapper of wrappers) {
finalConfig = wrapper(finalConfig);
}
module.exports = finalConfig;
Also applies to: 171-171
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Removed Content
Refactor & Chores