Skip to content

Conversation

kushagrasarathe
Copy link
Contributor

@kushagrasarathe kushagrasarathe commented Apr 3, 2025

  • contributes to TASK-10310

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced dynamic production redirect management for a more streamlined navigation experience.
    • Updated illustrations with an animated graphic, enhancing visual interactivity.
  • Removed Content

    • Removed several legacy pages and sections, including outdated informational and feature areas.
    • Eliminated redundant team and welcome interfaces that previously appeared on the landing page.
    • Removed numerous icon and graphic exports, impacting asset availability.
  • Refactor & Chores

    • Optimized app configuration and dependency management for improved performance and maintainability.

Copy link

vercel bot commented Apr 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
peanut-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 4, 2025 10:57am

Copy link
Contributor

coderabbitai bot commented Apr 3, 2025

Walkthrough

The 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

Files Change Summary
index.ts; src/assets/{bg,chains,icons,illustrations,logos,**} (incl. lottie, mockups, peanut, people, redpacket) Removed/modified numerous asset export statements; several asset modules/files deleted; new GIF export (PeanutGuyGIF) added in illustrations.
src/app/{(mobile-ui)/kyc,legacy/_about,legacy/_blog,legacy/_dashboard,legacy/_sdk}/page.tsx Removed page components for KYC, About, Blog, Dashboard, and SDK.
src/components/{About, Global/Header(/components) , LandingPage/(BuildOnUs, cashoutSection, features, imageAssets, index, intro, mike, story), Welcome/(index, welcome, welcomeSDK)} Removed or significantly altered multiple UI components and exports; modified export in Claim/useClaimLink.tsx from named to default.
next.config.js; package.json; redirects.json; src/config/theme.config.tsx Updated configuration files with conditional settings (e.g., redirects via external JSON, reactStrictMode based on environment), bundle analyzer integration, dependency removals/additions, size-limit config, Sentry sourcemaps, and ThemeProvider export removal.

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)
Loading

Possibly related PRs

  • Pinta release #748: The changes in the main PR involve the removal of numerous export statements for various SVG and PNG assets, which are related to the modifications in this PR regarding new constants and functionalities related to the Pinta wallet.
  • release: Club lp #481: This PR directly relates to the removal of export statements for various SVG and PNG assets in index.ts, modifying the same file and dealing with graphic asset management.
  • [TASK-6407] Merging club_lp into develop, "fixed" lots of conflicts #475: The changes in this PR involve modifications to exported assets, specifically the removal and addition of graphic assets in the codebase, which aligns with the current PR's focus.

Poem

I'm a rabbit, hopping free,
Skipping through code with glee.
Assets gone, pages out the door,
Configs refined—less is more!
I nibble bugs and clear the clutter,
In clean code fields, I happily flutter.
🥕🐇

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

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

CodeRabbit Configuration File (.coderabbit.yaml)

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

Documentation and Community

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

@kushagrasarathe kushagrasarathe changed the title remove unused code [WIP] : remove unused code Apr 3, 2025
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: 1

🔭 Outside diff range comments (1)
src/components/Claim/useClaimLink.tsx (1)

96-118: ⚠️ Potential issue

Missing 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 reactStrictMode

The 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 completely

There'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 consistency

There are two commented-out CloudAnimation instances in the CloudImages 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

📥 Commits

Reviewing files that changed from the base of the PR and between dc46ef1 and 9530473.

⛔ 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 tsx

Length 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 removal

The import statement has been reordered to list ColorModeProvider before ColorModeScript. More importantly, the default export for ThemeProvider 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 file

This 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 tools

Good addition of development tools for monitoring and optimizing bundle sizes:

  • @next/bundle-analyzer: Helps visualize the composition of JS bundles
  • size-limit and @size-limit/preset-app: Enforce size limits on bundles

These 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 configuration

The 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 integration

Good addition of the bundle analyzer tool, which works with the ANALYZE=true environment flag. This integrates with the analyze script in your package.json to provide visualization of your bundle sizes.


6-6: External redirects configuration

Good 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 environment

Good 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 cleanup

Good 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 integration

Good 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 wrapper

This 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 assets

The imports have been correctly reduced to only include the Cloud and Star 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 removed PeanutGuy 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 removed PeanutGuy 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 tsx

Length 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 with PeanutGuyGIF, we need to be absolutely sure that PeanutGuyGIF 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 tsx

Once 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 the PEANUT_LOGO export, aligns with the PR objective and improves code consistency. However, the initial verification script encountered an error with the tsx 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 includes ARBITRUM_ICON and MANTLE_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 only ARBITRUM_ICON and MANTLE_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 removed BG_SVG exist outside of src/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 formatted BG_WALLET_CARD_SVG export in src/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'
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

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.

Suggested change
'useClient'
'use client'

@kushagrasarathe kushagrasarathe changed the title [WIP] : remove unused code fix : remove unused code Apr 3, 2025
Copy link

remove unused code

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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9530473 and 43cf065.

📒 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 the ANALYZE 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.

Comment on lines +161 to 169
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)
}
}
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 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

@jjramirezn jjramirezn merged commit fe1dbcf into peanut-wallet-dev Apr 4, 2025
5 checks passed
@jjramirezn jjramirezn deleted the fix/devX branch April 4, 2025 13:22
@coderabbitai coderabbitai bot mentioned this pull request Apr 7, 2025
This was referenced Jul 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants