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

230 blogs route #236

Closed
wants to merge 3 commits into from
Closed

230 blogs route #236

wants to merge 3 commits into from

Conversation

SureshPradhana
Copy link
Contributor

@SureshPradhana SureshPradhana commented Jul 31, 2024

#230

  • Create a route to list all blogs.
  • Add frontmatter support for tags, author information, and title slug in Markdown files.
  • Implement functionality to dynamically read and parse frontmatter data.
  • Implement dynamic display of tags, author information, and title slug on blog pages.

Summary by CodeRabbit

  • New Features

    • Added a comprehensive guide for new contributors on how to engage with open-source projects on GitHub.
    • Introduced a "Blogs" section in the navigation header for easier access to blog content.
    • Enabled a dedicated page for listing blog posts and dynamic routing for individual blog details.
    • Implemented a detailed blog post viewer with a table of contents for enhanced navigation and user experience.
  • Bug Fixes

    • Improved error handling and loading states in blog fetching components to enhance usability.
  • Documentation

    • Created new documentation on contributing to open source, providing clear steps and visual aids.

Copy link

vercel bot commented Jul 31, 2024

@SureshPradhana is attempting to deploy a commit to the devvsakib's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

coderabbitai bot commented Jul 31, 2024

Walkthrough

The recent changes introduce a new blogging feature to the application, allowing users to access, read, and navigate blog posts seamlessly. This includes components for listing blogs and displaying individual entries, along with enhancements to the header for easier navigation. The implementation utilizes React hooks for fetching Markdown content, ensuring a user-friendly experience with effective error handling and interactive elements.

Changes

Files Change Summary
public/blogposts/How_to_Contribute_to_Open_Source_on_GitHub_Forking_and_Making_Your_First_Pull_Request.md New guide on open-source contributions, detailing forking, cloning, branching, and making pull requests.
public/blogposts/index.json New JSON file for managing blog posts, facilitating future expansions.
src/components/Header/Header.jsx Added "Blogs" navigation item with an icon for improved access to the blog section.
src/main.jsx Introduced new routes for listing blogs (/blogs) and displaying individual blog details (/blogs/:slug), enhancing content organization.
src/pages/blogs/blog/index.jsx Created BlogDetail component to fetch and render blog content in Markdown format, including a dynamic table of contents and error handling.
src/pages/blogs/index.jsx Introduced BlogsList component to fetch and display a list of blog posts from JSON, complete with error handling and dynamic linking.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Header
    participant BlogsList
    participant BlogDetail
    participant API

    User->>Header: Click on Blogs
    Header->>BlogsList: Navigate to Blogs
    BlogsList->>API: Fetch blog posts
    API-->>BlogsList: Return blog posts
    BlogsList->>User: Display list of blog posts
    User->>BlogsList: Click on a blog post
    BlogsList->>BlogDetail: Navigate to BlogDetail
    BlogDetail->>API: Fetch blog content
    API-->>BlogDetail: Return blog content
    BlogDetail->>User: Display blog content
Loading

Poem

🐇 In the garden of code, we burrow and play,
With blogs now in bloom, brightening the way.
Forks and pull requests, oh what a delight!
A hop into open source, shining so bright!
Each click a new tale, each blog a new quest,
Join in the fun, it's the coder's best fest! 🌼


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

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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

@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: 3

Outside diff range, codebase verification and nitpick comments (2)
src/pages/blogs/index.jsx (1)

13-31: The endpoint /blogposts/index.json does not exist or is not correctly configured in the codebase.

  • The search for the endpoint definition returned no results other than the fetch reference in src/pages/blogs/index.jsx.

Please ensure that the endpoint is correctly set up and accessible.

Analysis chain

LGTM! Ensure the endpoint and error handling are correct.

The fetch operation in the useEffect hook is correctly implemented with proper error handling.

However, verify that the endpoint /blogposts/index.json exists and returns the expected data.


Let's correct the URL format in the curl command to properly verify the endpoint.


Let's search the codebase for the definition of the /blogposts/index.json endpoint to verify its existence and configuration.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence and correctness of the endpoint.

# Test: Check if the endpoint returns the expected data. Expect: Valid JSON data.
curl -sS '/blogposts/index.json' | jq

