Skip to content

Conversation

@rodrigopavezi
Copy link
Member

@rodrigopavezi rodrigopavezi commented Aug 21, 2024

Resolves #4

Add:

  • Header with links
  • Main landing page with search, stats and recent sections
  • Footer

Update:

  • None

Note: setup it with nextjs app router and shadcn

Summary by CodeRabbit

  • New Features

    • Introduced a comprehensive set of UI components, including Header, Footer, Search, StatsArea, and various navigation elements for enhanced user experience.
    • Implemented a search component for user input in a network exploration tool.
    • Added a new RootLayout component to provide a consistent structure for application pages.
  • Enhancements

    • Established a centralized configuration for Tailwind CSS to streamline styling across the application.
    • Added a structured approach to managing blockchain-related constants for better maintainability.
    • Integrated Apollo Client for efficient data management and GraphQL querying.
  • Documentation

    • Updated README and added configuration files to support project setup and development.
  • Bug Fixes

    • Improved error handling and data fetching in custom hooks for payments and requests.
  • Chores

    • Introduced ESLint configuration for better code quality and consistency.
    • Added .gitignore file to maintain a clean version control environment.
    • Established TypeScript configuration for enhanced type safety and development experience.
    • Introduced PostCSS configuration to integrate Tailwind CSS into the build process.

@rodrigopavezi
Copy link
Member Author

Preview:

Screenshot 2024-08-22 at 15 26 03

@MantisClone MantisClone linked an issue Aug 27, 2024 that may be closed by this pull request
9 tasks
@rodrigopavezi
Copy link
Member Author

New Preview:

Screenshot 2024-08-28 at 10 10 50

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 28, 2024

Warning

Rate limit exceeded

@rodrigopavezi has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 24 minutes and 26 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between c819dd8 and 7a8d778.

Walkthrough

The changes introduce a comprehensive configuration for a Next.js application, including ESLint, Tailwind CSS, and TypeScript settings. New UI components such as headers, footers, navigation, and data display elements are added, along with custom hooks for fetching payment and transaction data. The codebase is organized for improved maintainability, with utility functions and constants for blockchain interactions defined to enhance data handling and user interface consistency.

Changes

File(s) Change Summary
.eslintrc.json, .gitignore, README.md New ESLint configuration, .gitignore file created, and minor modification in README.md with a formatting comment.
components.json, next.config.mjs, package.json, postcss.config.mjs, tailwind.config.ts, tsconfig.json New configuration files for component library, Next.js settings, project metadata, PostCSS, Tailwind CSS, and TypeScript.
src/app/layout.tsx, src/components/* New components added for layout and UI elements including Footer, Header, Logo, MainNav, Search, Socials, StatsArea, and others.
src/lib/apollo-wrapper.tsx, src/lib/consts.ts, src/lib/hooks/latest-payments.tsx, src/lib/hooks/latest-requests.tsx, src/lib/queries/payments.ts, src/lib/queries/transactions.ts, src/lib/types.ts, src/lib/utils.ts New files and hooks for Apollo Client integration, constants for blockchain networks, queries for payments and transactions, and utility functions.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App
    participant ApolloWrapper
    participant PaymentAPI

    User->>App: Load Application
    App->>ApolloWrapper: Initialize Apollo Client
    ApolloWrapper->>PaymentAPI: Fetch Payment Data
    PaymentAPI-->>ApolloWrapper: Return Payment Data
    ApolloWrapper-->>App: Provide Payment Data
    App-->>User: Render Application with Data
Loading

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 resolve resolve all the CodeRabbit review comments.
  • @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.
Early access features: disabled

We are currently testing the following features in early access:

  • Anthropic claude-3-5-sonnet for code reviews: Anthropic claims that the new Claude model has stronger code understanding and code generation capabilities than their previous models. Note: Our default code review model was also updated late last week. Please compare the quality of the reviews between the two models by toggling the early access feature.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues on the discussion post.

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

Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 0728450 and 50983dc.

Files ignored due to path filters (5)
  • package-lock.json is excluded by !**/package-lock.json
  • public/data.svg is excluded by !**/*.svg
  • public/logo-1.svg is excluded by !**/*.svg
  • public/logo-2.svg is excluded by !**/*.svg
  • src/app/icon.ico is excluded by !**/*.ico
Files selected for processing (39)
  • .eslintrc.json (1 hunks)
  • .gitignore (1 hunks)
  • README.md (1 hunks)
  • components.json (1 hunks)
  • next.config.mjs (1 hunks)
  • package.json (1 hunks)
  • postcss.config.mjs (1 hunks)
  • src/app/globals.css (1 hunks)
  • src/app/layout.tsx (1 hunks)
  • src/app/page.tsx (1 hunks)
  • src/components/footer.tsx (1 hunks)
  • src/components/header.tsx (1 hunks)
  • src/components/logo.tsx (1 hunks)
  • src/components/main-nav.tsx (1 hunks)
  • src/components/recent-area.tsx (1 hunks)
  • src/components/recent-payment-table.tsx (1 hunks)
  • src/components/recent-request-table.tsx (1 hunks)
  • src/components/search-area.tsx (1 hunks)
  • src/components/search.tsx (1 hunks)
  • src/components/socials.tsx (1 hunks)
  • src/components/stats-area.tsx (1 hunks)
  • src/components/ui/avatar.tsx (1 hunks)
  • src/components/ui/badge.tsx (1 hunks)
  • src/components/ui/button.tsx (1 hunks)
  • src/components/ui/card.tsx (1 hunks)
  • src/components/ui/dropdown-menu.tsx (1 hunks)
  • src/components/ui/input.tsx (1 hunks)
  • src/components/ui/sheet.tsx (1 hunks)
  • src/components/ui/table.tsx (1 hunks)
  • src/lib/apollo-wrapper.tsx (1 hunks)
  • src/lib/consts.ts (1 hunks)
  • src/lib/hooks/latest-payments.tsx (1 hunks)
  • src/lib/hooks/latest-requests.tsx (1 hunks)
  • src/lib/queries/payments.ts (1 hunks)
  • src/lib/queries/transactions.ts (1 hunks)
  • src/lib/types.ts (1 hunks)
  • src/lib/utils.ts (1 hunks)
  • tailwind.config.ts (1 hunks)
  • tsconfig.json (1 hunks)
Additional context used
Biome
src/lib/queries/payments.ts

[error] 5-5: Don't use 'String' as a type.

Use lowercase primitives for consistency.
Safe fix: Use 'string' instead

(lint/complexity/noBannedTypes)

src/lib/utils.ts

[error] 16-16: Avoid the use of spread (...) syntax on accumulators.

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

(lint/performance/noAccumulatingSpread)

src/app/layout.tsx

[error] 38-38: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.

Unsafe fix: Use a SelfClosingElement instead

(lint/style/useSelfClosingElements)

Additional comments not posted (109)
README.md (1)

1-1: LGTM!

The addition of the <!-- @format --> comment is a good practice for ensuring consistent formatting.

The code changes are approved.

.eslintrc.json (1)

1-3: LGTM!

The ESLint configuration extends next/core-web-vitals, which is a good practice for maintaining code quality in Next.js projects.

The code changes are approved.

next.config.mjs (1)

