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

[Fix]: remove discord link #182

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

Conversation

vasu962
Copy link
Contributor

@vasu962 vasu962 commented Oct 11, 2024

fixes #177

Summary by CodeRabbit

Release Notes for Version 0.2.1

  • New Features

    • Introduced dark mode detection for a personalized user experience.
    • Added two new lessons on Rust programming to enhance educational content.
  • Improvements

    • Updated layout of tool cards for better responsiveness.
    • Enhanced Card component layout for improved presentation.
    • Streamlined navigation by removing the "People" section from the mobile and desktop navigation.
  • Bug Fixes

    • Resolved issues related to previous bug fixes referenced in the changelog.
  • Documentation

    • Updated CHANGELOG.md to reflect the new version and changes.

Copy link

vercel bot commented Oct 11, 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 11, 2024 11:55am

Copy link
Contributor

coderabbitai bot commented Oct 11, 2024

Walkthrough

The changes in this pull request involve updates to multiple files, primarily reflecting the release of version 0.2.1. This includes modifications to the CHANGELOG.md and package.json files to update the version number. Additionally, there are layout adjustments in the DevTools and Card components, the introduction of dark mode detection in the RootLayout, and the removal of the PeopleSection component across various files. The Footer and Navbar components were updated to enhance navigation, and new lessons were added to the educational content.

Changes

File Change Summary
CHANGELOG.md Updated to version 0.2.1, added bug fixes for issues #157 and #158.
package.json Updated version from "0.2.0" to "0.2.1".
src/app/devtools/page.tsx Modified grid layout for tool cards to improve responsiveness.
src/app/layout.tsx Added dark mode detection script to RootLayout.
src/app/page.tsx Removed the PeopleSection component from the Home function.
src/components/Card.tsx Restructured JSX layout and updated Link component to open in a new tab.
src/components/Footer.tsx Replaced anchor tags with Next.js Link components for social media links.
src/components/Header.tsx Simplified dark mode logic and added scroll event handling.
src/components/LessonSection.tsx Adjusted padding in Link and title elements for better layout.
src/components/PeopleSection.tsx Deleted the PeopleSection component.
src/components/navbar/MobileNav.tsx Removed "People" link from menuItems array.
src/components/navbar/Navbar.tsx Removed "People" link from menuItems and wrapped items in a <li> element.
src/data/lessons.ts Added two new lessons related to Rust programming.

Assessment against linked issues

Objective Addressed Explanation
Remove the Discord link (#177) The Discord link was not removed.

Possibly related PRs

  • Remove People Section #165: The removal of the PeopleSection component from the Home function in src/app/page.tsx is directly related to the changes in the main PR, which also references the removal of the PeopleSection component.

Poem

In the garden of code, we hop and play,
With updates and fixes brightening the day.
The PeopleSection has bid us goodbye,
While dark mode detection helps our eyes fly.
New lessons await, a treasure to find,
In this wondrous release, we're all intertwined! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between aac51af and 9cb7be8.

📒 Files selected for processing (1)
  • src/components/Card.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/Card.tsx

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

🧹 Outside diff range and nitpick comments (4)
src/components/Footer.tsx (1)

Discord link still present in Footer component

The Discord link has not been removed as intended in this PR. The following references were found in src/components/Footer.tsx:

  • Import Statement:
    import { FaLinkedin, FaYoutube, FaDiscord, FaInstagram } from "react-icons/fa";
  • Discord Icon Usage:
    <FaDiscord />

Please remove all instances of the Discord link to fulfill the PR objective.

🔗 Analysis chain

Line range hint 1-67: Summary: Social media links updated, but Discord link needs attention

The changes to update social media links from <a> tags to Next.js Link components are well-implemented and consistent throughout the file. This improves the routing capabilities of the application while maintaining functionality and styling.

However, the main objective of the PR, which is to remove the Discord link, has not been achieved. Instead, the Discord link was updated to use a Link component with an empty href. This needs to be addressed to fully meet the PR objective.

To ensure all instances of the Discord link are removed, please run the following script:

This script will help verify that all instances of the Discord link and related code have been removed from the Footer component and check for any other potential references in the codebase.


To address the issue with the previous shell script, please run the following corrected script to verify the removal of the Discord link:


To address the issues with the previous shell scripts, please execute the following corrected script to verify the removal of the Discord link:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining Discord link references in the codebase

# Search for Discord link in Footer.tsx
echo "Checking Footer.tsx for Discord link:"
rg --type typescript "Discord" src/components/Footer.tsx

# Search for Discord icon import
echo "\nChecking for Discord icon import:"
rg --type typescript "FaDiscord" src/components/Footer.tsx

# Search for any other Discord references in the codebase
echo "\nChecking for any other Discord references:"
rg --type typescript "Discord" src/

Length of output: 521


Script:

#!/bin/bash
# Description: Check for any remaining Discord link references in the codebase

# Search for Discord link in Footer.tsx
echo "Checking Footer.tsx for Discord link:"
rg --type tsx "Discord" src/components/Footer.tsx

# Search for Discord icon import
echo "\nChecking for Discord icon import:"
rg --type tsx "FaDiscord" src/components/Footer.tsx

# Search for any other Discord references in the codebase
echo "\nChecking for any other Discord references:"
rg --type tsx "Discord" src/

Length of output: 479


Script:

#!/bin/bash
# Description: Check for any remaining Discord link references in the codebase

# Search for Discord link in Footer.tsx
echo "Checking Footer.tsx for Discord link:"
rg "Discord" --glob "*.tsx" src/components/Footer.tsx

# Search for Discord icon import
echo "\nChecking for Discord icon import:"
rg "FaDiscord" --glob "*.tsx" src/components/Footer.tsx

# Search for any other Discord references in the codebase
echo "\nChecking for any other Discord references:"
rg "Discord" --glob "*.tsx" src/

Length of output: 771

src/components/Card.tsx (1)

Line range hint 1-85: Approve changes with a minor accessibility suggestion.

The overall changes to the Card component improve its layout and responsiveness while maintaining its core functionality. The cursor update feature is preserved, and the new layout should work well across different screen sizes.

To further enhance accessibility, consider adding an aria-label to the link to provide more context for screen readers. For example:

 <Link
   target="_blank"
   rel="noopener noreferrer"
   href={item.link}
   key={key}
+  aria-label={`Learn more about ${item.name ?? item.title}`}
   className="dark:bg-gray-900 group bg-gray-200 rounded-lg shadow-lg transition duration-300 hover:shadow-xl min-w-full toolsInnerCard"
 >

This addition will improve the experience for users relying on assistive technologies.

🧰 Tools
🪛 Biome

[error] 43-44: Expected a JSX Expression, a Element, or a text but instead found '<<<<<<'.

Expected a JSX Expression, a Element, or a text here.

(parse)


[error] 46-46: expected , but instead found src

Remove src

(parse)


[error] 46-46: expected , but instead found =

Remove =

(parse)


[error] 46-46: expected , but instead found item

Remove item

(parse)


[error] 46-46: expected , but instead found ??

Remove ??

(parse)


[error] 46-46: expected , but instead found item

Remove item

(parse)


[error] 46-46: expected , but instead found ??

Remove ??

(parse)


[error] 47-47: expected , but instead found alt

Remove alt

(parse)


[error] 47-47: expected , but instead found =

Remove =

(parse)


[error] 47-47: expected , but instead found item

Remove item

(parse)


[error] 47-47: expected , but instead found ??

Remove ??

(parse)


[error] 47-47: expected , but instead found item

Remove item

(parse)


[error] 47-47: expected , but instead found ??

Remove ??

(parse)


[error] 48-48: expected , but instead found width

Remove width

(parse)


[error] 48-48: expected , but instead found =

Remove =

(parse)


[error] 49-49: expected , but instead found height

Remove height

(parse)


[error] 49-49: expected , but instead found =

Remove =

(parse)


[error] 50-50: expected , but instead found className

Remove className

(parse)


[error] 50-50: expected , but instead found =

Remove =

(parse)


[error] 51-51: expected , but instead found /

Remove /

(parse)

src/app/layout.tsx (1)

17-25: LGTM! Consider adding a light mode fallback.

The dark mode detection script is well-implemented. It correctly checks both system preferences and local storage, applying and persisting the dark mode setting as needed.

For completeness, consider adding an else clause to explicitly set light mode when dark mode is not preferred:

 const initDarkModeDetection = `
 (function () {
 const isDarkModePreferred = window.matchMedia('(prefers-color-scheme: dark)').matches;
 const themeChosen = localStorage.theme;
 if ((!themeChosen && isDarkModePreferred) || themeChosen === "dark") {
   document.documentElement.classList.add("dark");
   localStorage.theme = 'dark';
+} else {
+  document.documentElement.classList.remove("dark");
+  localStorage.theme = 'light';
 }
 })()`;

This ensures that the theme is always explicitly set in local storage, which can be useful for consistency across page loads.

src/data/lessons.ts (1)

133-142: LGTM! Consider minor adjustment for consistency.

The new lesson entries are well-structured and consistent with the existing pattern. They add valuable content to the Rust programming curriculum.

For improved consistency with other entries, consider adding the "?si" parameter to the embed URL of the "Rust Lifetimes Explained Tutorial" lesson.

You may want to update line 141 as follows:

-    embed: "https://www.youtube.com/embed/S-SkEA4QWWE",
+    embed: "https://www.youtube.com/embed/S-SkEA4QWWE?si=S-SkEA4QWWE",
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

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

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (13)
  • CHANGELOG.md (1 hunks)
  • package.json (1 hunks)
  • src/app/devtools/page.tsx (1 hunks)
  • src/app/layout.tsx (1 hunks)
  • src/app/page.tsx (0 hunks)
  • src/components/Card.tsx (1 hunks)
  • src/components/Footer.tsx (1 hunks)
  • src/components/Header.tsx (3 hunks)
  • src/components/LessonSection.tsx (2 hunks)
  • src/components/PeopleSection.tsx (0 hunks)
  • src/components/navbar/MobileNav.tsx (0 hunks)
  • src/components/navbar/Navbar.tsx (1 hunks)
  • src/data/lessons.ts (1 hunks)
💤 Files with no reviewable changes (3)
  • src/app/page.tsx
  • src/components/PeopleSection.tsx
  • src/components/navbar/MobileNav.tsx
✅ Files skipped from review due to trivial changes (2)
  • CHANGELOG.md
  • package.json
🧰 Additional context used
🪛 Biome
src/app/layout.tsx

[error] 33-33: Avoid passing content using the dangerouslySetInnerHTML prop.

Setting content using code can expose users to cross-site scripting (XSS) attacks

(lint/security/noDangerouslySetInnerHtml)

src/components/Card.tsx

[error] 43-44: Expected a JSX Expression, a Element, or a text but instead found '<<<<<<'.

Expected a JSX Expression, a Element, or a text here.

(parse)


[error] 46-46: expected , but instead found src

Remove src

(parse)


[error] 46-46: expected , but instead found =

Remove =

(parse)


[error] 46-46: expected , but instead found item

Remove item

(parse)


[error] 46-46: expected , but instead found ??

Remove ??

(parse)


[error] 46-46: expected , but instead found item

Remove item

(parse)


[error] 46-46: expected , but instead found ??

Remove ??

(parse)


[error] 47-47: expected , but instead found alt

Remove alt

(parse)


[error] 47-47: expected , but instead found =

Remove =

(parse)


[error] 47-47: expected , but instead found item

Remove item

(parse)


[error] 47-47: expected , but instead found ??

Remove ??

(parse)


[error] 47-47: expected , but instead found item

Remove item

(parse)


[error] 47-47: expected , but instead found ??

Remove ??

(parse)


[error] 48-48: expected , but instead found width

Remove width

(parse)


[error] 48-48: expected , but instead found =

Remove =

(parse)


[error] 49-49: expected , but instead found height

Remove height

(parse)


[error] 49-49: expected , but instead found =

Remove =

(parse)


[error] 50-50: expected , but instead found className

Remove className

(parse)


[error] 50-50: expected , but instead found =

Remove =

(parse)


[error] 51-51: expected , but instead found /

Remove /

(parse)

🔇 Additional comments (16)
src/components/navbar/Navbar.tsx (2)

Line range hint 9-16: Removal of "People" entry from menuItems

The AI summary mentions the removal of a "People" entry from the menuItems array, which is not visible in the provided code diff but aligns with the PR objective to remove the Discord link.

This change successfully addresses the PR objective to remove the Discord link, which was likely associated with the "People" section.

Let's verify if there are any remaining references to the removed "People" section:

#!/bin/bash
# Search for any remaining references to the "People" section
rg -i 'people.*section' src/
rg -i 'discord.*link' src/

21-27: ⚠️ Potential issue

Structural change in navigation items rendering

The addition of an <li> wrapper around the mapped menuItems alters the structure of the rendered output. This change may affect the layout and styling of the navigation items.

Please ensure that this structural change doesn't negatively impact the navbar's appearance or functionality. Consider the following:

  1. Verify that the spacing between menu items is still correct with the new space-x-4 class on the wrapper <li>.
  2. Check if any existing CSS selectors need to be updated to account for this new structure.
  3. Test the navbar's responsiveness and appearance across different screen sizes to ensure the layout remains consistent.

Let's verify if there are any CSS rules that might be affected by this change:

src/components/LessonSection.tsx (4)

19-19: Approved: Increased bottom padding for lesson cards.

The change from p-6 to pb-12 increases the bottom padding of each lesson card. This modification creates more whitespace below the content, potentially improving the visual separation between elements.


31-31: Approved: Added horizontal padding to lesson titles.

The addition of px-2 to the className adds horizontal padding to the lesson titles. This change improves the visual layout by preventing the text from touching the edges of the card, enhancing readability.


Line range hint 1-53: Summary of changes in LessonSection.tsx

The modifications in this file enhance the visual layout of the lesson cards by adjusting padding. While these changes improve the component's appearance, they don't directly address the PR's main objective of removing a Discord link. Ensure that these changes are intentional and within the scope of the current PR.


Line range hint 1-53: Verify alignment with PR objectives.

While the changes in this file improve the layout of lesson cards, they don't appear to be directly related to the stated PR objective of removing a Discord link. Please confirm if these changes are intentional and part of the scope of this PR.

To ensure we're not missing any Discord-related content, let's run a quick check:

src/components/Footer.tsx (5)

11-13: LGTM: Twitter link updated to use Next.js Link component

The change from <a> to Link component for the Twitter link is appropriate. It enhances the routing capabilities of the application while maintaining the existing functionality and styling.


14-16: LGTM: LinkedIn link updated to use Next.js Link component

The LinkedIn link has been correctly updated to use the Next.js Link component. This change is consistent with the Twitter link update and maintains all necessary attributes and styling.


18-25: LGTM: YouTube link updated to use Next.js Link component

The YouTube link has been successfully updated to use the Next.js Link component. This change is consistent with the previous updates and maintains all necessary attributes and styling.


34-41: LGTM: Instagram link updated to use Next.js Link component

The Instagram link has been correctly updated to use the Next.js Link component. This change is consistent with the previous updates and maintains all necessary attributes and styling.


42-49: LGTM: Threads link updated to use Next.js Link component

The Threads link has been successfully updated to use the Next.js Link component. This change is consistent with the previous updates and maintains all necessary attributes and styling.

src/app/layout.tsx (2)

17-34: Summary: Dark mode detection implemented with minor security concern.

The changes successfully introduce dark mode detection functionality to the RootLayout component. The logic for detecting and applying dark mode is well-implemented. However, the method of injecting the script using dangerouslySetInnerHTML raises a minor security concern.

Overall, the functionality is a positive addition to the user experience. Addressing the script injection method will further improve the code quality and security of this implementation.

🧰 Tools
🪛 Biome

[error] 33-33: Avoid passing content using the dangerouslySetInnerHTML prop.

Setting content using code can expose users to cross-site scripting (XSS) attacks

(lint/security/noDangerouslySetInnerHtml)


30-34: ⚠️ Potential issue

Security: Avoid using dangerouslySetInnerHTML for script injection.

While the current implementation works, using dangerouslySetInnerHTML poses potential security risks and is generally discouraged.

Consider these safer alternatives:

  1. Use Next.js Script component:
import Script from 'next/script';

// In your component
<Script id="dark-mode-detection" strategy="beforeInteractive">
  {initDarkModeDetection}
</Script>
  1. Move the logic to a separate JavaScript file and import it:
import Script from 'next/script';

// In your component
<Script src="/scripts/darkModeDetection.js" strategy="beforeInteractive" />

Both options avoid the use of dangerouslySetInnerHTML while achieving the same functionality. The beforeInteractive strategy ensures the script runs as early as possible.

To ensure no other instances of dangerouslySetInnerHTML exist in the codebase, run:

✅ Verification successful

Verification Complete: No other instances of dangerouslySetInnerHTML found.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other instances of dangerouslySetInnerHTML
rg --type tsx --type jsx 'dangerouslySetInnerHTML'

Length of output: 78


Script:

#!/bin/bash
# Search for other instances of dangerouslySetInnerHTML in .tsx and .jsx files
rg 'dangerouslySetInnerHTML' -g '*.tsx' -g '*.jsx'

Length of output: 139

🧰 Tools
🪛 Biome

[error] 33-33: Avoid passing content using the dangerouslySetInnerHTML prop.

Setting content using code can expose users to cross-site scripting (XSS) attacks

(lint/security/noDangerouslySetInnerHtml)

src/components/Header.tsx (3)

Line range hint 20-28: Scroll handling implementation looks good

The new useEffect hook for handling scroll events is well-implemented. It correctly updates the isScrolled state and properly cleans up the event listener, following React best practices.


Line range hint 49-54: Improved header styling and responsiveness

The changes to the header's className enhance its visual appeal and responsiveness. The conditional styling based on the isScrolled state and the addition of responsive padding improve the user experience across different screen sizes and scroll positions.


61-61: Enhanced responsive design for the Link component

The addition of responsive text size adjustment (sm:text-base) and the use of hidden sm:block classes improve the Link component's adaptability across different screen sizes. This change enhances the overall responsive design of the header.

src/components/Footer.tsx Outdated Show resolved Hide resolved
src/components/Card.tsx Outdated Show resolved Hide resolved
src/components/Card.tsx Outdated Show resolved Hide resolved
src/components/Header.tsx Outdated Show resolved Hide resolved
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 17, 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.

REMOVe the discord link
1 participant