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

Merge the first commit please ignore the second one. Kindly add GSSOC24 label to it #656

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

ShoveetSingh
Copy link

Bugs fixed
Dragged and dropped the login.js file into pages folder.
Screenshot 2024-05-28 005026

Copy link

vercel bot commented May 27, 2024

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

Name Status Preview Comments Updated (UTC)
project-amupedia ❌ Failed (Inspect) May 27, 2024 7:46pm

Copy link

Thank you, @ShoveetSingh, for creating this pull request and contributing to GitHub-ReadMe! 💗

Our review team will thoroughly review the pull request and will reach out to you soon! 😇
Please make sure you have marked all the completed tasks as done. ✅
We appreciate your patience and contribution! 😀

Copy link

coderabbitai bot commented May 27, 2024

Walkthrough

Walkthrough

The changes introduce a new workflow for deploying a Next.js site to GitHub Pages, update various components to improve data handling and UI, and enhance backend functionality with new API endpoints and database schema adjustments. The updates also include minor styling changes and version upgrades for dependencies.

Changes

File/Directory Summary
.github/workflows/nextjs.yml Added a workflow for building and deploying a Next.js site to GitHub Pages.
components/Blogs/BlogCard.js Modified destructured props and image handling.
components/Opportunities/oppCard.js Changed destructuring from props to data and adjusted image and title rendering.
components/common/Header/Header.js Added an extra space in the code.
components/common/Navbar.js Imported FaKey and added a new list item with a key icon linking to /Login.
db/models/Blog.js Updated blogSchema to include like and numberOfComments fields.
db/models/BlogComment.js Introduced a Mongoose schema for blog comments.
package.json Updated dependency versions: @fortawesome/react-fontawesome, @types/webidl-conversions, next.
pages/Login.js Added a link to the Signup page.
pages/Signup.js Introduced a Signup component.
pages/_app.js Modified import statements and added script imports, meta tags, and components.
pages/adFix.js Added functionality to adjust body padding based on Google ad status.
pages/api/blogs/comments/fetchComments.js Implemented an API endpoint to fetch blog comments.
pages/api/blogs/comments/publishComment.js Implemented a POST endpoint for publishing blog comments.
pages/api/blogs/fetchBlogs.js Implemented an API endpoint to fetch blog data.
pages/api/blogs/publishBlog.js Added default values for like and numberOfComments fields.
pages/api/opportunities/publishOpportunity.js Reformatting and rearranging code without functional changes.
pages/blog/[blogId].js Refactored component structure and data handling, added comment submission functionality.
pages/blog/index.js Switched to fetching blog data from an API using getStaticProps.
styles/BlogDetail.module.css Adjusted styling properties and added new rules for comment section components.

Poem

In the land of code where changes flow,
Next.js sites to Pages now will go.
Blog cards shine with images bright,
Opportunities' data handled just right.
Comments and likes in schema we see,
New endpoints bring functionality.
With updates and tweaks, our project grows,
A rabbit's touch, in every line it shows.


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.

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 full the 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 help to get help.

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

CodeRabbit Configration 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: 13

Outside diff range and nitpick comments (8)
components/Opportunities/oppCard.js (1)

Line range hint 5-25: Refactor the component for clarity and correct HTML element usage.

The destructuring from data.data can be confusing. Consider renaming the parameter for clarity. Also, use the correct HTML img tag instead of image.