1-4: LGTM!

The Next.js configuration is correctly set up and exported. This is a standard practice for initializing Next.js projects.

The code changes are approved.

postcss.config.mjs (1)

1-8: LGTM!

The PostCSS configuration is correctly set up with Tailwind CSS as a plugin.

The code changes are approved.

src/components/footer.tsx (1)

1-13: LGTM!

The Footer component is correctly implemented with appropriate styling using Tailwind CSS.

The code changes are approved.

src/components/logo.tsx (1)

1-18: LGTM!

The Logo component is correctly implemented using Next.js Image and Link components for optimized image loading and client-side navigation.

The code changes are approved.

src/app/page.tsx (2)

2-4: LGTM!

The import statements are correct and necessary.

The code changes are approved.


6-14: LGTM!

The Home function is correctly implemented and follows best practices.

The code changes are approved.

src/components/recent-area.tsx (2)

3-4: LGTM!

The import statements are correct and necessary.

The code changes are approved.


6-13: LGTM!

The RecentArea function is correctly implemented and follows best practices.

The code changes are approved.

components.json (1)

1-17: LGTM!

The configuration settings are correct and follow best practices.

The code changes are approved.

.gitignore (6)

3-7: LGTM!

The entries for ignoring dependencies and package manager files are appropriate.

The code changes are approved.


9-10: LGTM!

The entry for ignoring test coverage reports is appropriate.

The code changes are approved.


12-14: LGTM!

The entries for ignoring Next.js build output directories are appropriate.

The code changes are approved.


16-17: LGTM!

The entry for ignoring production build directories is appropriate.

The code changes are approved.


19-21: LGTM!

The entries for ignoring miscellaneous files are appropriate.

The code changes are approved.


23-36: LGTM!

The entries for ignoring debug logs, local environment files, Vercel configuration, and TypeScript build information are appropriate.

The code changes are approved.

src/components/search-area.tsx (2)

3-4: LGTM!

The imports are appropriate for the functionality of the component.

The code changes are approved.


6-17: LGTM!

The SearchArea component is well-structured and follows common React and Next.js practices. The use of Tailwind CSS classes is appropriate for styling.

The code changes are approved.

src/components/search.tsx (2)

3-4: LGTM!

The imports are appropriate for the functionality of the component.

The code changes are approved.


6-16: LGTM!

The Search component is well-structured and follows common React and Next.js practices. The use of Tailwind CSS classes is appropriate for styling.

The code changes are approved.

src/lib/queries/transactions.ts (1)

5-25: LGTM! Ensure parameter validation and error handling in the calling code.

The GraphQL query is correctly structured and fetches the necessary transaction data. However, ensure that the first and skip parameters are validated in the calling code to prevent potential issues. Additionally, consider adding error handling or logging in the calling code to manage potential issues with the data source.

tsconfig.json (1)

1-26: LGTM! Ensure paths configuration and included files are correct.

The TypeScript configuration settings are correctly structured and enable strict type-checking, among other options. However, ensure that the paths configuration aligns with the project structure and verify that the included files cover all necessary TypeScript files.

src/components/header.tsx (1)

10-24: LGTM! Ensure usePathname hook and sub-components work as expected.

The React component is correctly structured and includes various sub-components. However, ensure that the usePathname hook works as expected in all scenarios. Additionally, verify that the sub-components (Logo, MainNav, Search, Socials) are correctly implemented and imported.

src/lib/types.ts (2)

3-23: LGTM!

The Payment interface is well-defined and covers various aspects of a payment.

The code changes are approved.


25-34: LGTM!

The Transaction interface is well-defined and covers various aspects of a transaction.

The code changes are approved.

src/lib/queries/payments.ts (1)

6-35: LGTM!

The GraphQL query is well-defined and covers various aspects of a payment.

The code changes are approved.

src/components/main-nav.tsx (1)

7-31: LGTM!

The MainNav component is well-defined and uses utility functions for styling.

The code changes are approved.

src/lib/utils.ts (2)

9-10: LGTM!

The cn function is correctly implemented and leverages clsx and twMerge for class name merging.

The code changes are approved.


22-30: LGTM!

The formatTimestamp function is correctly implemented and leverages toLocaleString for formatting.

The code changes are approved.

src/lib/hooks/latest-requests.tsx (5)

1-3: LGTM!

The code is correctly formatted and the directive is appropriate for the client-side hook.

The code changes are approved.


4-9: LGTM!

The imports are necessary and correctly specified.

The code changes are approved.


10-15: LGTM!

The interface is correctly defined and provides a clear structure for the hook's return value.

The code changes are approved.


17-25: LGTM!

The hook is correctly set up to fetch data using Apollo Client. The poll interval is configurable via environment variables.

The code changes are approved.


27-39: LGTM!

The use of useMemo is appropriate for memoizing the processed data. The code correctly handles the loading state and data processing.

The code changes are approved.

src/lib/apollo-wrapper.tsx (4)

1-3: LGTM!

The code is correctly formatted and the directive is appropriate for the client-side component.

The code changes are approved.


4-11: LGTM!

The imports are necessary and correctly specified.

The code changes are approved.


12-34: LGTM!

The function is correctly set up to handle both server-side and client-side rendering. The use of environment variables for configuration is appropriate.

The code changes are approved.


36-42: LGTM!

The component is correctly set up to wrap the application with the Apollo Provider.

The code changes are approved.

package.json (3)

1-5: LGTM!

The metadata and scripts are correctly specified.

The code changes are approved.


11-28: LGTM!

The dependencies are necessary for the project and correctly specified.

The code changes are approved.


29-38: LGTM!

The devDependencies are necessary for the project and correctly specified.

The code changes are approved.

src/components/ui/badge.tsx (4)

1-4: LGTM!

The import statements are correct and necessary for the functionality of the Badge component.

The code changes are approved.


6-24: LGTM!

The badgeVariants constant is correctly defined and follows best practices for styling components.

The code changes are approved.


26-28: LGTM!

The BadgeProps interface is correctly defined and ensures type safety for the Badge component.

The code changes are approved.


30-34: LGTM!

The Badge component is correctly implemented and follows best practices for React components.

The code changes are approved.

src/lib/consts.ts (3)

3-16: LGTM!

The CHAINS constant is correctly defined and follows best practices for defining constants.

The code changes are approved.


18-31: LGTM!

The CHAIN_SCAN_URLS constant is correctly defined and ensures that each chain has a corresponding scan URL.

The code changes are approved.


33-45: LGTM!

The PAYMENT_CHAINS enum is correctly defined and follows best practices for defining enums.

The code changes are approved.

src/components/ui/avatar.tsx (4)

1-6: LGTM!

The import statements are correct and necessary for the functionality of the Avatar components.

The code changes are approved.


8-21: LGTM!

The Avatar component is correctly implemented and follows best practices for React components.

The code changes are approved.


23-33: LGTM!

The AvatarImage component is correctly implemented and follows best practices for React components.

The code changes are approved.


35-48: LGTM!

The AvatarFallback component is correctly implemented and follows best practices for React components.

The code changes are approved.

src/app/layout.tsx (4)

3-16: LGTM!

The imports and metadata are correctly defined.

The code changes are approved.


