Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Blockchain Section #180

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

shivankurchavan
Copy link

@shivankurchavan shivankurchavan commented Oct 7, 2024

Description

Added Blockchain section to the website. I am considering this as draft and i am open to change the design if needed. After the card design is confirmed i can populate it with 8-10 options of blockchains that i have at my disposal.

Fixes #171

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change)

Test Required (No)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code

Summary by CodeRabbit

  • New Features

    • Updated version from 0.2.1 to 0.3.0.
    • Introduced a new "Blockchains" section, allowing users to explore blockchains utilizing Rust.
    • Added a search feature for blockchains, enabling real-time filtering of results.
    • New navigation links for "Blockchains" in both mobile and desktop navigation menus.
  • Bug Fixes

    • Updated issue links in the changelog to reflect the new repository owner.
  • Documentation

    • Changelog updated to include new version details and features.

Copy link

vercel bot commented Oct 7, 2024

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

Name Status Preview Comments Updated (UTC)
rustcrab ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 7, 2024 11:43am

Copy link
Contributor

coderabbitai bot commented Oct 7, 2024

Walkthrough

The pull request introduces several updates, including a version change from 0.2.1 to 0.3.0 in the CHANGELOG.md and package.json files. It adds a new React component, Blockchains, for displaying blockchains that utilize Rust, along with a dedicated BlockchainSection component. The MobileNav and Navbar components have been updated to include a new menu item for navigating to the blockchain section. Additionally, a new interface and constant for blockchains are defined in src/data/blockchains.ts.

Changes

File Change Summary
CHANGELOG.md Updated version to 0.3.0, modified issue links to point to shivankurchavan.
package.json Updated version to 0.3.0.
src/app/blockchain/page.tsx Added Blockchains component for displaying a list of blockchains with search functionality.
src/app/page.tsx Imported BlockchainSection and added it to the Home component layout.
src/components/BlockchainSection.tsx Introduced BlockchainsSection component to showcase blockchains with a grid layout.
src/components/navbar/MobileNav.tsx Added "Blockchains" menu item linking to "/#blockchains".
src/components/navbar/Navbar.tsx Added "Blockchains" menu item linking to "/#blockchains".
src/data/blockchains.ts Added Blockchains interface and blockchains constant with Solana data.

Assessment against linked issues

Objective Addressed Explanation
Add a section focused on blockchain (171)

Possibly related PRs

  • Updated Readme & Added Changelog  #118: The changes in the CHANGELOG.md file are related as both PRs involve updates to the changelog, specifically regarding versioning and documenting changes in the project.

Poem

🐰 In the land of code, where blockchains thrive,
A new section blooms, keeping dreams alive.
With links to explore and a search bar to find,
Rust's magic unfolds, leaving doubts behind.
So hop along, dear friends, to the blockchain delight,
Where every click brings knowledge to light! 🌟


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>, 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 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.

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

🧹 Outside diff range and nitpick comments (6)
src/data/blockchains.ts (1)

8-15: LGTM: Good start, but remember to expand the blockchain list.

The blockchains constant is well-defined and correctly typed. The Solana entry looks good. However, as per the PR objectives, you mentioned planning to populate this section with 8-10 blockchain options. Currently, only Solana is present.

Consider adding more blockchain entries to fulfill the planned 8-10 options. This will provide a more comprehensive view of Rust's usage in various blockchain projects.

src/components/navbar/Navbar.tsx (1)

15-15: LGTM! Consider adding a comment for better maintainability.

The addition of the "Blockchains" menu item is correct and aligns with the PR objectives. It follows the existing structure and is consistent with other menu items.

To improve maintainability, consider adding a comment above the menuItems array to explain its purpose and structure. For example:

// Navigation menu items with their corresponding anchor links
const menuItems = [
  // ... existing items ...
  { items: "Blockchains", link: "/#blockchains" },
];

This comment would help future developers understand the purpose of this array at a glance.

src/components/navbar/MobileNav.tsx (1)

18-19: LGTM! Consider reordering menu items for consistency.

The addition of the "Blockchains" item to the menuItems array is correct and aligns with the PR objectives. The link format is consistent with other items, and this change will not break existing functionality.

For better organization, consider reordering the menu items to group similar sections together. For example, you might want to place "Blockchains" next to "Projects" or "Dev Tools" depending on how you categorize it.

export const menuItems: menuObject[] = [
  { items: 'Home', link: '/' },
  { items: 'Books', link: '/#books' },
  { items: 'Projects', link: '/#projects' },
+ { items: "Blockchains", link: "/#blockchains" },
  { items: 'Dev Tools', link: '/#dev_tools' },
  { items: 'Lesson', link: '/#lessons' },
  { items: 'DSA', link: '/#dsas' },
- { items: "Blockchains", link: "/#blockchains" },
];

This reordering is optional and depends on your preferred information architecture.

src/app/blockchain/page.tsx (3)

11-23: LGTM: State management and search functionality are well-implemented.

The use of React hooks for state management is appropriate, and the search functionality is comprehensive, including both title and description in the filtering process.

Consider memoizing the filtered results using useMemo to optimize performance, especially if the blockchains array is large:

const filteredBlockchains = useMemo(() => {
  return blockchains.filter(
    (blockchain) =>
      blockchain.title.toLowerCase().includes(searchTerm.toLowerCase()) ||
      blockchain.description.toLowerCase().includes(searchTerm.toLowerCase())
  );
}, [searchTerm]);

This way, the filtering will only occur when the searchTerm changes, potentially reducing unnecessary re-renders.