Length of output: 91


Script:

#!/bin/bash
# Description: Verify the existence and correctness of the endpoint.

# Test: Check if the endpoint returns the expected data. Expect: Valid JSON data.
curl -sS 'http://localhost:3000/blogposts/index.json' | jq

Length of output: 148


Script:

#!/bin/bash
# Description: Search for the definition of the `/blogposts/index.json` endpoint in the codebase.

# Use ripgrep to search for the endpoint definition.
rg '/blogposts/index.json'

Length of output: 123

public/blogposts/How_to_Contribute_to_Open_Source_on_GitHub_Forking_and_Making_Your_First_Pull_Request.md (1)

3-3: Consider strengthening the wording.

The phrase "is a great way to improve your coding skills" can be made more impactful by using a stronger verb.

- Contributing to open-source projects is a great way to improve your coding skills, collaborate with others, and give back to the community.
+ Contributing to open-source projects significantly enhances your coding skills, fosters collaboration with others, and allows you to give back to the community.
Tools
LanguageTool

[style] ~3-~3: Consider an alternative verb to strengthen your wording.
Context: ... open-source projects is a great way to improve your coding skills, collaborate with ot...

(IMPROVE_STRENGTHEN)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 41a62ef and 54f1825.

Files selected for processing (6)
  • public/blogposts/How_to_Contribute_to_Open_Source_on_GitHub_Forking_and_Making_Your_First_Pull_Request.md (1 hunks)
  • public/blogposts/index.json (1 hunks)
  • src/components/Header/Header.jsx (2 hunks)
  • src/main.jsx (2 hunks)
  • src/pages/blogs/blog/index.jsx (1 hunks)
  • src/pages/blogs/index.jsx (1 hunks)
Files skipped from review due to trivial changes (1)
  • public/blogposts/index.json
Additional context used
Biome
src/pages/blogs/index.jsx

[error] 45-45: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

src/pages/blogs/blog/index.jsx

[error] 57-57: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

LanguageTool
public/blogposts/How_to_Contribute_to_Open_Source_on_GitHub_Forking_and_Making_Your_First_Pull_Request.md

[style] ~3-~3: Consider an alternative verb to strengthen your wording.
Context: ... open-source projects is a great way to improve your coding skills, collaborate with ot...

(IMPROVE_STRENGTHEN)


[grammar] ~9-~9: The usual preposition to use with “corner” is “in”, not “on”. Did you mean “in the top right corner”?
Context: ...d a repository, click the "Fork" button at the top right corner of the repository page. This creates a ...

(ON_IN_THE_CORNER)


[grammar] ~81-~81: The word ‘help’ is a conjunction. In formal texts, use “to”.
Context: ...so don't hesitate to reach out for help and keep contributing. Happy coding!

(HELP_AND_VB)

Additional comments not posted (17)
src/main.jsx (2)

27-34: LGTM! Ensure consistency with the application's routing structure.

The new routes for listing blogs and displaying individual blog details are correctly defined.

However, verify that these routes are consistent with the overall routing structure of the application.

Verification successful

Routes are consistent with the application's routing structure.

The new routes for listing blogs and displaying individual blog details are correctly defined and consistent with the overall routing structure of the application.

  • Verified in src/main.jsx
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of the new routes with the application's routing structure.

# Test: Search for other route definitions. Expect: Routes should be consistent.
rg --type js -A 5 $'path: \'/blogs\''
rg --type js -A 5 $'path: \'/blogs/:slug\''

Length of output: 491


14-15: Verify import paths.

Ensure that the paths ./pages/blogs and ./pages/blogs/blog are correct and the components BlogsList and BlogDetail exist at those locations.

Verification successful

Verified import paths.

The paths ./pages/blogs and ./pages/blogs/blog are correct, and the components BlogsList and BlogDetail exist at those locations.

  • src/pages/blogs/index.jsx
  • src/pages/blogs/blog/index.jsx
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of the imported components.

# Test: Check if the files exist. Expect: Files should be present.
fd 'blogs/index.jsx'
fd 'blogs/blog.jsx'

Length of output: 40


Script:

#!/bin/bash
# Description: Verify the existence of the imported components by listing all files in the `pages/blogs` directory.

