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
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions .github/workflows/nextjs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Sample workflow for building and deploying a Next.js site to GitHub Pages
#
# To get started with Next.js see: https://nextjs.org/docs/getting-started
#
name: Deploy Next.js site to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["test"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Detect package manager
id: detect-package-manager
run: |
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=yarn" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/package.json" ]; then
echo "manager=npm" >> $GITHUB_OUTPUT
echo "command=ci" >> $GITHUB_OUTPUT
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
exit 0
else
echo "Unable to determine packager manager"
exit 1
fi
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "16"
cache: ${{ steps.detect-package-manager.outputs.manager }}
- name: Setup Pages
uses: actions/configure-pages@v2
with:
# Automatically inject basePath in your Next.js configuration file and disable
# server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized).
#
# You may remove this line if you want to manage the configuration yourself.
static_site_generator: next
- name: Restore cache
uses: actions/cache@v3
with:
path: |
.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
- name: Install dependencies
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
- name: Build with Next.js
run: ${{ steps.detect-package-manager.outputs.runner }} next build
- name: Static HTML export with Next.js
run: ${{ steps.detect-package-manager.outputs.runner }} next export
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./out

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
11 changes: 11 additions & 0 deletions components/Blogs/BlogCard.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import styles from "@styles/scss/blogcard.module.scss";
import Image from "next/image";
<<<<<<< HEAD:components/Blogs/BlogCard.js
import dataScienceImg from "@images/blog/dataScience.webp";
=======
>>>>>>> 2e3ced3f1a6c1a70341b50aee0bde119b118a150:components/BlogCard.js
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faThumbsUp, faComment } from "@fortawesome/free-solid-svg-icons";
import Link from "next/link";
const BlogCard = (props) => {
<<<<<<< HEAD:components/Blogs/BlogCard.js
const { id, image, comments, likes ,title,author} = props;
=======
const { id, title, image, comments, likes } = props;
>>>>>>> 2e3ced3f1a6c1a70341b50aee0bde119b118a150:components/BlogCard.js
return (
<>
<Link
Expand All @@ -14,10 +21,14 @@ const BlogCard = (props) => {
>
<div className={styles.cover}>
<div className={styles.image}>
<<<<<<< HEAD:components/Blogs/BlogCard.js
<Image loading="lazy" src={image} alt="data-science-amupedia-blogs"
layout="responsive"
width="1500"
height="1000"/>
=======
<Image src={`/images/blog/${image}`} width={500} height={500} alt="data-science-amupedia-blogs" />
>>>>>>> 2e3ced3f1a6c1a70341b50aee0bde119b118a150:components/BlogCard.js
</div>
<h3 className={styles.title}>
{title}
Expand Down
11 changes: 6 additions & 5 deletions components/Opportunities/oppCard.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
/* eslint-disable jsx-a11y/alt-text */
import styles from "@styles/oppCard.module.css";
import Link from "node_modules/next/link";

const OppCard = (props) => {
const { title, date, image } = props;
const OppCard = (data) => {
const { title, date, image } = data.data;
return (
<div className={styles.main}>
<div className={styles.picture}>
<h2>Image</h2>
<image src={`/images/oppCard/${image}`} />
</div>
<div className={styles.cardInfo}>
<div className={styles.title}>
<h3>Title</h3>
<span>Date Added -</span>
<h3>{title}</h3>
<span>{date}</span>
</div>
<Link href="#">
<a className={styles.link}>Apply Now</a>
Copy link

Choose a reason for hiding this comment

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

Provide a href attribute for the link.

The anchor tag inside the Link component should have a meaningful href attribute. Consider providing a dynamic or specific link related to the opportunity.

- <Link href="#">
+ <Link href="/apply-now">

Committable suggestion was skipped due low confidence.

Expand Down
2 changes: 1 addition & 1 deletion components/common/Header/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Image from 'next/image';
import Navbar from '../Navbar';
import { IconContainer, IconsDiv, StyledHeader } from './HeaderStyles';
import { getRandomBackground, icons } from './config';

const Header = (props) => {
const { image, text } = props;
return (
Expand Down
9 changes: 9 additions & 0 deletions components/common/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useRouter } from 'next/router';
import styles from '@styles/Navbar.module.css';
import { useState, useEffect, useRef } from 'react';
import Image from 'node_modules/next/image';
import { FaKey } from 'react-icons/fa';

const Navbar = () => {
const checkboxRef = useRef();
Expand Down Expand Up @@ -368,6 +369,14 @@ const Navbar = () => {
Contact Us
</a>
</li>
<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>
Comment on lines +372 to +379
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>

</ul>
</nav>
</>
Expand Down
8 changes: 8 additions & 0 deletions db/models/Blog.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ const blogSchema = new mongoose.Schema({
type: String,
required: true,
},
like: {
type: Number,
required: true,
},
numberOfComments: {
type: Number,
required: true,
}
});

const Blog = mongoose.models.Blog || mongoose.model("Blog", blogSchema);
Expand Down
22 changes: 22 additions & 0 deletions db/models/BlogComment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import mongoose from "mongoose";

const blogCommentSchema = new mongoose.Schema({
userName: {
type: String,
},
blogId: {
type: String,
required: true,
},
message: {
type: String,
required: true,
},
date: {
type: String,
required: true,
}
});

const BlogComment = mongoose.models.BlogComment || mongoose.model("BlogComment", blogCommentSchema);
export default BlogComment;
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,21 @@
"@fortawesome/fontawesome-svg-core": "^1.2.36",
"@fortawesome/free-brands-svg-icons": "^5.15.4",
"@fortawesome/free-solid-svg-icons": "^5.15.4",
<<<<<<< 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",

"axios": "^0.27.2",
"bcryptjs": "^2.4.3",
"framer-motion": "^5.5.5",
"jsonwebtoken": "^9.0.0",
"lodash": "^4.17.21",
"markdown-it": "^13.0.1",
"mongoose": "^7.2.1",
"next": "^12.3.3",
"next": "^12.3.4",
"next-connect": "^1.0.0",
"next-images": "^1.8.5",
"prettier": "^2.8.1",
Expand Down
5 changes: 5 additions & 0 deletions components/Login.js → pages/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from "node_modules/@fortawesome/free-solid-svg-icons/index";
import { useContext, useState } from "react";
import { Store } from "utils/Store/Store";
import Link from 'next/link'

const Login = () => {
const { state, dispatch } = useContext(Store);
Expand Down Expand Up @@ -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>

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

</Link>
Comment on lines +99 to +102
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>

</form>
</div>
</main>
Expand Down
9 changes: 9 additions & 0 deletions pages/Signup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'

const Signup = () => {
return (
<div>Signup</div>
)
}

export default Signup
90 changes: 70 additions & 20 deletions pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<<<<<<< HEAD
Copy link

Choose a reason for hiding this comment

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

Remove merge conflict markers.

- <<<<<<< HEAD
- import Navbar from "@comp/common/Navbar";
- import jwt from "jsonwebtoken";
- =======
- import Navbar from "@comp/Navbar";
- // import jwt from "jsonwebtoken";
- >>>>>>> 2e3ced3f1a6c1a70341b50aee0bde119b118a150
+ import Navbar from "@comp/Navbar";

This change resolves the merge conflict by choosing the updated import path for Navbar and commenting out the unused jwt import.

Also applies to: 3-4, 6-7


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
import Navbar from "@comp/Navbar";
// import jwt from "jsonwebtoken";

import Navbar from "@comp/common/Navbar";
import jwt from "jsonwebtoken";
=======
import Navbar from "@comp/Navbar";
// import jwt from "jsonwebtoken";
>>>>>>> 2e3ced3f1a6c1a70341b50aee0bde119b118a150
import "@styles/globals.css";
import Head from "node_modules/next/head";
// import { useEffect } from 'react';
Expand Down Expand Up @@ -71,30 +76,31 @@ function MyApp({ Component, pageProps, router }) {
// }
// }, []);

return (
<StoreProvider>
{/* <div id="signInDiv"></div> */}
<Alert />
{/* <Login /> */}
<motion.div
key={router.route}
initial="pageInitial"
animate="pageAnimate"
variants={{
pageInitial: {
opacity: 0,
},
pageAnimate: {
opacity: 1,
},
}}
>
<Head>
{/* <script
return (
<StoreProvider>
{/* <div id="signInDiv"></div> */}
<Alert />
{/* <Login /> */}
<motion.div
key={router.route}
initial="pageInitial"
animate="pageAnimate"
variants={{
pageInitial: {
opacity: 0,
},
pageAnimate: {
opacity: 1,
},
}}
>
<Head>
{/* <script
async
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6172950963478417"
crossOrigin="anonymous"
></script> */}
<<<<<<< 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: 105-105, 103-103, 97-97, 84-96, 80-80, 191-191, 191-191, 191-191, 191-193, 193-193, 193-202, 202-204, 203-203

Committable suggestion was skipped due low confidence.


<title>Amupedia</title>
{/* Primary meta tags */}
Expand Down Expand Up @@ -151,6 +157,50 @@ function MyApp({ Component, pageProps, router }) {
</motion.div>
</StoreProvider>
);
=======
<script
src="https://accounts.google.com/gsi/client"
async
defer
></script>
Comment on lines +102 to +106
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
/>

<title>Amupedia</title>
<meta
name="description"
content="Amupedia is an initiative to help college students pursuing B.Tech, B.E or B.Com, especially from AMU."
/>
<meta name="keywords" content="B.Tech, B.Com, B.E" />
<meta
property="og:image"
content="https://www.amupedia.com/og-image.jpg"
/>
<meta property="og:image:width" content="150" />
<meta property="og:image:height" content="150" />
<meta property="og:title" content="Amupedia" />
<meta
property="og:description"
content="Amupedia is an initiative to help college students pursuing B.Tech, B.E or B.Com, especially from AMU."
/>
<meta name="twitter:card" content="summary" />
<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.

key="product-jsonld"
/>
</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} />

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

</section>
</motion.div>
</StoreProvider>
);
>>>>>>> 2e3ced3f1a6c1a70341b50aee0bde119b118a150
}

export default MyApp;
Loading
Loading