Skip to content

Commit

Permalink
formate some code as per eslint cofiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
amitamrutiya committed Jan 25, 2024
1 parent 9bdd13b commit a857664
Show file tree
Hide file tree
Showing 83 changed files with 1,379 additions and 1,379 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ module.exports = {
],
parserOptions: {
sourceType: 'script'
},
rules: {
'error': 0,
}
}
],
Expand Down
3 changes: 1 addition & 2 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
},
"devDependencies": {
"jest": "^29.7.0",
"nodemon": "^3.0.1",
"prettier": "^3.1.0"
"nodemon": "^3.0.1"
}
}
4 changes: 2 additions & 2 deletions frontend/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
autoprefixer: {}
}
}
12 changes: 6 additions & 6 deletions frontend/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "./App.css";
import { Route, Routes } from "react-router-dom";
import Home from "./pages/Home";
import './App.css'
import { Route, Routes } from 'react-router-dom'
import Home from './pages/Home'
import Login from "./pages/Login";
import Signup from "./pages/Signup";
import Navbar from "./components/common/Navbar";
Expand All @@ -22,14 +22,14 @@ import AddCourse from "./components/core/Dashboard/AddCourse";
import Instructor from "./components/core/Dashboard/InstructorDashboard/InstructorDashboard";
import { ACCOUNT_TYPE } from "./utils/constants";
import EditCourse from "./components/core/Dashboard/EditCourse";
import { useSelector } from "react-redux";
import { useSelector } from 'react-redux'
import Catalog from "./pages/Catalog";
import CourseDetails from "./pages/CourseDetails";
import ViewCourse from "./pages/ViewCourse";
import VideoDetails from "./components/core/ViewCourse/VideoDetails";