- const OppCard = (data) => {
-   const { title, date, image } = data.data;
+ const OppCard = ({ data }) => {
+   const { title, date, image } = data;
- <image src={`/images/oppCard/${image}`} />
+ <img src={`/images/oppCard/${image}`} alt={title} />
components/common/Header/Header.js (1)

Line range hint 27-27: Use self-closing tags for elements without children and avoid using index as key in lists.

- <IconContainer key={idx} iconConfig={iconItem}></IconContainer>
+ <IconContainer key={iconItem.id} iconConfig={iconItem} />
components/Blogs/BlogCard.js (1)

Line range hint 3-31: Resolve merge conflicts in the file.

- <<<<<<< HEAD:components/Blogs/BlogCard.js
- import dataScienceImg from "@images/blog/dataScience.webp";
- =======
- >>>>>>> 2e3ced3f1a6c1a70341b50aee0bde119b118a150:components/BlogCard.js
+ import dataScienceImg from "@images/blog/dataScience.webp";
pages/blog/index.js (1)

Line range hint 6-87: Resolve merge conflicts and correct the export statements in the file.

- <<<<<<< HEAD
- import blogData from "/data/blogdata";
- =======
- >>>>>>> 2e3ced3f1a6c1a70341b50aee0bde119b118a150
+ import blogData from "/data/blogdata";
- export default function Blogs()
+ export const getStaticProps = async () => {
+   const res = await fetch('http://localhost:3000/api/blogs/fetchBlogs');
+   const blogsData = await res.json();
+   return {
+     props: { blogsData }
+   }
+ }
+ export default function Blogs({ blogsData }) {
pages/Login.js (3)

13-13: Add a comment explaining the purpose of this import.

Consider adding a comment above the import statement to explain why Link from 'next/link' is being imported, especially if it's for navigation purposes which might not be immediately obvious.


Line range hint 49-49: Mark JSX elements without children as self-closing.

- <div className={styles.overlay} onClick={closeLoginPanel}></div>
+ <div className={styles.overlay} onClick={closeLoginPanel} />

- <div className={styles.logo}>
-   <Image loading="lazy" src={logo} alt="Amupedia Logo"></Image>
- </div>
+ <div className={styles.logo}>
+   <Image loading="lazy" src={logo} alt="Amupedia Logo" />
+ </div>

- <div id="googleSignIn" className={styles.googleSignIn}></div>
+ <div id="googleSignIn" className={styles.googleSignIn} />

This change makes the code cleaner and more in line with JSX best practices.

Also applies to: 52-52, 54-54


Line range hint 49-49: Add keyboard accessibility for clickable elements.

- <div className={styles.overlay} onClick={closeLoginPanel}></div>
+ <div className={styles.overlay} onClick={closeLoginPanel} onKeyUp={closeLoginPanel} tabIndex="0"></div>

This modification enhances accessibility by allowing keyboard-only users to interact with the clickable overlay.

components/common/Navbar.js (1)

6-6: Document the purpose of importing FaKey.

Consider adding a comment above the import statement to explain the use of FaKey from 'react-icons/fa', especially if it's for a specific feature like a login icon which might not be immediately obvious.

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 63c5ff4 and 7874a53.
Files ignored due to path filters (1)
  • public/images/blog/test.png is excluded by !**/*.png
Files selected for processing (20)
  • .github/workflows/nextjs.yml (1 hunks)
  • components/Blogs/BlogCard.js (2 hunks)
  • components/Opportunities/oppCard.js (1 hunks)
  • components/common/Header/Header.js (1 hunks)
  • components/common/Navbar.js (2 hunks)
  • db/models/Blog.js (1 hunks)
  • db/models/BlogComment.js (1 hunks)
  • package.json (1 hunks)
  • pages/Login.js (2 hunks)
  • pages/Signup.js (1 hunks)
  • pages/_app.js (3 hunks)
  • pages/adFix.js (1 hunks)
  • pages/api/blogs/comments/fetchComments.js (1 hunks)
  • pages/api/blogs/comments/publishComment.js (1 hunks)
  • pages/api/blogs/fetchBlogs.js (1 hunks)
  • pages/api/blogs/publishBlog.js (1 hunks)
  • pages/api/opportunities/publishOpportunity.js (1 hunks)
  • pages/blog/[blogId].js (6 hunks)
  • pages/blog/index.js (4 hunks)
  • styles/BlogDetail.module.css (2 hunks)
Files skipped from review due to trivial changes (4)
  • pages/Signup.js
  • pages/api/blogs/publishBlog.js
  • pages/api/opportunities/publishOpportunity.js
  • styles/BlogDetail.module.css
Additional Context Used
Biome (127)
components/Blogs/BlogCard.js (20)

2-3: Expected a statement but instead found '<<<<<<< HEAD:components/Blogs/BlogCard.js'.


4-6: Expected a statement but instead found '=======

2e3ced3:components/BlogCard.js'.


6-6: numbers cannot be followed by identifiers directly after


10-11: Expected a statement but instead found '<<<<<<< HEAD:components/Blogs/BlogCard.js'.


12-13: Expected a statement but instead found '======='.


14-15: Expected a statement but instead found '>>>>>>> 2e3ced3:components/BlogCard.js'.


15-15: numbers cannot be followed by identifiers directly after


23-24: Expected a JSX Expression, a Element, or a text but instead found '<<<<<<'.


24-24: expected > but instead found Blogs


30-31: Unexpected token. Did you mean {'>'} or &gt;?


31-31: Unexpected token. Did you mean {'>'} or &gt;?


31-31: Unexpected token. Did you mean {'>'} or &gt;?


31-31: Unexpected token. Did you mean {'>'} or &gt;?


31-31: Unexpected token. Did you mean {'>'} or &gt;?


31-31: Unexpected token. Did you mean {'>'} or &gt;?


31-31: Unexpected token. Did you mean {'>'} or &gt;?


19-19: Use === instead of ==.
== is only allowed when comparing against null


14-14: Shouldn't redeclare 'id'. Consider to delete it or rename it.


14-14: Shouldn't redeclare 'title'. Consider to delete it or rename it.


14-14: Shouldn't redeclare 'image'. Consider to delete it or rename it.

components/Opportunities/oppCard.js (1)

18-18: Provide a href attribute for the a element.

components/common/Header/Header.js (2)

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


27-27: Avoid using the index of an array as key property in an element.

components/common/Navbar.js (17)

103-109: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.


113-125: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.


113-125: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event.


139-144: Use a button element instead of an a element.


173-178: Use a button element instead of an a element.


189-195: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event.


197-204: Use a button element instead of an a element.


221-221: Use a button element instead of an a element.


231-231: Use a button element instead of an a element.


241-241: Use a button element instead of an a element.


251-251: Use a button element instead of an a element.


272-278: Use a button element instead of an a element.


311-317: Use a button element instead of an a element.


336-342: Use a button element instead of an a element.


357-364: Use a button element instead of an a element.


374-374: Use a button element instead of an a element.


108-108: Avoid passing content using the dangerouslySetInnerHTML prop.

package.json (20)

13-14: unexpected character <


14-14: unexpected character <


14-14: unexpected character <


14-14: unexpected character <


14-14: unexpected character <


14-14: unexpected character <


14-14: unexpected character <


14-14: String values must be double quoted.


15-15: End of file expected


15-15: End of file expected


15-15: End of file expected


15-15: End of file expected


16-16: End of file expected


16-16: End of file expected


16-16: End of file expected


16-17: End of file expected


16-17: unexpected character =


17-17: unexpected character =


17-17: unexpected character =


17-17: unexpected character =

pages/Login.js (6)

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


49-49: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event.


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


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


101-101: Provide a href attribute for the a element.


98-98: Provide an explicit type prop for the button element.

pages/_app.js (20)

1-1: Expected a statement but instead found '<<<<<<< HEAD'.


3-4: Expected a statement but instead found '======='.


6-7: Expected a statement but instead found '>>>>>>> 2e3ced3'.


7-7: numbers cannot be followed by identifiers directly after


102-103: Expected a JSX Expression, a Element, or a text but instead found '<<<<<<'.


105-105: expected > but instead found <


103-103: Expected corresponding JSX closing tag for 'HEAD'.


97-97: Expected corresponding JSX closing tag for 'Head'.


84-96: Expected corresponding JSX closing tag for 'motion.div'.


80-80: Expected corresponding JSX closing tag for 'StoreProvider'.


191-191: expected ) but instead found styles


191-191: Expected a property, a shorthand property, a getter, a setter, or a method but instead found '{ position'.


191-191: expected , but instead found :


191-193: Expected a statement but instead found '>

<Component'.


193-193: Expected an expression but instead found '...pageProps'.


193-202: Expected a statement but instead found '>
<Script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6172950963478417" crossOrigin="anonymous" ></Script>

</motion.div>

)'.


202-204: Expected a statement but instead found '>>>>>>> 2e3ced3
}'.


203-203: numbers cannot be followed by identifiers directly after


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


146-150: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.

pages/api/blogs/comments/publishComment.js (1)

19-19: Template literals are preferred over string concatenation.

pages/blog/[blogId].js (20)

13-14: Expected a statement but instead found '<<<<<<< HEAD'.


30-31: Expected a statement but instead found '======='.


31-32: Illegal use of an import declaration not at the top level


32-33: Illegal use of an import declaration not at the top level


34-35: Illegal use of an import declaration not at the top level


63-64: Expected a statement but instead found '>>>>>>> 2e3ced3'.


64-64: numbers cannot be followed by identifiers directly after


69-70: Expected a JSX Expression, a Element, or a text but instead found '<<<<<<'.


71-71: expected > but instead found <


70-70: Expected corresponding JSX closing tag for 'HEAD'.


73-74: Unexpected token. Did you mean {'>'} or &gt;?


74-74: Unexpected token. Did you mean {'>'} or &gt;?


74-74: Unexpected token. Did you mean {'>'} or &gt;?


74-74: Unexpected token. Did you mean {'>'} or &gt;?


74-74: Unexpected token. Did you mean {'>'} or &gt;?


74-74: Unexpected token. Did you mean {'>'} or &gt;?


74-74: Unexpected token. Did you mean {'>'} or &gt;?


136-137: Expected a JSX Expression, a Element, or a text but instead found '<<<<<<'.


138-138: expected > but instead found <


137-137: Expected corresponding JSX closing tag for 'HEAD'.

pages/blog/index.js (20)

5-6: Expected a statement but instead found '<<<<<<< HEAD'.


22-23: Expected a statement but instead found '======='.


25-33: Illegal use of an export declaration not at the top level


35-36: Expected a statement but instead found '>>>>>>> 2e3ced3'.


36-36: numbers cannot be followed by identifiers directly after


57-58: Expected a JSX Expression, a Element, or a text but instead found '<<<<<<'.


59-59: expected ... but instead found filteredBlogData


74-74: expected > but instead found <


58-73: Expected corresponding JSX closing tag for 'HEAD'.


34-91: Illegal use of an export declaration not at the top level


86-87: Unexpected token. Did you mean {'>'} or &gt;?


87-87: Unexpected token. Did you mean {'>'} or &gt;?


87-87: Unexpected token. Did you mean {'>'} or &gt;?


87-87: Unexpected token. Did you mean {'>'} or &gt;?


87-87: Unexpected token. Did you mean {'>'} or &gt;?


87-87: Unexpected token. Did you mean {'>'} or &gt;?


87-87: Unexpected token. Did you mean {'>'} or &gt;?


91-91: expected } but instead the file ends


13-91: Illegal duplicate default export declarations


58-74: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.

Additional comments not posted (8)
db/models/BlogComment.js (2)

3-18: Schema definition looks good.

The blogCommentSchema is well-defined with appropriate data types and required constraints. Good job ensuring data integrity with these settings.


21-22: Model export is correctly implemented.

The conditional check to avoid redefining the model if it already exists is a good practice in Mongoose applications.

pages/api/blogs/fetchBlogs.js (1)

6-16: API handler function is well-implemented.

The function correctly handles database connections, data fetching, and error responses. Good use of async/await for asynchronous operations.

db/models/Blog.js (1)

19-26: Added fields in the schema are correctly defined.

The fields like and numberOfComments are well-defined with appropriate data types and required constraints. This ensures that every blog entry will have these fields initialized properly.

pages/api/blogs/comments/fetchComments.js (1)

6-16: API handler function for fetching comments is well-implemented.

The function correctly handles database connections, comment fetching, and error responses. Good use of async/await for asynchronous operations.

pages/api/blogs/comments/publishComment.js (1)

8-10: Database connection and data extraction are handled appropriately.

Also applies to: 21-21

components/common/Header/Header.js (1)

Line range hint 8-26: The rest of the component structure and logic appear sound.

.github/workflows/nextjs.yml (1)

1-94: The GitHub Actions workflow is well-configured for building and deploying the Next.js site.

}
}, 0);

console.log("Testing");
Copy link

Choose a reason for hiding this comment

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

Remove debugging code from production.

The console.log("Testing"); appears to be a debugging statement. It's a good practice to remove such statements from production code to clean up the output and improve performance.

- console.log("Testing");

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.

Suggested change
console.log("Testing");

@@ -95,6 +96,10 @@ const Login = () => {
<span>Forgot Password ?</span>
</label>
<button>Sign In</button>
Copy link

Choose a reason for hiding this comment

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

Specify the type of the button for better accessibility and validation.

- <button>Sign In</button>
+ <button type="submit">Sign In</button>

Explicitly setting the type of the button to "submit" clarifies its function within a form, improving both accessibility and form behavior.


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.

Suggested change
<button>Sign In</button>
<button type="submit">Sign In</button>

@@ -95,6 +96,10 @@
<span>Forgot Password ?</span>
</label>
<button>Sign In</button>
<h1 className="font-bold text-lg p-4">Or</h1>
<Link href='/Signup'>
<a className="font-sans text-sm font-bold text-white hover:italic bg-gradient-to-r from-indigo-800 to-purple-600 rounded-md px-24 py-1">Signup</a>
Copy link

Choose a reason for hiding this comment

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

Correct the anchor tag to include a href attribute.

- <a className="font-sans text-sm  font-bold text-white hover:italic bg-gradient-to-r from-indigo-800 to-purple-600 rounded-md px-24 py-1">Signup</a>
+ <a href="/Signup" className="font-sans text-sm  font-bold text-white hover:italic bg-gradient-to-r from-indigo-800 to-purple-600 rounded-md px-24 py-1">Signup</a>

This fix ensures that the anchor tag correctly uses the href attribute, which is necessary for proper navigation and SEO.


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.

Suggested change
<a className="font-sans text-sm font-bold text-white hover:italic bg-gradient-to-r from-indigo-800 to-purple-600 rounded-md px-24 py-1">Signup</a>
<a href="/Signup" className="font-sans text-sm font-bold text-white hover:italic bg-gradient-to-r from-indigo-800 to-purple-600 rounded-md px-24 py-1">Signup</a>

Comment on lines +4 to +10
setInterval(() => {
if (googleAd.getAttribute("data-anchor-status") === "displayed") {
body.style.paddingTop = "100px";
} else if (googleAd.getAttribute("data-anchor-status") === "dismissed") {
body.style.paddingTop = "0";
}
}, 0);
Copy link

Choose a reason for hiding this comment

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

Consider increasing the interval of setInterval.

Using a 0ms interval can lead to high CPU usage as the function runs as fast as possible. Consider setting this to a more reasonable value, such as 100ms, to reduce the load on the client's machine.

- setInterval(() => {
+ setInterval(() => {
}, 0);
+ }, 100);

Committable suggestion was skipped due low confidence.

Comment on lines +99 to +102
<h1 className="font-bold text-lg p-4">Or</h1>
<Link href='/Signup'>
<a className="font-sans text-sm font-bold text-white hover:italic bg-gradient-to-r from-indigo-800 to-purple-600 rounded-md px-24 py-1">Signup</a>
</Link>
Copy link

Choose a reason for hiding this comment

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

Ensure consistent styling for the "Or" separator.

- <h1 className="font-bold text-lg p-4">Or</h1>
+ <p className={styles.or}>Or</p>

This change ensures that the styling for the "Or" text is consistent throughout the application, using the styles defined in login.module.scss.


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.

Suggested change
<h1 className="font-bold text-lg p-4">Or</h1>
<Link href='/Signup'>
<a className="font-sans text-sm font-bold text-white hover:italic bg-gradient-to-r from-indigo-800 to-purple-600 rounded-md px-24 py-1">Signup</a>
</Link>
<p className={styles.or}>Or</p>
<Link href='/Signup'>
<a className="font-sans text-sm font-bold text-white hover:italic bg-gradient-to-r from-indigo-800 to-purple-600 rounded-md px-24 py-1">Signup</a>
</Link>

await db.disconnect();
res.status(200).json({ success: true, result: result });
} catch (error) {
res.status(500).json({ success: false, error });
Copy link

Choose a reason for hiding this comment

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

Consider logging the error for easier debugging.

- res.status(500).json({ success: false, error });
+ console.error(error);
+ res.status(500).json({ success: false, error: error.message });

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.

Suggested change
res.status(500).json({ success: false, error });
console.error(error);
res.status(500).json({ success: false, error: error.message });

Comment on lines +11 to +19
const dd = String(today.getDate()).padStart(2, '0');
const mm = String(today.getMonth() + 1).padStart(2, '0');
const yyyy = today.getFullYear();
console.log(data);
const result = await BlogComment.create({
userName: req.body.userName,
blogId: req.body.blogId,
message: req.body.message,
date: mm + '/' + dd + '/' + yyyy,
Copy link

Choose a reason for hiding this comment

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

Consider using template literals for date formatting to enhance readability.

- date: mm + '/' + dd + '/' + yyyy,
+ date: `${mm}/${dd}/${yyyy}`,

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.

Suggested change
const dd = String(today.getDate()).padStart(2, '0');
const mm = String(today.getMonth() + 1).padStart(2, '0');
const yyyy = today.getFullYear();
console.log(data);
const result = await BlogComment.create({
userName: req.body.userName,
blogId: req.body.blogId,
message: req.body.message,
date: mm + '/' + dd + '/' + yyyy,
const dd = String(today.getDate()).padStart(2, '0');
const mm = String(today.getMonth() + 1).padStart(2, '0');
const yyyy = today.getFullYear();
console.log(data);
const result = await BlogComment.create({
userName: req.body.userName,
blogId: req.body.blogId,
message: req.body.message,
date: `${mm}/${dd}/${yyyy}`,

package.json Outdated
Comment on lines 14 to 20
<<<<<<< HEAD
"@fortawesome/react-fontawesome": "^0.2.0",
"aos": "^2.3.4",
=======
"@fortawesome/react-fontawesome": "^0.1.16",
"@types/webidl-conversions": "^7.0.0",
>>>>>>> 2e3ced3f1a6c1a70341b50aee0bde119b118a150
Copy link

Choose a reason for hiding this comment

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

Resolve merge conflicts in the dependency list.

- <<<<<<< HEAD
- @fortawesome/react-fontawesome": "^0.2.0",
- "aos": "^2.3.4",
- =======
- @fortawesome/react-fontawesome": "^0.1.16",
- @types/webidl-conversions": "^7.0.0",
- >>>>>>> 2e3ced3f1a6c1a70341b50aee0bde119b118a150
+ "@fortawesome/react-fontawesome": "^0.2.0",
+ "aos": "^2.3.4",
+ "@types/webidl-conversions": "^7.0.0",

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.

Suggested change
<<<<<<< HEAD
"@fortawesome/react-fontawesome": "^0.2.0",
"aos": "^2.3.4",
=======
"@fortawesome/react-fontawesome": "^0.1.16",
"@types/webidl-conversions": "^7.0.0",
>>>>>>> 2e3ced3f1a6c1a70341b50aee0bde119b118a150
"@fortawesome/react-fontawesome": "^0.2.0",
"aos": "^2.3.4",
"@types/webidl-conversions": "^7.0.0",

Comment on lines 13 to +14
import { faEllipsisH } from "node_modules/@fortawesome/free-solid-svg-icons/index";
<<<<<<< HEAD
Copy link

Choose a reason for hiding this comment

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

Resolve syntax errors and remove merge conflict artifacts.

- <<<<<<< HEAD
- =======
- >>>>>>> 2e3ced3f1a6c1a70341b50aee0bde119b118a150
- <HEAD
- <meta
- </HEAD
- {blogData.map((blogItem) => (
- key={blogItem.id}
- id={blogItem.id}
- image={blogItem.image
- comments={blogItem.comments}
- likes={blogItem.likes}
- class="hover:shadow-2xl hover:scale-150"
- =======
- key={blogItem.userId}
- id={index}
- title={blogItem.title}
- image={blogItem.coverImg}
- comments={blogItem.numberOfComments}
- likes={blogItem.like}
- >>>>>>> 2e3ced3f1a6c1a70341b50aee0bde119b118a150
+ // Properly close JSX tags and remove conflict markers

This change cleans up the file by removing merge conflict markers and correcting JSX syntax errors, ensuring the file is syntactically correct.

Also applies to: 30-31, 31-32, 32-33, 34-35, 63-64, 64-64, 69-70, 71-71, 70-70, 73-74, 74-74, 74-74, 74-74, 74-74, 74-74, 74-74, 136-137, 138-138, 137-137

Committable suggestion was skipped due low confidence.

Comment on lines +372 to +379
<li>
<a
onClick={() => router.push('/Login')}
className="flex py-2 px-2 text-white hover:bg-sky-400 hover:text-black rounded-lg transition duration-500"
>
<FaKey />
</a>
</li>
Copy link

Choose a reason for hiding this comment

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

Ensure accessibility by replacing the anchor tag with a button.

- <a onClick={() => router.push('/Login')} className="flex py-2 px-2 text-white hover:bg-sky-400 hover:text-black rounded-lg transition duration-500">
-   <FaKey />
- </a>
+ <button onClick={() => router.push('/Login')} className="flex py-2 px-2 text-white hover:bg-sky-400 hover:text-black rounded-lg transition duration-500">
+   <FaKey />
+ </button>

This change improves accessibility by using a button element for actions, which is more semantically correct than using an a tag.


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.

Suggested change
<li>
<a
onClick={() => router.push('/Login')}
className="flex py-2 px-2 text-white hover:bg-sky-400 hover:text-black rounded-lg transition duration-500"
>
<FaKey />
</a>
</li>
<li>
<button
onClick={() => router.push('/Login')}
className="flex py-2 px-2 text-white hover:bg-sky-400 hover:text-black rounded-lg transition duration-500"
>
<FaKey />
</button>
</li>

@ShoveetSingh ShoveetSingh changed the title Server connected with frontend! dont merge this one is incorrect May 27, 2024
@ShoveetSingh ShoveetSingh changed the title dont merge this one is incorrect dont merge the first commit it is incorrect May 27, 2024
@ShoveetSingh ShoveetSingh changed the title dont merge the first commit it is incorrect dont merge the first commit it is incorrect. Merge the second one May 27, 2024
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: 5

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 7874a53 and 352d2b3.
Files selected for processing (2)
  • package.json (1 hunks)
  • pages/_app.js (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • package.json
Additional Context Used
Biome (4)
pages/_app.js (4)

102-106: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.


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


135-139: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.


128-128: Avoid passing content using the dangerouslySetInnerHTML prop.

<meta property="og:url" content="https://www.amupedia.com" />
<script
type="application/ld+json"
dangerouslySetInnerHTML={addProductJsonLd()}
Copy link

Choose a reason for hiding this comment

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

Avoid using dangerouslySetInnerHTML due to potential security risks.

Consider using safer alternatives to inject JSON-LD structured data, such as serializing the JSON object directly into the script tag.

Comment on lines +102 to +106
<script
src="https://accounts.google.com/gsi/client"
async
defer
></script>
Copy link

Choose a reason for hiding this comment

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

JSX elements without children should be self-closing.

- <script src="https://accounts.google.com/gsi/client" async defer></script>
+ <script src="https://accounts.google.com/gsi/client" async defer />

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.

Suggested change
<script
src="https://accounts.google.com/gsi/client"
async
defer
></script>
<script
src="https://accounts.google.com/gsi/client"
async
defer
/>

Comment on lines +1 to +5

import Navbar from "@comp/common/Navbar";
import jwt from "jsonwebtoken";
//import Navbar from "@comp/Navbar";
// import jwt from "jsonwebtoken";
Copy link

Choose a reason for hiding this comment

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

Remove commented-out imports to clean up the code.

- //import Navbar from "@comp/Navbar";
- // import jwt from "jsonwebtoken";

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.

Suggested change
import Navbar from "@comp/common/Navbar";
import jwt from "jsonwebtoken";
//import Navbar from "@comp/Navbar";
// import jwt from "jsonwebtoken";
import Navbar from "@comp/common/Navbar";
import jwt from "jsonwebtoken";

</Head>
<section styles={{ position: "relative" }}>
<Navbar />
<Component {...pageProps}></Component>
Copy link

Choose a reason for hiding this comment

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

JSX elements without children should be self-closing.

- <Component {...pageProps}></Component>
+ <Component {...pageProps} />

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.

Suggested change
<Component {...pageProps}></Component>
<Component {...pageProps} />

Comment on lines +135 to +139
<Script
async
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6172950963478417"
crossOrigin="anonymous"
></Script>
Copy link

Choose a reason for hiding this comment

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

JSX elements without children should be self-closing.

- <Script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6172950963478417" crossOrigin="anonymous"></Script>
+ <Script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6172950963478417" crossOrigin="anonymous" />

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.

Suggested change
<Script
async
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6172950963478417"
crossOrigin="anonymous"
></Script>
<Script
async
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6172950963478417"
crossOrigin="anonymous"
/>

@ShoveetSingh ShoveetSingh changed the title dont merge the first commit it is incorrect. Merge the second one U may merge the latest commit that is the third one or the first one.Ignore the second commit please. May 27, 2024
@ShoveetSingh ShoveetSingh changed the title U may merge the latest commit that is the third one or the first one.Ignore the second commit please. Merge the first commit please ignore the second one. May 27, 2024
@ShoveetSingh ShoveetSingh changed the title Merge the first commit please ignore the second one. Merge the first commit please ignore the second one. Kindly add GSSOC24 label to it Jul 9, 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.

1 participant