# List all files in the `pages/blogs` directory
fd . --glob 'pages/blogs/*'

Length of output: 130


Script:

#!/bin/bash
# Description: Verify the directory structure under `pages`.

# List all directories and files under `pages`
fd . --type d --type f --glob 'pages/**'

Length of output: 138


Script:

#!/bin/bash
# Description: List all files and directories in the repository to verify the existence of the imported components.

# List all files and directories in the repository
fd . --type d --type f

Length of output: 2865

src/pages/blogs/index.jsx (2)

35-37: LGTM! Ensure the rendering logic handles all states appropriately.

The rendering logic for loading, error, and blog list states looks good.

However, verify that the loading and error states are correctly handled in all scenarios.

Verification successful

Verified: The loading and error states are correctly managed and rendered in src/pages/blogs/index.jsx.

  • The loading state is set to true initially and reset to false after the fetch operation completes.
  • The error state is set if an error occurs during the fetch operation and is displayed appropriately.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the handling of loading and error states.

# Test: Simulate loading and error states. Expect: Correct rendering.
echo "Simulate loading state."
# Simulate loading state by delaying the fetch operation.
echo "Simulate error state."
# Simulate error state by providing an invalid endpoint.

Length of output: 109


Script:

#!/bin/bash
# Search for the loading and error state management in the src/pages/blogs/index.jsx file
rg 'loading|error' src/pages/blogs/index.jsx -A 5

Length of output: 1048


1-11: LGTM! Ensure the correctness of imports and initial state definitions.

The imports and initial state definitions in the BlogsList component look good.

However, verify that all imported modules exist and are correctly used.

Verification successful

Let's re-verify the existence of the imported files using rg to search for the actual file names within the repository.


Let's broaden our search using fd to check if the imported files exist anywhere in the repository.


Verified: The imported modules exist and are correctly used.

  • src/components/Layout/Layout.jsx
  • src/components/Common/MainTitle.jsx
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence and correctness of imported modules.

# Test: Check if the imported files exist. Expect: Files should be present.
fd 'components/Layout/Layout.jsx'
fd 'components/Common/MainTitle.jsx'

Length of output: 70


Script:

#!/bin/bash
# Description: Verify the existence and correctness of imported modules using ripgrep.

# Test: Check if the imported files exist. Expect: Files should be present.
rg 'Layout.jsx'
rg 'MainTitle.jsx'

Length of output: 34


Script:

#!/bin/bash
# Description: Verify the existence and correctness of imported modules using fd.

# Test: Check if the imported files exist. Expect: Files should be present.
fd 'Layout.jsx'
fd 'MainTitle.jsx'

Length of output: 103

src/components/Header/Header.jsx (2)

35-38: LGTM! Ensure consistency with other navigation items.

The new navigation item for "Blogs" is correctly defined and consistent with other items.

However, verify that the link and icon are correctly displayed in the navigation.

Verification successful

The "Blogs" navigation item and its icon are correctly implemented.

  • The "Blogs" navigation item is present in the Header component.
  • The FaBlogger icon is correctly imported from "react-icons/fa".
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the display of the new navigation item.

# Test: Check if the "Blogs" link and icon are correctly displayed. Expect: Navigation item should be present.
echo "Check the display of the 'Blogs' link and icon in the navigation."

Length of output: 146


Script:

#!/bin/bash
# Verify the presence of the "Blogs" navigation item in the Header component.
rg 'name: "Blogs"' -A 3 src/components/Header/Header.jsx

# Verify the import of the FaBlogger icon in the Header component.
rg 'import { FaBlogger }' src/components/Header/Header.jsx

Length of output: 319


Script:

#!/bin/bash
# Verify the import of the FaBlogger icon in the Header component.
rg 'import \{ FaBlogger \}' src/components/Header/Header.jsx

Length of output: 106


10-10: LGTM! Ensure the correctness of the import path.

The import statement for FaBlogger looks good.

However, verify that the icon is correctly imported and used.

Verification successful

The import statement for FaBlogger is correct and the icon is used appropriately in Header.jsx.

  • The react-icons package is correctly listed in package.json.
  • The FaBlogger icon is used in the Header.jsx file.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence and correctness of the imported icon.