6-11: LGTM!

The usage of the cn utility function and inter font is correct.

The code changes are approved.

Also applies to: 26-29


31-31: LGTM!

The usage of the ApolloWrapper component is correct.

The code changes are approved.

Also applies to: 50-50


32-49: LGTM!

The structure of the header, main, and footer sections is correct.

The code changes are approved.

Tools
Biome

[error] 38-38: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.

Unsafe fix: Use a SelfClosingElement instead

(lint/style/useSelfClosingElements)

src/components/ui/button.tsx (4)

1-6: LGTM!

The imports and button variants are correctly defined.

The code changes are approved.

Also applies to: 7-34


36-40: LGTM!

The ButtonProps interface is correctly defined.

The code changes are approved.


42-54: LGTM!

The Button component is correctly defined.

The code changes are approved.


56-56: LGTM!

The export statements are correctly defined.

The code changes are approved.

src/app/globals.css (4)

1-3: LGTM!

The Tailwind CSS imports are correctly defined.

The code changes are approved.


5-32: LGTM!

The custom CSS variables for the light theme are correctly defined.

The code changes are approved.


34-59: LGTM!

The custom CSS variables for the dark theme are correctly defined.

The code changes are approved.


62-69: LGTM!

The global styles using Tailwind CSS are correctly defined.

The code changes are approved.

src/components/ui/card.tsx (6)

5-18: LGTM!

The Card component is correctly implemented, following best practices for ref forwarding and class name management.

The code changes are approved.


20-30: LGTM!

The CardHeader component is correctly implemented, following best practices for ref forwarding and class name management.

The code changes are approved.


32-45: LGTM!

The CardTitle component is correctly implemented, following best practices for ref forwarding and class name management.

The code changes are approved.


47-57: LGTM!

The CardDescription component is correctly implemented, following best practices for ref forwarding and class name management.

The code changes are approved.


59-65: LGTM!

The CardContent component is correctly implemented, following best practices for ref forwarding and class name management.

The code changes are approved.


67-77: LGTM!

The CardFooter component is correctly implemented, following best practices for ref forwarding and class name management.

The code changes are approved.

src/components/stats-area.tsx (1)

6-58: LGTM!

The StatsArea component is correctly implemented, following best practices for component composition and visual representation.

The code changes are approved.

src/components/recent-request-table.tsx (1)

26-83: LGTM!

The RecentRequestTable component is correctly implemented, following best practices for component composition and data fetching.

The code changes are approved.

tailwind.config.ts (6)

3-4: LGTM!

The import statements are correctly importing the necessary modules.

The code changes are approved.


7-7: LGTM!

The dark mode configuration is correctly set to use the 'class' strategy.

The code changes are approved.


8-12: LGTM!

The content paths are correctly specified for Tailwind CSS to scan the necessary files.

The code changes are approved.


15-80: LGTM!

The theme customization is correctly set up and follows best practices.

The code changes are approved.


83-83: LGTM!

The plugins configuration is correctly set up.

The code changes are approved.


86-86: LGTM!

The export statement is correctly exporting the configuration object.

The code changes are approved.

src/components/recent-payment-table.tsx (3)

4-26: LGTM!

The import statements are correctly importing the necessary modules and components.

The code changes are approved.


28-37: LGTM!

The component correctly uses the useLatestPayments hook and handles loading and no data states.

The code changes are approved.


39-91: LGTM!

The component correctly renders a card with a table of recent payments.

The code changes are approved.

src/components/ui/table.tsx (8)

5-16: LGTM!

The Table component is correctly implemented.

The code changes are approved.


19-24: LGTM!

The TableHeader component is correctly implemented.

The code changes are approved.


27-35: LGTM!

The TableBody component is correctly implemented.

The code changes are approved.


39-51: LGTM!

The TableFooter component is correctly implemented.

The code changes are approved.


54-66: LGTM!

The TableRow component is correctly implemented.

The code changes are approved.


69-80: LGTM!

The TableHead component is correctly implemented.

The code changes are approved.


84-92: LGTM!

The TableCell component is correctly implemented.

The code changes are approved.


96-104: LGTM!

The TableCaption component is correctly implemented.

The code changes are approved.

src/components/ui/sheet.tsx (11)

10-10: LGTM!

The component is correctly implemented.

The code changes are approved.


12-12: LGTM!

The component is correctly implemented.

The code changes are approved.


14-14: LGTM!

The component is correctly implemented.

The code changes are approved.


16-16: LGTM!

The component is correctly implemented.

The code changes are approved.


18-31: LGTM!

The component is correctly implemented.

The code changes are approved.


33-50: LGTM!

The component is correctly implemented.

The code changes are approved.


56-75: LGTM!

The component is correctly implemented.

The code changes are approved.


77-89: LGTM!

The component is correctly implemented.

The code changes are approved.


91-103: LGTM!

The component is correctly implemented.

The code changes are approved.


105-115: LGTM!

The component is correctly implemented.

The code changes are approved.


117-127: LGTM!

The component is correctly implemented.

The code changes are approved.

src/lib/hooks/latest-payments.tsx (2)

1-13: LGTM!

The imports and interface declaration are correctly implemented.

The code changes are approved.


217-218: LGTM!

The return statement is correctly implemented.

The code changes are approved.

src/components/ui/dropdown-menu.tsx (6)

9-9: LGTM!

The component is correctly implemented.

The code changes are approved.


11-11: LGTM!

The component is correctly implemented.

The code changes are approved.


13-13: LGTM!

The component is correctly implemented.

The code changes are approved.


15-15: LGTM!

The component is correctly implemented.

The code changes are approved.


17-17: LGTM!

The component is correctly implemented.

The code changes are approved.


19-19: LGTM!

The component is correctly implemented.

The code changes are approved.


import { gql, DocumentNode } from '@apollo/client';

export const getPaymentsQuery = (paymentChain: String): DocumentNode =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Use string instead of String.

The type of paymentChain should be string for consistency.

Apply this diff to fix the type:

-export const getPaymentsQuery = (paymentChain: String): DocumentNode =>
+export const getPaymentsQuery = (paymentChain: string): DocumentNode =>
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
export const getPaymentsQuery = (paymentChain: String): DocumentNode =>
export const getPaymentsQuery = (paymentChain: string): DocumentNode =>
Tools
Biome

[error] 5-5: Don't use 'String' as a type.

Use lowercase primitives for consistency.
Safe fix: Use 'string' instead

(lint/complexity/noBannedTypes)

Comment on lines 9 to 14
href="https://x.com/RequestNetwork"
url="https://x.com"
fgColor="black"
bgColor="transparent"
target="_blank"
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove redundant url attributes.

The href and url attributes are redundant. Only one is needed. Remove the url attributes to simplify the code.

Apply this diff to remove the redundant url attributes:

-        href="https://x.com/RequestNetwork"
-        url="https://x.com"
+        url="https://x.com/RequestNetwork"
-        href="https://www.linkedin.com/company/request-network"
-        url="https://www.linkedin.com"
+        url="https://www.linkedin.com/company/request-network"
-        href="https://discord.gg/FsVAR3ny3f"
-        url="https://discord.com"
+        url="https://discord.gg/FsVAR3ny3f"

Also applies to: 16-21, 23-28

src/lib/utils.ts Outdated
Comment on lines 13 to 20
export const groupBy = (items: any, key: any) =>
items.reduce(
(result: any, item: any) => ({
...result,
[item[key]]: [...(result[item[key]] || []), item],
}),
{},
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid the use of spread syntax on accumulators.

The use of spread syntax on accumulators should be avoided due to performance concerns. Use .push instead.

Apply this diff to use .push instead of spread syntax:

 export const groupBy = (items: any, key: any) =>
   items.reduce(
     (result: any, item: any) => {
-      ...result,
-      [item[key]]: [...(result[item[key]] || []), item],
+      if (!result[item[key]]) {
+        result[item[key]] = [];
+      }
+      result[item[key]].push(item);
+      return result;
     },
     {},
   );
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
export const groupBy = (items: any, key: any) =>
items.reduce(
(result: any, item: any) => ({
...result,
[item[key]]: [...(result[item[key]] || []), item],
}),
{},
);
export const groupBy = (items: any, key: any) =>
items.reduce(
(result: any, item: any) => {
if (!result[item[key]]) {
result[item[key]] = [];
}
result[item[key]].push(item);
return result;
},
{},
);
Tools
Biome

[error] 16-16: Avoid the use of spread (...) syntax on accumulators.

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

(lint/performance/noAccumulatingSpread)

({ className, type, ...props }, ref) => {
return (
<input
type={type}
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a default value for the type prop.

The type prop should have a default value to avoid potential issues when it is not provided.

Apply this diff to add a default value for the type prop:

 type = 'text',

Committable suggestion was skipped due to low confidence.

extends React.InputHTMLAttributes<HTMLInputElement> {}

const Input = React.forwardRef<HTMLInputElement, InputProps>(
({ className, type, ...props }, ref) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Make className prop optional.

The className prop should be optional to avoid potential issues when it is not provided.

Apply this diff to make the className prop optional:

 ({ className = '', type, ...props }, ref) => {
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
({ className, type, ...props }, ref) => {
({ className = '', type, ...props }, ref) => {

Comment on lines 18 to 53
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body
className={cn(
'min-h-screen bg-background font-sans antialiased',
inter.variable,
)}
>
<ApolloWrapper>
<div className="hidden flex-col md:flex">
<header>
<Header />
</header>
<main>
<div className="grid">
<div className="col-start-1 row-start-1 bg-emerald-900 md:h-96 md:p-10"></div>
<div className="col-start-1 row-start-1">
<div className="flex flex-1 flex-col md:gap-8 md:py-10 md:px-32">
{children}
</div>
</div>
</div>
</main>
<footer className="min-h-52">
<Footer />
</footer>
</div>
</ApolloWrapper>
</body>
</html>
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Use self-closing element for JSX elements without children.

The div element on line 38 should be self-closing.

Apply this diff to use a self-closing element:

-                <div className="col-start-1 row-start-1 bg-emerald-900 md:h-96 md:p-10"></div>
+                <div className="col-start-1 row-start-1 bg-emerald-900 md:h-96 md:p-10" />
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
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body
className={cn(
'min-h-screen bg-background font-sans antialiased',
inter.variable,
)}
>
<ApolloWrapper>
<div className="hidden flex-col md:flex">
<header>
<Header />
</header>
<main>
<div className="grid">
<div className="col-start-1 row-start-1 bg-emerald-900 md:h-96 md:p-10"></div>
<div className="col-start-1 row-start-1">
<div className="flex flex-1 flex-col md:gap-8 md:py-10 md:px-32">
{children}
</div>
</div>
</div>
</main>
<footer className="min-h-52">
<Footer />
</footer>
</div>
</ApolloWrapper>
</body>
</html>
);
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body
className={cn(
'min-h-screen bg-background font-sans antialiased',
inter.variable,
)}
>
<ApolloWrapper>
<div className="hidden flex-col md:flex">
<header>
<Header />
</header>
<main>
<div className="grid">
<div className="col-start-1 row-start-1 bg-emerald-900 md:h-96 md:p-10" />
<div className="col-start-1 row-start-1">
<div className="flex flex-1 flex-col md:gap-8 md:py-10 md:px-32">
{children}
</div>
</div>
</div>
</main>
<footer className="min-h-52">
<Footer />
</footer>
</div>
</ApolloWrapper>
</body>
</html>
);
Tools
Biome

[error] 38-38: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.

Unsafe fix: Use a SelfClosingElement instead

(lint/style/useSelfClosingElements)

Comment on lines +19 to +113
const { data: mainnetData, loading: mainnetLoading } = useQuery(
getPaymentsQuery(PAYMENT_CHAINS.MAINNET),
{
pollInterval,
variables: { first, skip },
},
);

const { data: arbitrumOneData, loading: arbitrumOneLoading } = useQuery(
getPaymentsQuery(PAYMENT_CHAINS.ARBITRUM_ONE),
{
pollInterval,
variables: { first, skip },
},
);

const { data: avalancheData, loading: avalancheLoading } = useQuery(
getPaymentsQuery(PAYMENT_CHAINS.AVALANCHE),
{
pollInterval,
variables: { first, skip },
},
);

const { data: bscData, loading: bscLoading } = useQuery(
getPaymentsQuery(PAYMENT_CHAINS.BSC),
{
pollInterval,
variables: { first, skip },
},
);

const { data: celoData, loading: celoLoading } = useQuery(
getPaymentsQuery(PAYMENT_CHAINS.CELO),
{
pollInterval,
variables: { first, skip },
},
);

const { data: fantomData, loading: fantomLoading } = useQuery(
getPaymentsQuery(PAYMENT_CHAINS.FANTOM),
{
pollInterval,
variables: { first, skip },
},
);

const { data: fuseData, loading: fuseLoading } = useQuery(
getPaymentsQuery(PAYMENT_CHAINS.FUSE),
{
pollInterval,
variables: { first, skip },
},
);

const { data: maticData, loading: maticLoading } = useQuery(
getPaymentsQuery(PAYMENT_CHAINS.MATIC),
{
pollInterval,
variables: { first, skip },
},
);

const { data: moonbeamData, loading: moonbeamLoading } = useQuery(
getPaymentsQuery(PAYMENT_CHAINS.MOONBEAM),
{
pollInterval,
variables: { first, skip },
},
);

const { data: optimismData, loading: optimismLoading } = useQuery(
getPaymentsQuery(PAYMENT_CHAINS.OPTIMISM),
{
pollInterval,
variables: { first, skip },
},
);

const { data: xdaiData, loading: xdaiLoading } = useQuery(
getPaymentsQuery(PAYMENT_CHAINS.XDAI),
{
pollInterval,
variables: { first, skip },
},
);

const { data: zksynceraData, loading: zksynceraLoading } = useQuery(
getPaymentsQuery(PAYMENT_CHAINS.ZKSYNCERA),
{
pollInterval,
variables: { first, skip },
},
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider refactoring repetitive code.

The GraphQL queries are correctly implemented. However, the repetitive code can be refactored to improve maintainability. Consider creating a helper function to handle the queries.

Example:

+const usePaymentQuery = (chain) => {
+  return useQuery(getPaymentsQuery(chain), {
+    pollInterval,
+    variables: { first, skip },
+  });
+};

const { data: mainnetData, loading: mainnetLoading } = usePaymentQuery(PAYMENT_CHAINS.MAINNET);
const { data: arbitrumOneData, loading: arbitrumOneLoading } = usePaymentQuery(PAYMENT_CHAINS.ARBITRUM_ONE);
const { data: avalancheData, loading: avalancheLoading } = usePaymentQuery(PAYMENT_CHAINS.AVALANCHE);
const { data: bscData, loading: bscLoading } = usePaymentQuery(PAYMENT_CHAINS.BSC);
const { data: celoData, loading: celoLoading } = usePaymentQuery(PAYMENT_CHAINS.CELO);
const { data: fantomData, loading: fantomLoading } = usePaymentQuery(PAYMENT_CHAINS.FANTOM);
const { data: fuseData, loading: fuseLoading } = usePaymentQuery(PAYMENT_CHAINS.FUSE);
const { data: maticData, loading: maticLoading } = usePaymentQuery(PAYMENT_CHAINS.MATIC);
const { data: moonbeamData, loading: moonbeamLoading } = usePaymentQuery(PAYMENT_CHAINS.MOONBEAM);
const { data: optimismData, loading: optimismLoading } = usePaymentQuery(PAYMENT_CHAINS.OPTIMISM);
const { data: xdaiData, loading: xdaiLoading } = usePaymentQuery(PAYMENT_CHAINS.XDAI);
const { data: zksynceraData, loading: zksynceraLoading } = usePaymentQuery(PAYMENT_CHAINS.ZKSYNCERA);
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
const { data: mainnetData, loading: mainnetLoading } = useQuery(
getPaymentsQuery(PAYMENT_CHAINS.MAINNET),
{
pollInterval,
variables: { first, skip },
},
);
const { data: arbitrumOneData, loading: arbitrumOneLoading } = useQuery(
getPaymentsQuery(PAYMENT_CHAINS.ARBITRUM_ONE),
{
pollInterval,
variables: { first, skip },
},
);
const { data: avalancheData, loading: avalancheLoading } = useQuery(
getPaymentsQuery(PAYMENT_CHAINS.AVALANCHE),
{
pollInterval,
variables: { first, skip },
},
);
const { data: bscData, loading: bscLoading } = useQuery(
getPaymentsQuery(PAYMENT_CHAINS.BSC),
{
pollInterval,
variables: { first, skip },
},
);
const { data: celoData, loading: celoLoading } = useQuery(
getPaymentsQuery(PAYMENT_CHAINS.CELO),
{
pollInterval,
variables: { first, skip },
},
);
const { data: fantomData, loading: fantomLoading } = useQuery(
getPaymentsQuery(PAYMENT_CHAINS.FANTOM),
{
pollInterval,
variables: { first, skip },
},
);
const { data: fuseData, loading: fuseLoading } = useQuery(
getPaymentsQuery(PAYMENT_CHAINS.FUSE),
{
pollInterval,
variables: { first, skip },
},
);
const { data: maticData, loading: maticLoading } = useQuery(
getPaymentsQuery(PAYMENT_CHAINS.MATIC),
{
pollInterval,
variables: { first, skip },
},
);
const { data: moonbeamData, loading: moonbeamLoading } = useQuery(
getPaymentsQuery(PAYMENT_CHAINS.MOONBEAM),
{
pollInterval,
variables: { first, skip },
},
);
const { data: optimismData, loading: optimismLoading } = useQuery(
getPaymentsQuery(PAYMENT_CHAINS.OPTIMISM),
{
pollInterval,
variables: { first, skip },
},
);
const { data: xdaiData, loading: xdaiLoading } = useQuery(
getPaymentsQuery(PAYMENT_CHAINS.XDAI),
{
pollInterval,
variables: { first, skip },
},
);
const { data: zksynceraData, loading: zksynceraLoading } = useQuery(
getPaymentsQuery(PAYMENT_CHAINS.ZKSYNCERA),
{
pollInterval,
variables: { first, skip },
},
);
const usePaymentQuery = (chain) => {
return useQuery(getPaymentsQuery(chain), {
pollInterval,
variables: { first, skip },
});
};
const { data: mainnetData, loading: mainnetLoading } = usePaymentQuery(PAYMENT_CHAINS.MAINNET);
const { data: arbitrumOneData, loading: arbitrumOneLoading } = usePaymentQuery(PAYMENT_CHAINS.ARBITRUM_ONE);
const { data: avalancheData, loading: avalancheLoading } = usePaymentQuery(PAYMENT_CHAINS.AVALANCHE);
const { data: bscData, loading: bscLoading } = usePaymentQuery(PAYMENT_CHAINS.BSC);
const { data: celoData, loading: celoLoading } = usePaymentQuery(PAYMENT_CHAINS.CELO);
const { data: fantomData, loading: fantomLoading } = usePaymentQuery(PAYMENT_CHAINS.FANTOM);
const { data: fuseData, loading: fuseLoading } = usePaymentQuery(PAYMENT_CHAINS.FUSE);
const { data: maticData, loading: maticLoading } = usePaymentQuery(PAYMENT_CHAINS.MATIC);
const { data: moonbeamData, loading: moonbeamLoading } = usePaymentQuery(PAYMENT_CHAINS.MOONBEAM);
const { data: optimismData, loading: optimismLoading } = usePaymentQuery(PAYMENT_CHAINS.OPTIMISM);
const { data: xdaiData, loading: xdaiLoading } = usePaymentQuery(PAYMENT_CHAINS.XDAI);
const { data: zksynceraData, loading: zksynceraLoading } = usePaymentQuery(PAYMENT_CHAINS.ZKSYNCERA);

Comment on lines +115 to +174
const value = useMemo(
() => ({
payments:
mainnetData &&
arbitrumOneData &&
avalancheData &&
bscData &&
celoData &&
fantomData &&
fuseData &&
maticData &&
moonbeamData &&
optimismData &&
xdaiData &&
zksynceraData
? [
...mainnetData.payment_mainnet.payments.map((payment: any) => {
return { ...payment, chain: CHAINS.MAINNET };
}),
...arbitrumOneData.payment_arbitrum_one.payments.map(
(payment: any) => {
return { ...payment, chain: CHAINS.ARBITRUM_ONE };
},
),
...avalancheData.payment_avalanche.payments.map(
(payment: any) => {
return { ...payment, chain: CHAINS.AVALANCHE };
},
),
...bscData.payment_bsc.payments.map((payment: any) => {
return { ...payment, chain: CHAINS.BSC };
}),
...celoData.payment_celo.payments.map((payment: any) => {
return { ...payment, chain: CHAINS.CELO };
}),
...fantomData.payment_fantom.payments.map((payment: any) => {
return { ...payment, chain: CHAINS.FANTOM };
}),
...fuseData.payment_fuse.payments.map((payment: any) => {
return { ...payment, chain: CHAINS.FUSE };
}),
...maticData.payment_matic.payments.map((payment: any) => {
return { ...payment, chain: CHAINS.MATIC };
}),
...moonbeamData.payment_moonbeam.payments.map((payment: any) => {
return { ...payment, chain: CHAINS.MOONBEAM };
}),
...optimismData.payment_optimism.payments.map((payment: any) => {
return { ...payment, chain: CHAINS.OPTIMISM };
}),
...xdaiData.payment_xdai.payments.map((payment: any) => {
return { ...payment, chain: CHAINS.XDAI };
}),
...zksynceraData.payment_zksyncera.payments.map(
(payment: any) => {
return { ...payment, chain: CHAINS.ZKSYNCERA };
},
),
].sort((a: Payment, b: Payment) => b.timestamp - a.timestamp)
: [],
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid using any type.

The useMemo hook is correctly implemented. However, the use of any type for payment objects should be avoided. Consider defining a more specific type for payment objects.

Example:

const value = useMemo(
  () => ({
    payments:
      mainnetData &&
      arbitrumOneData &&
      avalancheData &&
      bscData &&
      celoData &&
      fantomData &&
      fuseData &&
      maticData &&
      moonbeamData &&
      optimismData &&
      xdaiData &&
      zksynceraData
        ? [
            ...mainnetData.payment_mainnet.payments.map((payment: Payment) => {
              return { ...payment, chain: CHAINS.MAINNET };
            }),
            ...arbitrumOneData.payment_arbitrum_one.payments.map(
              (payment: Payment) => {
                return { ...payment, chain: CHAINS.ARBITRUM_ONE };
              },
            ),
            ...avalancheData.payment_avalanche.payments.map(
              (payment: Payment) => {
                return { ...payment, chain: CHAINS.AVALANCHE };
              },
            ),
            ...bscData.payment_bsc.payments.map((payment: Payment) => {
              return { ...payment, chain: CHAINS.BSC };
            }),
            ...celoData.payment_celo.payments.map((payment: Payment) => {
              return { ...payment, chain: CHAINS.CELO };
            }),
            ...fantomData.payment_fantom.payments.map((payment: Payment) => {
              return { ...payment, chain: CHAINS.FANTOM };
            }),
            ...fuseData.payment_fuse.payments.map((payment: Payment) => {
              return { ...payment, chain: CHAINS.FUSE };
            }),
            ...maticData.payment_matic.payments.map((payment: Payment) => {
              return { ...payment, chain: CHAINS.MATIC };
            }),
            ...moonbeamData.payment_moonbeam.payments.map((payment: Payment) => {
              return { ...payment, chain: CHAINS.MOONBEAM };
            }),
            ...optimismData.payment_optimism.payments.map((payment: Payment) => {
              return { ...payment, chain: CHAINS.OPTIMISM };
            }),
            ...xdaiData.payment_xdai.payments.map((payment: Payment) => {
              return { ...payment, chain: CHAINS.XDAI };
            }),
            ...zksynceraData.payment_zksyncera.payments.map(
              (payment: Payment) => {
                return { ...payment, chain: CHAINS.ZKSYNCERA };
              },
            ),
          ].sort((a: Payment, b: Payment) => b.timestamp - a.timestamp)
        : [],
    isLoading:
      mainnetLoading ||
      arbitrumOneLoading ||
      avalancheLoading ||
      bscLoading ||
      celoLoading ||
      fantomLoading ||
      fuseLoading ||
      maticLoading ||
      moonbeamLoading ||
      optimismLoading ||
      xdaiLoading ||
      zksynceraLoading,
  }),
  [
    mainnetData,
    arbitrumOneData,
    avalancheData,
    bscData,
    celoData,
    fantomData,
    fuseData,
    maticData,
    moonbeamData,
    optimismData,
    xdaiData,
    zksynceraData,
    mainnetLoading,
    arbitrumOneLoading,
    avalancheLoading,
    bscLoading,
    celoLoading,
    fantomLoading,
    fuseLoading,
    maticLoading,
    moonbeamLoading,
    optimismLoading,
    xdaiLoading,
    zksynceraLoading,
  ],
);
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
const value = useMemo(
() => ({
payments:
mainnetData &&
arbitrumOneData &&
avalancheData &&
bscData &&
celoData &&
fantomData &&
fuseData &&
maticData &&
moonbeamData &&
optimismData &&
xdaiData &&
zksynceraData
? [
...mainnetData.payment_mainnet.payments.map((payment: any) => {
return { ...payment, chain: CHAINS.MAINNET };
}),
...arbitrumOneData.payment_arbitrum_one.payments.map(
(payment: any) => {
return { ...payment, chain: CHAINS.ARBITRUM_ONE };
},
),
...avalancheData.payment_avalanche.payments.map(
(payment: any) => {
return { ...payment, chain: CHAINS.AVALANCHE };
},
),
...bscData.payment_bsc.payments.map((payment: any) => {
return { ...payment, chain: CHAINS.BSC };
}),
...celoData.payment_celo.payments.map((payment: any) => {
return { ...payment, chain: CHAINS.CELO };
}),
...fantomData.payment_fantom.payments.map((payment: any) => {
return { ...payment, chain: CHAINS.FANTOM };
}),
...fuseData.payment_fuse.payments.map((payment: any) => {
return { ...payment, chain: CHAINS.FUSE };
}),
...maticData.payment_matic.payments.map((payment: any) => {
return { ...payment, chain: CHAINS.MATIC };
}),
...moonbeamData.payment_moonbeam.payments.map((payment: any) => {
return { ...payment, chain: CHAINS.MOONBEAM };
}),
...optimismData.payment_optimism.payments.map((payment: any) => {
return { ...payment, chain: CHAINS.OPTIMISM };
}),
...xdaiData.payment_xdai.payments.map((payment: any) => {
return { ...payment, chain: CHAINS.XDAI };
}),
...zksynceraData.payment_zksyncera.payments.map(
(payment: any) => {
return { ...payment, chain: CHAINS.ZKSYNCERA };
},
),
].sort((a: Payment, b: Payment) => b.timestamp - a.timestamp)
: [],
const value = useMemo(
() => ({
payments:
mainnetData &&
arbitrumOneData &&
avalancheData &&
bscData &&
celoData &&
fantomData &&
fuseData &&
maticData &&
moonbeamData &&
optimismData &&
xdaiData &&
zksynceraData
? [
...mainnetData.payment_mainnet.payments.map((payment: Payment) => {
return { ...payment, chain: CHAINS.MAINNET };
}),
...arbitrumOneData.payment_arbitrum_one.payments.map(
(payment: Payment) => {
return { ...payment, chain: CHAINS.ARBITRUM_ONE };
},
),
...avalancheData.payment_avalanche.payments.map(
(payment: Payment) => {
return { ...payment, chain: CHAINS.AVALANCHE };
},
),
...bscData.payment_bsc.payments.map((payment: Payment) => {
return { ...payment, chain: CHAINS.BSC };
}),
...celoData.payment_celo.payments.map((payment: Payment) => {
return { ...payment, chain: CHAINS.CELO };
}),
...fantomData.payment_fantom.payments.map((payment: Payment) => {
return { ...payment, chain: CHAINS.FANTOM };
}),
...fuseData.payment_fuse.payments.map((payment: Payment) => {
return { ...payment, chain: CHAINS.FUSE };
}),
...maticData.payment_matic.payments.map((payment: Payment) => {
return { ...payment, chain: CHAINS.MATIC };
}),
...moonbeamData.payment_moonbeam.payments.map((payment: Payment) => {
return { ...payment, chain: CHAINS.MOONBEAM };
}),
...optimismData.payment_optimism.payments.map((payment: Payment) => {
return { ...payment, chain: CHAINS.OPTIMISM };
}),
...xdaiData.payment_xdai.payments.map((payment: Payment) => {
return { ...payment, chain: CHAINS.XDAI };
}),
...zksynceraData.payment_zksyncera.payments.map(
(payment: Payment) => {
return { ...payment, chain: CHAINS.ZKSYNCERA };
},
),
].sort((a: Payment, b: Payment) => b.timestamp - a.timestamp)
: [],

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

Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 50983dc and 7d2f36b.

Files ignored due to path filters (1)
  • public/logo-3.svg is excluded by !**/*.svg
Files selected for processing (8)
  • src/app/layout.tsx (1 hunks)
  • src/components/footer.tsx (1 hunks)
  • src/components/header.tsx (1 hunks)
  • src/components/logo.tsx (1 hunks)
  • src/components/main-nav.tsx (1 hunks)
  • src/components/search.tsx (1 hunks)
  • src/components/socials.tsx (1 hunks)
  • src/components/stats-area.tsx (1 hunks)
Additional context used
Biome
src/app/layout.tsx

[error] 38-38: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.

Unsafe fix: Use a SelfClosingElement instead

(lint/style/useSelfClosingElements)

Additional comments not posted (12)
src/components/search.tsx (1)

1-21: LGTM!

The Search component is well-structured and follows best practices.

The code changes are approved.

src/components/footer.tsx (1)

1-20: LGTM!

The Footer component is well-structured and follows best practices.

The code changes are approved.

src/components/header.tsx (1)

1-28: LGTM!

The Header component is well-structured and follows best practices. The conditional rendering of the search bar based on the pathname is a good approach.

The code changes are approved.

src/components/logo.tsx (1)

3-3: Verify the cn utility function.

Ensure that the cn utility function is correctly implemented and imported.

src/components/main-nav.tsx (1)

5-5: Verify the cn utility function.

Ensure that the cn utility function is correctly implemented and imported.

src/app/layout.tsx (4)

3-16: LGTM!

The imports and metadata are correctly defined.

The code changes are approved.


18-22: LGTM!

The RootLayout component is correctly defined.

The code changes are approved.


25-29: LGTM!

The body element and class names are correctly defined.

The code changes are approved.


31-50: LGTM!

The ApolloWrapper and main content structure are correctly defined.

The code changes are approved.

Tools
Biome

[error] 38-38: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.

Unsafe fix: Use a SelfClosingElement instead

(lint/style/useSelfClosingElements)

src/components/stats-area.tsx (3)

3-4: LGTM!

The imports are correctly defined.

The code changes are approved.


6-66: LGTM!

The StatsArea component is correctly defined.

The code changes are approved.


8-65: LGTM!

The class names and styling are correctly defined.

The code changes are approved.

Comment on lines +18 to +19
alt="Logo"
className="h-8"
Copy link
Contributor

@coderabbitai coderabbitai bot Aug 28, 2024

Choose a reason for hiding this comment

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

Improve the alt attribute for images.

The alt attribute should be more descriptive to improve accessibility.

Apply this diff to improve the alt attribute:

-          alt="Logo"
+          alt="Black Logo"
-          alt="Logo"
+          alt="Colored Logo"

Also applies to: 26-27

Copy link
Member

Choose a reason for hiding this comment

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

That's probably true.

Copy link
Contributor

Choose a reason for hiding this comment

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

@MantisClone, thanks for agreeing with the suggestion! The alt attributes will be updated to be more descriptive as proposed.

...props
}: React.HTMLAttributes<HTMLElement>) {
return (
<Link href="/" className={cn(className)} {...props}>
Copy link
Contributor

@coderabbitai coderabbitai bot Aug 28, 2024

Choose a reason for hiding this comment

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

Place props spread before className.

Place the props spread before the className attribute to avoid potential conflicts.

Apply this diff to reorder the attributes:

-    <Link href="/" className={cn(className)} {...props}>
+    <Link href="/" {...props} className={cn(className)}>
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
<Link href="/" className={cn(className)} {...props}>
<Link href="/" {...props} className={cn(className)}>

Copy link
Member

Choose a reason for hiding this comment

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

I don't know if this matters or not

Copy link
Contributor

Choose a reason for hiding this comment

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

@MantisClone, the order of attributes in JSX can indeed matter, particularly when dealing with the className attribute and the props spread. If props contains a className property, it will override the className passed directly as an attribute. By placing props before className, we ensure that any className passed directly to the component takes precedence, avoiding unintended overrides.

While in some cases, the order might not make a difference, following this practice helps prevent potential conflicts and ensures more predictable behavior in the component's styling.

<Link
href="https://request.network/"
className={cn('text-sm font-medium transition-colors', hoverClass)}
target="_blank"
Copy link
Contributor

@coderabbitai coderabbitai bot Aug 28, 2024

Choose a reason for hiding this comment

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

Add rel="noopener noreferrer" to target="_blank attributes.

For security reasons, add rel="noopener noreferrer" to the target="_blank" attributes to prevent potential security vulnerabilities.

Apply this diff to add rel="noopener noreferrer":

         target="_blank"
+        rel="noopener noreferrer"

Also applies to: 27-27

Copy link
Member

Choose a reason for hiding this comment

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

Agreed. Please do this.

Copy link
Contributor

Choose a reason for hiding this comment

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

@MantisClone, here's the code to add rel="noopener noreferrer" to the Link components with target="_blank" in the src/components/main-nav.tsx file:

<Link
  href="https://request.network/"
  className={cn('text-sm font-medium transition-colors', hoverClass)}
  target="_blank"
  rel="noopener noreferrer"
/>

This change should be applied to all instances of target="_blank" within the file.

<div className="flex items-start space-x-1">
<SocialIcon
href="https://x.com/RequestNetwork"
url="https://x.com"
Copy link
Contributor

@coderabbitai coderabbitai bot Aug 28, 2024

Choose a reason for hiding this comment

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

Remove redundant url attributes.

The href and url attributes are redundant. Only one is needed. Remove the url attributes to simplify the code.

Apply this diff to remove the redundant url attributes:

-        href="https://x.com/RequestNetwork"
-        url="https://x.com"
+        url="https://x.com/RequestNetwork"
-        href="https://www.linkedin.com/company/request-network"
-        url="https://www.linkedin.com"
+        url="https://www.linkedin.com/company/request-network"
-        href="https://discord.gg/FsVAR3ny3f"
-        url="https://discord.com"
+        url="https://discord.gg/FsVAR3ny3f"

Also applies to: 17-17, 24-24

Copy link
Member

Choose a reason for hiding this comment

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

I don't know. Please resolve this as you see fit.

Copy link
Contributor

Choose a reason for hiding this comment

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

@MantisClone, the search within the repository did not yield any type definitions or documentation for the SocialIcon component. To resolve this, I referred to the official documentation of the react-social-icons library.

According to the documentation, the SocialIcon component primarily uses the url attribute to specify the link destination. The href attribute is not necessary and can be removed. Therefore, I will proceed with removing the redundant href attributes and keeping only the url attributes.

Here is the updated code:

<SocialIcon url="https://x.com/RequestNetwork" />
<SocialIcon url="https://www.linkedin.com/company/request-network" />
<SocialIcon url="https://discord.gg/FsVAR3ny3f" />

This change simplifies the code and aligns with the best practices for using the SocialIcon component.

Let me know if you need any further assistance!

Analysis chain
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for the `SocialIcon` component's type definitions or documentation to determine the correct usage of `href` and `url` attributes.
rg --glob '**/node_modules/react-social-icons/**' 'SocialIcon'

Length of output: 211


Script:

#!/bin/bash
# Search for the `SocialIcon` component's type definitions or documentation within the repository.
rg 'SocialIcon' --glob '**/*.d.ts' --glob '**/*.tsx' --glob '**/*.ts'

Length of output: 280

fgColor={color}
bgColor="transparent"
target="_blank"
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Add rel="noopener noreferrer" to target="_blank attributes.

For security reasons, add rel="noopener noreferrer" to the target="_blank" attributes to prevent potential security vulnerabilities.

Apply this diff to add rel="noopener noreferrer":

         target="_blank"
+        rel="noopener noreferrer"

Also applies to: 21-21, 28-28

</header>
<main>
<div className="grid">
<div className="col-start-1 row-start-1 bg-emerald-900 h-96 p-10"></div>
Copy link
Contributor

@coderabbitai coderabbitai bot Aug 28, 2024

Choose a reason for hiding this comment

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

Use self-closing element for JSX elements without children.

The div element on line 38 should be self-closing.

Apply this diff to use a self-closing element:

-                <div className="col-start-1 row-start-1 bg-emerald-900 h-96 p-10"></div>
+                <div className="col-start-1 row-start-1 bg-emerald-900 h-96 p-10" />
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
<div className="col-start-1 row-start-1 bg-emerald-900 h-96 p-10"></div>
<div className="col-start-1 row-start-1 bg-emerald-900 h-96 p-10" />
Tools
Biome

[error] 38-38: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.

Unsafe fix: Use a SelfClosingElement instead

(lint/style/useSelfClosingElements)

Copy link
Member

Choose a reason for hiding this comment

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

I agree with this.

Copy link
Contributor

Choose a reason for hiding this comment

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

@MantisClone, thanks for confirming! If you need any further assistance, feel free to reach out.

Comment on lines 18 to 22
{/*
<p className="text-xs text-muted-foreground">
+20.1% from last month
</p>
*/}
Copy link
Contributor

@coderabbitai coderabbitai bot Aug 28, 2024

Choose a reason for hiding this comment

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

Reminder: Remove commented-out code if not needed.

There are several commented-out sections of code within the CardContent components. If these are not needed, consider removing them to keep the codebase clean.

Also applies to: 32-36, 48-50, 60-62

Copy link
Member

Choose a reason for hiding this comment

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

Agreed. Please remove dead code

Copy link
Contributor

Choose a reason for hiding this comment

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

@MantisClone, understood! Please go ahead and remove the commented-out code to keep the codebase clean.

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

Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 7d2f36b and 08bd9a8.

Files selected for processing (7)
  • src/app/layout.tsx (1 hunks)
  • src/components/logo.tsx (1 hunks)
  • src/components/main-nav.tsx (1 hunks)
  • src/components/socials.tsx (1 hunks)
  • src/components/stats-area.tsx (1 hunks)
  • src/lib/queries/payments.ts (1 hunks)
  • src/lib/utils.ts (1 hunks)
Additional comments not posted (6)
src/components/logo.tsx (1)

14-32: Improve the alt attribute for images.

The alt attribute should be more descriptive to improve accessibility. Consider specifying whether the logo is black or colored based on the color prop.

Apply this diff to improve the alt attribute:

-          alt="Logo"
+          alt="Black Logo"
-          alt="Logo"
+          alt="Colored Logo"
src/lib/queries/payments.ts (1)

5-36: GraphQL query implementation looks good.

The GraphQL query is well-structured and correctly utilizes template literals. The type of paymentChain is appropriately set to string, aligning with best practices.

src/lib/utils.ts (3)

9-11: Class name merging function is well-implemented.

The use of clsx and twMerge for class name manipulation is appropriate and follows best practices.


13-20: Updated groupBy function addresses performance concerns.

The use of .push instead of spread syntax in the groupBy function is a good improvement that enhances performance.


22-30: Timestamp formatting function is correctly implemented.

The function formatTimestamp effectively converts UNIX timestamps into a readable format, using appropriate locale settings.

src/components/stats-area.tsx (1)

3-51: Review of the StatsArea Component

The StatsArea component is well-structured and utilizes a consistent design pattern with the use of Card, CardHeader, CardContent, and CardTitle components. The use of icons like DollarSign, Activity, ArrowRightLeft, and Building enhances the visual representation of the statistics.

Key Observations:

  • Import and Usage of Icons: The icons are imported correctly and used within the CardHeader to visually represent the type of statistic. This is a good practice as it enhances user experience by providing visual cues.
  • Grid Layout: The use of Tailwind CSS classes for grid layout (grid gap-4 md:grid-cols-2 md:gap-8 lg:grid-cols-4) is appropriate and responsive, ensuring that the component will adjust well on different screen sizes.
  • Content Display: Each card displays a statistic with a bold and large font, which is good for readability.

Suggestions:

  • Accessibility Enhancements: Consider adding aria-labels to the icons for better accessibility. This will help screen readers interpret the icons' meanings.
  • Performance Consideration: Ensure that the data displayed in the cards, such as "$700+ Million", "13,000", etc., are fetched and rendered efficiently, possibly using memoization if the data fetching logic becomes complex in the future.
  • Code Cleanliness: As noted in the existing comments, ensure that any commented-out code or unused components are removed unless they are intended for future use.

Overall, the implementation aligns well with the objectives of the PR, providing a clean and functional layout for displaying key statistics on the landing page.

Copy link
Member

@MantisClone MantisClone left a comment

Choose a reason for hiding this comment

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

Looks good to me. Admittedly I didn't review as closely as I normally prefer.

I responded to some of the code rabbit comments. On Mobile I can't tell if those comments are obsolete. If they are, please ignore my comments.

const inter = Inter({ subsets: ['latin'], variable: '--font-sans' });

export const metadata: Metadata = {
title: 'Create Next App',
Copy link
Member

Choose a reason for hiding this comment

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

We should change the metadata to reflect Request Scan

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

Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 08bd9a8 and c819dd8.

Files selected for processing (1)
  • src/app/layout.tsx (1 hunks)
Additional comments not posted (2)
src/app/layout.tsx (2)

13-17: LGTM!

The metadata accurately describes the application.


19-55: LGTM!

The root layout component has a clean and responsive design. The use of grid and flex layouts, along with the inclusion of header and footer components, provides a consistent and visually appealing structure.

@rodrigopavezi rodrigopavezi merged commit e40153e into main Sep 2, 2024
@rodrigopavezi rodrigopavezi deleted the feat/landing-page branch September 2, 2024 12:34
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.

Request Scan: Landing Page

5 participants