export default function App() {
const { user } = useSelector((state) => state.profile);
export default function App () {
const { user } = useSelector((state) => state.profile)

return (
<div className="w-screen min-h-screen bg-richblack-900 flex flex-col font-inter">
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/ContactPage/ContactUsForm.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useEffect } from "react";
import { useEffect } from 'react'
import { useForm } from "react-hook-form";
import { toast } from "react-hot-toast";
import CountryCode from "../../data/countrycode.json";
import { apiConnector } from "../../services/apiconnector";
import { contactusEndpoint } from "../../services/apis";
import { useState } from "react";
import { useState } from 'react'

const ContactUsForm = () => {
const [loading, setLoading] = useState(false);
Expand Down
66 changes: 39 additions & 27 deletions frontend/src/components/common/ConfirmationModal.jsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,43 @@
import IconBtn from "./IconBtn";
import React from 'react'
import PropTypes from 'prop-types'
import IconBtn from './IconBtn'

export default function ConfirmationModal({ modalData }) {
return (
<div className="fixed inset-0 z-[1000] !mt-0 grid place-items-center overflow-auto bg-white bg-opacity-10 backdrop-blur-sm">
<div className="w-11/12 max-w-[350px] rounded-lg border border-richblack-400 bg-richblack-800 p-6">
<p className="text-2xl font-semibold text-richblack-5">
{" "}
{modalData?.text1}{" "}
</p>
<p className="mt-3 mb-5 leading-6 text-richblack-200">
{" "}
{modalData?.text2}{" "}
</p>
const ConfirmationModal = ({ modalData }) => (
<div className="fixed inset-0 z-[1000] !mt-0 grid place-items-center overflow-auto bg-white bg-opacity-10 backdrop-blur-sm">
<div className="w-11/12 max-w-[350px] rounded-lg border border-richblack-400 bg-richblack-800 p-6">
<p className="text-2xl font-semibold text-richblack-5">
{modalData?.text1}
</p>
<p className="mt-3 mb-5 leading-6 text-richblack-200">
{modalData?.text2}
</p>

<div className="flex items-center gap-x-4">
<IconBtn
onclick={modalData?.btn1Handler}
text={modalData?.btn1Text}
/>
<button
className="cursor-pointer rounded-md bg-richblack-200 py-[8px] px-[20px] font-semibold text-richblack-900"
onClick={modalData?.btn2Handler}
>
{modalData?.btn2Text}
</button>
</div>
<div className="flex items-center gap-x-4">
<IconBtn
onclick={modalData?.btn1Handler}
text={modalData?.btn1Text}
/>
<button
type="button"
className="cursor-pointer rounded-md bg-richblack-200 py-[8px] px-[20px] font-semibold text-richblack-900"
onClick={modalData?.btn2Handler}
>
{modalData?.btn2Text}
</button>
</div>
</div>
);
}
</div>
)

ConfirmationModal.propTypes = {
modalData: PropTypes.shape({
text1: PropTypes.string,
text2: PropTypes.string,
btn1Handler: PropTypes.func,
btn1Text: PropTypes.string,
btn2Handler: PropTypes.func,
btn2Text: PropTypes.string
}).isRequired
}

export default ConfirmationModal
8 changes: 4 additions & 4 deletions frontend/src/components/common/Footer.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { FooterLink2 } from "../../data/footer-links";
import { Link } from "react-router-dom";
import { FooterLink2 } from '../../data/footer-links'
import { Link } from 'react-router-dom'
// Images
import Logo from "../../assets/Logo/Logo-Full-Light.png";
import Logo from '../../assets/Logo/Logo-Full-Light.png'
// Icons
import { FaFacebook, FaGoogle, FaTwitter, FaYoutube } from "react-icons/fa";
import { FaFacebook, FaGoogle, FaTwitter, FaYoutube } from 'react-icons/fa'

const BottomFooter = ["Privacy Policy", "Cookie Policy", "Terms"];
const Resources = [
Expand Down
29 changes: 13 additions & 16 deletions frontend/src/components/common/Navbar.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useEffect, useState } from "react";
import { useEffect, useState } from 'react'
import { AiOutlineMenu, AiOutlineShoppingCart } from "react-icons/ai";
import { BsChevronDown } from "react-icons/bs";
import { useSelector } from "react-redux";
import { Link, matchPath, useLocation } from "react-router-dom";
import { useSelector } from 'react-redux'
import { Link, matchPath, useLocation } from 'react-router-dom'
import logo from "../../assets/Logo/Logo-Full-Light.png";
import { NavbarLinks } from "../../data/navbar-links";
import { apiConnector } from "../../services/apiconnector";
Expand Down Expand Up @@ -40,9 +40,8 @@ function Navbar() {

return (
<div
className={`flex h-14 items-center justify-center border-b-[1px] border-b-richblack-700 ${
location.pathname !== "/" ? "bg-richblack-800" : ""
} transition-all duration-200`}
className={`flex h-14 items-center justify-center border-b-[1px] border-b-richblack-700 ${location.pathname !== "/" ? "bg-richblack-800" : ""
} transition-all duration-200`}
>
<div className="flex w-11/12 max-w-maxContent items-center justify-between">
{/* Logo */}
Expand All @@ -65,11 +64,10 @@ function Navbar() {
{link.title === "Catalog" ? (
<>
<div
className={`group relative flex cursor-pointer items-center gap-1 ${
matchRoute("/catalog/:catalogName")
? "text-yellow-25"
: "text-richblack-25"
}`}
className={`group relative flex cursor-pointer items-center gap-1 ${matchRoute("/catalog/:catalogName")
? "text-yellow-25"
: "text-richblack-25"
}`}
>
<p> {link.title} </p> <BsChevronDown />{" "}
{/* "Catalog \/" */}
Expand Down Expand Up @@ -105,11 +103,10 @@ function Navbar() {
) : (
<Link to={link?.path}>
<p
className={` ${
matchRoute(link?.path)
? "text-yellow-25"
: "text-richblack-25"
} `}
className={` ${matchRoute(link?.path)
? "text-yellow-25"
: "text-richblack-25"
} `}
>
{" "}
{link.title}{" "}
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/common/ReviewSlider.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useState } from "react";
import { useEffect, useState } from 'react'
import ReactStars from "react-rating-stars-component";

import { Swiper, SwiperSlide } from "swiper/react"; // Import Swiper React components
Expand Down Expand Up @@ -65,9 +65,9 @@ function ReviewSlider() {
<p className="font-medium text-richblack-25">
{review?.review.split(" ").length > truncateWords
? `${review?.review
.split(" ")
.slice(0, truncateWords)
.join(" ")} ...`
.split(" ")
.slice(0, truncateWords)
.join(" ")} ...`
: `${review?.review}`}
</p>

Expand Down
44 changes: 23 additions & 21 deletions frontend/src/components/core/Auth/LoginForm.jsx
Original file line number Diff line number Diff line change
@@ -1,56 +1,58 @@
import { useState } from "react"
import { AiOutlineEye, AiOutlineEyeInvisible } from "react-icons/ai"
import { useDispatch } from "react-redux"
import { useDispatch } from 'react-redux'
import { Link, useNavigate } from "react-router-dom"
import { login } from "../../../services/operations/authAPI.js"


function LoginForm(){
function LoginForm() {

const navigate = useNavigate()
const dispatch = useDispatch()
const [formData, setFormData] = useState({email: "", password: "" })
const [formData, setFormData] = useState({ email: "", password: "" })
const [showPassword, setShowPassword] = useState(false)
const { email, password } = formData


function handleOnChange(e) {
setFormData( (prevData) =>({ ...prevData , [e.target.name] : e.target.value })
)}
setFormData((prevData) => ({ ...prevData, [e.target.name]: e.target.value })
)
}


function handleOnSubmit(e){
function handleOnSubmit(e) {
e.preventDefault()
dispatch(login(email, password, navigate))
}


return (

<form onSubmit = {handleOnSubmit} className="flex flex-col w-full gap-y-4 mt-6">
<form onSubmit={handleOnSubmit} className="flex flex-col w-full gap-y-4 mt-6">

<label className='w-full'>
<p className='text-[0.875rem] text-richblack-5 mb-1 leading-[1.375rem]'> Email Address <sup className='text-pink-200'>*</sup> </p>
<input required type="email" value = {email} onChange={handleOnChange} placeholder="Enter email address" name="email" style = {{boxShadow: "inset 0px -1px 0px rgba(255, 255, 255, 0.18)", }} className='bg-richblack-800 rounded-[0.5rem] text-richblack-5 w-full p-[12px]' />
</label>
<label className='w-full'>
<p className='text-[0.875rem] text-richblack-5 mb-1 leading-[1.375rem]'> Email Address <sup className='text-pink-200'>*</sup> </p>
<input required type="email" value={email} onChange={handleOnChange} placeholder="Enter email address" name="email" style={{ boxShadow: "inset 0px -1px 0px rgba(255, 255, 255, 0.18)", }} className='bg-richblack-800 rounded-[0.5rem] text-richblack-5 w-full p-[12px]' />
</label>

<label className='relative'>
<p className='text-[0.875rem] text-richblack-5 mb-1 leading-[1.375rem]'> Password <sup className='text-pink-200'>*</sup> </p>
<input required type= {showPassword ? ("text") : ("password")} value = {password} onChange={handleOnChange} placeholder="Enter Password" name="password" style={{boxShadow: "inset 0px -1px 0px rgba(255, 255, 255, 0.18)"}} className='bg-richblack-800 rounded-[0.5rem] text-richblack-5 w-full p-[12px]' />
<label className='relative'>
<p className='text-[0.875rem] text-richblack-5 mb-1 leading-[1.375rem]'> Password <sup className='text-pink-200'>*</sup> </p>
<input required type={showPassword ? ("text") : ("password")} value={password} onChange={handleOnChange} placeholder="Enter Password" name="password" style={{ boxShadow: "inset 0px -1px 0px rgba(255, 255, 255, 0.18)" }} className='bg-richblack-800 rounded-[0.5rem] text-richblack-5 w-full p-[12px]' />

<span className='absolute right-3 top-[38px] cursor-pointer' onClick={() => setShowPassword((prev) => !prev)}>
{showPassword ? (<AiOutlineEyeInvisible fontSize={24} fill='#AFB2BF'/>) : (<AiOutlineEye fontSize={24} fill='#AFB2BF'/>)}
</span> {/* here showPassword insert eye_icon which indicate that password is visible or not */}
<span className='absolute right-3 top-[38px] cursor-pointer' onClick={() => setShowPassword((prev) => !prev)}>
{showPassword ? (<AiOutlineEyeInvisible fontSize={24} fill='#AFB2BF' />) : (<AiOutlineEye fontSize={24} fill='#AFB2BF' />)}
</span> {/* here showPassword insert eye_icon which indicate that password is visible or not */}

<Link to="/forgot-password"> <p className='text-xs mt-1 text-blue-100 max-w-max ml-auto'> Forgot Password </p> </Link>
<Link to="/forgot-password"> <p className='text-xs mt-1 text-blue-100 max-w-max ml-auto'> Forgot Password </p> </Link>

</label>
</label>

<button className='bg-yellow-50 rounded-[8px] font-medium text-richblack-900 px-[12px] py-[8px] mt-6'> Sign In </button>
<button className='bg-yellow-50 rounded-[8px] font-medium text-richblack-900 px-[12px] py-[8px] mt-6'> Sign In </button>

</form>

)}
)
}



Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/core/Auth/OpenRoute.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This will prevent authenticated users from accessing this route
import { useSelector } from "react-redux"
import { useSelector } from 'react-redux'
import { Navigate } from "react-router-dom"

function OpenRoute({ children }) {
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/core/Auth/ProfileDropDown.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useRef, useState } from "react";
import { useRef, useState } from 'react'
import { AiOutlineCaretDown } from "react-icons/ai";
import { VscDashboard, VscSignOut } from "react-icons/vsc";
import { useDispatch, useSelector } from "react-redux";
import { Link, useNavigate } from "react-router-dom";
import { useDispatch, useSelector } from 'react-redux'
import { Link, useNavigate } from 'react-router-dom'
import useOnClickOutside from "../../../hooks/useOnClickOutside.js";
import { logout } from "../../../services/operations/authAPI";

Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/core/Auth/SignupForm.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useState } from "react";
import { useState } from 'react'
import { toast } from "react-hot-toast";
import { AiOutlineEye, AiOutlineEyeInvisible } from "react-icons/ai";
import { useDispatch } from "react-redux";
import { useNavigate } from "react-router-dom";
import { useDispatch } from 'react-redux'
import { useNavigate } from 'react-router-dom'
import CountryCode from "../../../data/countrycode.json";
import { sendOtp } from "../../../services/operations/authAPI";
import { setSignupData } from "../../../slices/authSlice";
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/core/Auth/Template.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useSelector } from "react-redux";
import { useSelector } from 'react-redux'

import frameImg from "../../../assets/Images/frame.png";
import LoginForm from "./LoginForm";
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/core/Catalog/Course_Card.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect, useState } from "react";
import { useEffect, useState } from 'react'
import RatingStars from "../../common/RatingStars";
import GetAvgRating from "../../../utils/avgRating";
import { Link } from "react-router-dom";
import { Link } from 'react-router-dom'

const Course_Card = ({ course, Height }) => {
const [avgReviewCount, setAvgReviewCount] = useState(0);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/core/Course/CourseAccordionBar.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useRef, useState } from "react";
import { useEffect, useRef, useState } from 'react'
import { AiOutlineDown } from "react-icons/ai";
import CourseSubSectionAccordion from "./CourseSubSectionAccordion";

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/core/Course/CourseDetailsCard.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import copy from "copy-to-clipboard";
import { BsFillCaretRightFill } from "react-icons/bs";
import { FaShareSquare } from "react-icons/fa";
import { useDispatch, useSelector } from "react-redux";
import { useNavigate } from "react-router-dom";
import { useDispatch, useSelector } from 'react-redux'
import { useNavigate } from 'react-router-dom'
import { addToCart } from "../../../slices/cartSlice";
import { toast } from "react-hot-toast";
import { ACCOUNT_TYPE } from "../../../utils/constants";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useState } from "react";
import { useState } from 'react'
import { useForm } from "react-hook-form";
import { toast } from "react-hot-toast";
import { IoAddCircleOutline } from "react-icons/io5";
import { MdNavigateNext } from "react-icons/md";
import { useDispatch, useSelector } from "react-redux";
import { useDispatch, useSelector } from 'react-redux'

import {
createSection,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useState } from "react";
import { useState } from 'react'
import { AiFillCaretDown } from "react-icons/ai";
import { FaPlus } from "react-icons/fa";
import { MdEdit } from "react-icons/md";
import { RiDeleteBin6Line } from "react-icons/ri";
import { RxDropdownMenu } from "react-icons/rx";
import { useDispatch, useSelector } from "react-redux";
import { useDispatch, useSelector } from 'react-redux'

import {
deleteSection,
Expand Down
Loading

0 comments on commit a857664

Please sign in to comment.