# Test: Check if the icon is correctly imported. Expect: Icon should be present.
fd 'react-icons/fa'

Length of output: 19


Script:

#!/bin/bash
# Check if react-icons is listed in package.json
jq '.dependencies["react-icons"]' package.json

# Verify the usage of FaBlogger in Header.jsx
rg 'FaBlogger' src/components/Header/Header.jsx -A 5

Length of output: 501

public/blogposts/How_to_Contribute_to_Open_Source_on_GitHub_Forking_and_Making_Your_First_Pull_Request.md (5)

13-27: LGTM!

The instructions for cloning the forked repository are clear and well-structured.


29-35: LGTM!

The instructions for creating a new branch are clear and well-structured.


37-51: LGTM!

The instructions for making changes and committing them are clear and well-structured.


53-59: LGTM!

The instructions for pushing changes to GitHub are clear and well-structured.


81-81: Fix grammatical error.

The word 'help' is a conjunction. In formal texts, use "to".

- so don't hesitate to reach out for help and keep contributing.
+ so don't hesitate to reach out for help to keep contributing.

Likely invalid or redundant comment.

Tools
LanguageTool

[grammar] ~81-~81: The word ‘help’ is a conjunction. In formal texts, use “to”.
Context: ...so don't hesitate to reach out for help and keep contributing. Happy coding!

(HELP_AND_VB)

src/pages/blogs/blog/index.jsx (6)

1-8: LGTM!

The imports are necessary for the functionality of the component and are correctly included.


10-24: LGTM!

The table components are simple, reusable, and correctly defined.


72-81: LGTM!

The useEffect hook for scrolling to the active section is correctly defined.


83-85: LGTM!

The conditional rendering for loading and error states is correctly defined.


86-166: LGTM!

The main render logic of the BlogDetail component is well-structured and correctly defined.


169-169: LGTM!

The export statement for the BlogDetail component is correctly defined.


1. **Find a Project to Contribute To**: Browse GitHub to find a project you'd like to contribute to. Look for repositories with issues labeled "good first issue" or "help wanted".

2. **Fork the Repository**: Once you've found a repository, click the "Fork" button at the top right corner of the repository page. This creates a copy of the repository in your GitHub account.
Copy link

Choose a reason for hiding this comment

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

Fix grammatical error.

The usual preposition to use with "corner" is "in", not "on".

- click the "Fork" button at the top right corner of the repository page.
+ click the "Fork" button in the top right corner of the repository page.
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
2. **Fork the Repository**: Once you've found a repository, click the "Fork" button at the top right corner of the repository page. This creates a copy of the repository in your GitHub account.
2. **Fork the Repository**: Once you've found a repository, click the "Fork" button in the top right corner of the repository page. This creates a copy of the repository in your GitHub account.
Tools
LanguageTool

[grammar] ~9-~9: The usual preposition to use with “corner” is “in”, not “on”. Did you mean “in the top right corner”?
Context: ...d a repository, click the "Fork" button at the top right corner of the repository page. This creates a ...

(ON_IN_THE_CORNER)