25-46: LGTM: Component structure and layout are well-organized.

The use of Tailwind CSS for responsive design and dark mode support is commendable. The layout structure is appropriate for a blockchain listing page.

To improve accessibility, consider adding an aria-label to the search input:

 <input
   type="text"
   placeholder="Search Blockchains..."
   value={searchTerm}
   onChange={handleSearch}
+  aria-label="Search blockchains"
   className="w-full p-3 pl-10 rounded-full border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-red-500"
 />

This will help screen readers better understand the purpose of the input field.


48-52: LGTM: Blockchain card rendering logic is correct, with a minor suggestion.

The use of map to render Card components and the responsive grid layout are well-implemented.

Consider using a unique identifier from the blockchain object as the key prop instead of the array index:

- {filteredBlockchains.map((blockchain, index) => (
-   <Card item={blockchain} key={index} />
- ))}
+ {filteredBlockchains.map((blockchain) => (
+   <Card item={blockchain} key={blockchain.id} />
+ ))}

This assumes that each blockchain object has a unique id property. Using a stable, unique identifier as the key helps React efficiently update the list when items are added, removed, or reordered.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between d5fbeeb and 278558e.

⛔ Files ignored due to path filters (2)
  • package-lock.json is excluded by !**/package-lock.json
  • public/covers/solana-sol-logo.png is excluded by !**/*.png
📒 Files selected for processing (8)
  • CHANGELOG.md (1 hunks)
  • package.json (1 hunks)
  • src/app/blockchain/page.tsx (1 hunks)
  • src/app/page.tsx (2 hunks)
  • src/components/BlockchainSection.tsx (1 hunks)
  • src/components/navbar/MobileNav.tsx (1 hunks)
  • src/components/navbar/Navbar.tsx (1 hunks)
  • src/data/blockchains.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • package.json
🧰 Additional context used
🪛 Markdownlint
CHANGELOG.md

4-4: Expected: h2; Actual: h3
Heading levels should only increment by one level at a time

(MD001, heading-increment)

🔇 Additional comments (7)
src/data/blockchains.ts (1)

1-6: LGTM: Well-structured interface for blockchain data.

The Blockchains interface is well-defined with clear and appropriate properties. It provides a good structure for representing blockchain data in the application.

src/components/BlockchainSection.tsx (2)

1-3: LGTM: Imports are appropriate and correctly structured.

The imports for Next.js Link, blockchains data, and the Card component are all relevant to the component's functionality.


5-5: LGTM: Component declaration follows React best practices.

The BlockchainsSection component is correctly declared as a default export function, following the PascalCase naming convention for React components.

src/app/blockchain/page.tsx (2)

1-10: LGTM: Imports and component declaration are correct.

The "use client" directive, imports, and component declaration are all properly implemented. The use of Next.js components (Link, Image) and custom components (Card) suggests good modularity.


54-58: LGTM: "No results" message rendering is well-implemented.

The conditional rendering for the "No results" message is correctly implemented and styled consistently with the rest of the component. This provides a good user experience when no blockchains match the search criteria.

src/app/page.tsx (2)

10-10: LGTM: Import statement for BlockchainSection

The import statement for BlockchainSection is correctly added and follows the existing pattern in the file. The use of the @ alias for the import path is consistent with other component imports.


63-65: LGTM: BlockchainSection component integration

The BlockchainSection component is well-integrated into the existing structure:

  • It follows the established pattern for section components.
  • The min-h-dvh class ensures consistent styling with other sections.
  • The id='blockchains' allows for direct navigation to this section.
  • Its placement between the DSA and Projects sections is logical.

This addition aligns well with the PR objectives to introduce a blockchain section to the website.

src/data/blockchains.ts Show resolved Hide resolved
src/components/navbar/Navbar.tsx Show resolved Hide resolved
src/components/BlockchainSection.tsx Show resolved Hide resolved
src/components/BlockchainSection.tsx Show resolved Hide resolved
src/app/blockchain/page.tsx Show resolved Hide resolved
@shivankurchavan
Copy link
Author

shivankurchavan commented Oct 7, 2024

should I write some description on how and why rust is used in blockchain??

here is some content :

Rust and Blockchain: A Deep Dive

Introduction to Blockchain

Blockchain technology is a decentralized ledger system that ensures transparency and security through cryptographic methods. It underpins cryptocurrencies and various decentralized applications (dApps), making it a revolutionary force in tech.

Why Rust for Blockchain?

Rust is increasingly becoming the language of choice for blockchain development due to several key features:

  • Memory Safety: Rust's ownership model prevents data races and ensures safe concurrent programming, which is crucial for building secure blockchain applications.
  • Performance: With performance comparable to C++, Rust enables high-throughput systems necessary for blockchain networks.
  • Concurrency: Rust’s design allows for efficient handling of multiple operations simultaneously, which is essential in blockchain environments.

Notable Blockchain Projects Using Rust

  • Solana
  • Polkadot
  • Parity Ethereum
  • Near Protocol

@shivankurchavan
Copy link
Author

shivankurchavan commented Oct 9, 2024

@Sam4613 hey, do you have discord link? Can you please share it ?

@shivankurchavan
Copy link
Author

Hi @FrancescoXX , please review the PR.
Also can you please add hacktoberfest tag to it 😅

Copy link

Hello! 👋

This pull request has been automatically marked as stale due to inactivity 😴

It will be closed in 180 days if no further activity occurs. To keep it active, please add a comment with more details.

@github-actions github-actions bot added the stale label Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Blockchain section
2 participants