Comment on lines 26 to 64
const BlogDetail = () => {
const { slug } = useParams();
const [content, setContent] = useState('');
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
const [activeSection, setActiveSection] = useState(null);
const [headings, setHeadings] = useState([]);

useEffect(() => {
const fetchContent = async () => {
try {
const response = await fetch(`/blogposts/${slug}.md`);
if (!response.ok) {
throw new Error(`Failed to fetch content: ${response.statusText}`);
}
const text = await response.text(); // Ensure you're reading text
setContent(text);
} catch (error) {
setError(error.message);
} finally {
setLoading(false);
}
};

fetchContent();
}, [slug]);

const extractHeadings = (markdown) => {
const headings = [];
const regex = /^#{1,6}\s+(.*)$/gm;
let match;
while ((match = regex.exec(markdown)) !== null) {
const level = match[0].split(' ')[0].length;
const title = match[1];
if (level > 3) continue;
headings.push({ level, title });
}
setHeadings(headings);
};
Copy link

Choose a reason for hiding this comment

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

Avoid assignment in expressions.

The assignment in the while loop condition is confusing and should be avoided.

- while ((match = regex.exec(markdown)) !== null) {
+ let match;
+ while ((match = regex.exec(markdown)) !== null) {
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 BlogDetail = () => {
const { slug } = useParams();
const [content, setContent] = useState('');
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
const [activeSection, setActiveSection] = useState(null);
const [headings, setHeadings] = useState([]);
useEffect(() => {
const fetchContent = async () => {
try {
const response = await fetch(`/blogposts/${slug}.md`);
if (!response.ok) {
throw new Error(`Failed to fetch content: ${response.statusText}`);
}
const text = await response.text(); // Ensure you're reading text
setContent(text);
} catch (error) {
setError(error.message);
} finally {
setLoading(false);
}
};
fetchContent();
}, [slug]);
const extractHeadings = (markdown) => {
const headings = [];
const regex = /^#{1,6}\s+(.*)$/gm;
let match;
while ((match = regex.exec(markdown)) !== null) {
const level = match[0].split(' ')[0].length;
const title = match[1];
if (level > 3) continue;
headings.push({ level, title });
}
setHeadings(headings);
};
const BlogDetail = () => {
const { slug } = useParams();
const [content, setContent] = useState('');
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
const [activeSection, setActiveSection] = useState(null);
const [headings, setHeadings] = useState([]);
useEffect(() => {
const fetchContent = async () => {
try {
const response = await fetch(`/blogposts/${slug}.md`);
if (!response.ok) {
throw new Error(`Failed to fetch content: ${response.statusText}`);
}
const text = await response.text(); // Ensure you're reading text
setContent(text);
} catch (error) {
setError(error.message);
} finally {
setLoading(false);
}
};
fetchContent();
}, [slug]);
const extractHeadings = (markdown) => {
const headings = [];
const regex = /^#{1,6}\s+(.*)$/gm;
let match;
while ((match = regex.exec(markdown)) !== null) {
const level = match[0].split(' ')[0].length;
const title = match[1];
if (level > 3) continue;
headings.push({ level, title });
}
setHeadings(headings);
};
Tools
Biome

[error] 57-57: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

Comment on lines +38 to +54
return (
<Layout>
<div className="container mx-auto p-4 min-h-screen">
<MainTitle highlight={'Blogs'} />
<ul className='grid gap-5 mx-auto md:max-w-2xl'>
{
docs.map(item =>
<Link to={item.title} className='capitalize group flex items-center justify-between bg-white/10 p-5 rounded-md'>{item.title.replace(/_/g, ' ')}
<FaArrowRight className="dark:text-white opacity-0 group-hover:opacity-100 -translate-x-10 group-hover:translate-x-0 transition duration-300" />
</Link>
)
}
</ul>
</div>
</Layout>
);
};
Copy link

Choose a reason for hiding this comment

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

Add a key property to list items.

Each list item should have a unique key to help React identify which items have changed.

- docs.map(item =>
-   <Link to={item.title} className='capitalize group flex items-center justify-between bg-white/10 p-5 rounded-md'>{item.title.replace(/_/g, ' ')}
+ docs.map((item, index) =>
+   <Link key={index} to={item.title} className='capitalize group flex items-center justify-between bg-white/10 p-5 rounded-md'>{item.title.replace(/_/g, ' ')}
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
return (
<Layout>
<div className="container mx-auto p-4 min-h-screen">
<MainTitle highlight={'Blogs'} />
<ul className='grid gap-5 mx-auto md:max-w-2xl'>
{
docs.map(item =>
<Link to={item.title} className='capitalize group flex items-center justify-between bg-white/10 p-5 rounded-md'>{item.title.replace(/_/g, ' ')}
<FaArrowRight className="dark:text-white opacity-0 group-hover:opacity-100 -translate-x-10 group-hover:translate-x-0 transition duration-300" />
</Link>
)
}
</ul>
</div>
</Layout>
);
};
return (
<Layout>
<div className="container mx-auto p-4 min-h-screen">
<MainTitle highlight={'Blogs'} />
<ul className='grid gap-5 mx-auto md:max-w-2xl'>
{
docs.map((item, index) =>
<Link key={index} to={item.title} className='capitalize group flex items-center justify-between bg-white/10 p-5 rounded-md'>{item.title.replace(/_/g, ' ')}
<FaArrowRight className="dark:text-white opacity-0 group-hover:opacity-100 -translate-x-10 group-hover:translate-x-0 transition duration-300" />
</Link>
)
}
</ul>
</div>
</Layout>
);
};
Tools
Biome

[error] 45-45: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

Copy link

vercel bot commented Jul 31, 2024

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

Name Status Preview Comments Updated (UTC)
github-error-solve ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 5, 2024 1:08am

Copy link

@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: 2

Outside diff range, codebase verification and nitpick comments (4)
public/blogposts/How_to_Contribute_to_Open_Source_on_GitHub_Forking_and_Making_Your_First_Pull_Request.md (2)

10-10: Consider strengthening the verb.

To enhance the impact of the sentence, consider using a stronger verb than "improve."

- Contributing to open-source projects is a great way to improve your coding skills, collaborate with others, and give back to the community.
+ Contributing to open-source projects is a great way to enhance your coding skills, collaborate with others, and give back to the community.
Tools
LanguageTool

[style] ~10-~10: Consider an alternative verb to strengthen your wording.
Context: ... open-source projects is a great way to improve your coding skills, collaborate with ot...

(IMPROVE_STRENGTHEN)


88-88: Use formal conjunction.

In formal texts, use "to" instead of "and" for better readability.

- so don't hesitate to reach out for help and keep contributing.
+ so don't hesitate to reach out for help to keep contributing.
Tools
LanguageTool

[grammar] ~88-~88: The word ‘help’ is a conjunction. In formal texts, use “to”.
Context: ...so don't hesitate to reach out for help and keep contributing. Happy coding!

(HELP_AND_VB)

src/pages/blogs/blog/index.jsx (2)

86-86: Improve loading state UI.

Consider adding a more descriptive loading message for better user experience.

- if (loading) return <div className="flex justify-center items-center h-screen"><Spin size="large" /></div>;
+ if (loading) return <div className="flex justify-center items-center h-screen"><Spin size="large" tip="Loading blog content..." /></div>;

87-87: Enhance error handling.

Provide a more detailed error message to help users understand the issue.

- if (error) return <Alert message="Error" description={error} type="error" />;
+ if (error) return <Alert message="Error" description={`Failed to load blog content: ${error}`} type="error" />;
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 54f1825 and 5ba4a0a.

Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
Files selected for processing (3)
  • package.json (1 hunks)
  • public/blogposts/How_to_Contribute_to_Open_Source_on_GitHub_Forking_and_Making_Your_First_Pull_Request.md (1 hunks)
  • src/pages/blogs/blog/index.jsx (1 hunks)
Additional context used
LanguageTool
public/blogposts/How_to_Contribute_to_Open_Source_on_GitHub_Forking_and_Making_Your_First_Pull_Request.md

[style] ~10-~10: Consider an alternative verb to strengthen your wording.
Context: ... open-source projects is a great way to improve your coding skills, collaborate with ot...

(IMPROVE_STRENGTHEN)


[grammar] ~16-~16: The usual preposition to use with “corner” is “in”, not “on”. Did you mean “in the top right corner”?
Context: ...d a repository, click the "Fork" button at the top right corner of the repository page. This creates a ...

(ON_IN_THE_CORNER)


[grammar] ~88-~88: The word ‘help’ is a conjunction. In formal texts, use “to”.
Context: ...so don't hesitate to reach out for help and keep contributing. Happy coding!

(HELP_AND_VB)

Biome
src/pages/blogs/blog/index.jsx

[error] 60-60: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

Additional comments not posted (4)
package.json (1)

19-19: Dependency addition approved.

The addition of the frontmatter dependency is appropriate for handling front matter in Markdown files.

public/blogposts/How_to_Contribute_to_Open_Source_on_GitHub_Forking_and_Making_Your_First_Pull_Request.md (1)

16-16: Fix grammatical error.

The usual preposition to use with "corner" is "in", not "on".

- click the "Fork" button at the top right corner of the repository page.
+ click the "Fork" button in the top right corner of the repository page.
Tools
LanguageTool

[grammar] ~16-~16: The usual preposition to use with “corner” is “in”, not “on”. Did you mean “in the top right corner”?
Context: ...d a repository, click the "Fork" button at the top right corner of the repository page. This creates a ...

(ON_IN_THE_CORNER)

src/pages/blogs/blog/index.jsx (2)

60-60: Avoid assignment in expressions.

The assignment in the while loop condition is confusing and should be avoided.

- while ((match = regex.exec(markdown)) !== null) {
+ let match;
+ while ((match = regex.exec(markdown)) !== null) {
Tools
Biome

[error] 60-60: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


1-1: Optimize import statement.

The frontmatter import should be a named import for better tree-shaking and readability.

- import * as matter from 'frontmatter'
+ import { parse } from 'frontmatter';

Likely invalid or redundant comment.

@@ -0,0 +1,88 @@
---
title: How to Contribute to Open Source on GitHub forking and Making Your First Pull Request
Copy link

Choose a reason for hiding this comment

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

Fix title capitalization.

The title should be properly capitalized for consistency and readability.

- title: How to Contribute to Open Source on GitHub forking and Making Your First Pull Request
+ title: How to Contribute to Open Source on GitHub Forking and Making Your First Pull Request
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
title: How to Contribute to Open Source on GitHub forking and Making Your First Pull Request
title: How to Contribute to Open Source on GitHub Forking and Making Your First Pull Request

<ReactMarkdown
remarkPlugins={[remarkGfm]}
components={{
code({ node, inline, className, children, ...props }) {
Copy link

Choose a reason for hiding this comment

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

Simplify code block rendering.

The code block rendering logic can be simplified for better readability.

- code({ node, inline, className, children, ...props }) {
-   const match = /language-(\w+)/.exec(className || '');
-   return !inline && match ? (
-       <SyntaxHighlighter
-           style={a11yDark}
-           language={match[1]}
-           PreTag="div"
-           {...props}
-       >
-           {String(children).replace(/\n$/, '')}
-       </SyntaxHighlighter>
-   ) : (
-       <code className={className} {...props}>
-           {children}
-       </code>
-   );
- },
+ code({ node, inline, className = '', children, ...props }) {
+   const match = /language-(\w+)/.exec(className);
+   return !inline && match ? (
+       <SyntaxHighlighter style={a11yDark} language={match[1]} PreTag="div" {...props}>
+           {String(children).replace(/\n$/, '')}
+       </SyntaxHighlighter>
+   ) : (
+       <code className={className} {...props}>
+           {children}
+       </code>
+   );
+ },
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
code({ node, inline, className, children, ...props }) {
code({ node, inline, className = '', children, ...props }) {
const match = /language-(\w+)/.exec(className);
return !inline && match ? (
<SyntaxHighlighter style={a11yDark} language={match[1]} PreTag="div" {...props}>
{String(children).replace(/\n$/, '')}
</SyntaxHighlighter>
) : (
<code className={className} {...props}>
{children}
</code>
);
},

Copy link

@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: CHILL

Commits

Files that changed from the base of the PR and between 5ba4a0a and 7ad7fea.

Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
Files selected for processing (3)
  • package.json (1 hunks)
  • src/components/Header/Header.jsx (2 hunks)
  • src/main.jsx (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • package.json
Additional comments not posted (4)
src/main.jsx (2)

15-16: LGTM! Imports are correctly added.

The new imports BlogsList and BlogDetail are correctly added and the paths are accurate.


30-37: LGTM! Routes are correctly added.

The new routes for blogs are correctly added and the components are correctly referenced.

src/components/Header/Header.jsx (2)

10-10: LGTM! Import is correctly added.

The new import FaBlogger is correctly added and the path is accurate.


35-39: LGTM! Navigation item is correctly added.

The new navigation item for blogs is correctly added and the properties are accurate.

@devvsakib
Copy link
Owner

There are an error.
image

and I don't think it makes much difference as our doc page has some content.

@SureshPradhana
Copy link
Contributor Author

Are you saying that the blogs route is redundant, or that the blog written there is the same as the one in the docs?

@SureshPradhana
Copy link
Contributor Author

image
It runs perfectly locally, so the problem might be due to differences in library handling or compatibility on Vercel.

@SureshPradhana SureshPradhana closed this by deleting the head repository Aug 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants