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

Jaseemctr #33

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Changes from all 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
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
![StackUp Banner]([https://tinkerhub.frappe.cloud/files/stackup%20banner.jpeg])
# Project Name
Long Description about project. This project do that. This project is awesome...
![stackup banner](https://github.com/uncode11/sample/assets/127462092/ca27e233-ff3b-4830-add4-57658152f341)
#Quizzy
Simple Quiz App where User can Attend Quiz and Admin can create Quiz.A simplw Project...
## Team members
1. Name [Embed personal github URL]
2. Name [Embed perosnal github URL]
1. Unais [[github URL](https://github.com/uncode11)]
2. Aswathi [[github URL](https://github.com/Aswathivalsan)]
3. Jaseem [[github URL](https://github.com/JASEEMCTR)]
4. Shahana shani [[github URL](https://github.com/Shahanashani)]
## Team Id
Team id here
Dino
## Link to product walkthrough
[link to video]
## How it Works ?
1. Explaining the working of project
2. Embed video of project demo
## Libraries used
Library Name - Version
React - 18.2
Node -9+
Mongodb-7 +
Express-latest
## How to configure
Instructions for setting up project
## How to Run
1 change: 1 addition & 0 deletions resources/Backend/Readmeb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions resources/Backend/config/config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions resources/Backend/controllers/con.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions resources/Backend/middleware/mid.m
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions resources/Backend/models/models.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions resources/Backend/routes/routes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Binary file added resources/Frontend/public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions resources/Frontend/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!-- <link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> -->
<title>Quizzy </title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
1 change: 1 addition & 0 deletions resources/Frontend/readmef.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

13 changes: 13 additions & 0 deletions resources/Frontend/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

.App {
min-height: 100vh;
display: flex;
background-image: url("./background.jpg");
background-size: cover;
background-position: center;
font-family: Arial, Helvetica, sans-serif;
}

::-webkit-scrollbar {
display: none;
}
28 changes: 28 additions & 0 deletions resources/Frontend/src/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import "./App.css";
import { Route, Routes } from "react-router-dom";
import { ChakraProvider } from "@chakra-ui/react";
import Homepage from "./pages/Homepage";
import Mainpage from "./pages/Mainpage";
import TestPage from "./components/others/testpage";
import ProfilePage from "./components/others/profile";
import LeaderboardPage from "./components/others/leaderboard";
import UploadQuestionPage from "./components/others/upload";

function App() {
return (
<ChakraProvider>
<span className="App">
<Routes>
<Route path="/" element={<Homepage />} exact />
<Route path="/main" element={<Mainpage />} />
<Route path="/testpage" element={<TestPage />} exact />
<Route path="/profile" element={<ProfilePage />} exact />
<Route path="/leaderboard" element={<LeaderboardPage />} exact />
<Route path="/uploadQuestion" element={<UploadQuestionPage />} exact />
</Routes>
</span>
</ChakraProvider>
);
}

export default App;
8 changes: 8 additions & 0 deletions resources/Frontend/src/App.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { render, screen } from '@testing-library/react';
import App from './App';

test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
Binary file added resources/Frontend/src/background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
120 changes: 120 additions & 0 deletions resources/Frontend/src/components/authentication/Login.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
import React, { useState } from "react";
import { FormControl, FormLabel } from "@chakra-ui/form-control";
import { Input, InputGroup, InputRightElement } from "@chakra-ui/input";
import { VStack } from "@chakra-ui/layout";
import { Button } from "@chakra-ui/react";
import axios from "axios";
import { useToast } from "@chakra-ui/react";
import { useNavigate } from "react-router-dom";

const Login = () => {
const [show, setShow] = useState(false);
const [email, setEmail] = useState();
const [password, setPassword] = useState();
const [loading, setLoading] = useState(false);

const toast = useToast();
const navigate = useNavigate();

const handleClick = () => setShow(!show);

const submitHandler = async () => {
setLoading(true);

if (!email || !password) {
toast({
title: "Please fill all the fields",
status: "warning",
duration: 5000,
isClosable: true,
position: "bottom",
});
setLoading(false);
return;
}

try {
const config = {
headers: {
"Content-type": "application/json",
},
};
const { data } = await axios.post(
"http://localhost:5000/user/login",
{ email, password },
config
);

toast({
title: "Login Successful",
status: "success",
duration: 5000,
isClosable: true,
position: "top",
});

localStorage.setItem("userInfo", JSON.stringify(data));
//here we are storing the userInfo to the localstorage to use this in future

setLoading(false);
navigate("/main", { replace: "true" });
window.location.reload();
} catch (error) {
toast({
title: "Error Occurred",
description: error.response.data.message,
status: "error",
duration: 5000,
isClosable: true,
position: "bottom",
});
setLoading(false);
}
};

return (
<VStack spacing="5px">
<FormControl id="email_1" isRequired>
<FormLabel>Email</FormLabel>
<Input
placeholder="Enter Your Email"
value={email}
onChange={(e) => {
setEmail(e.target.value);
}}
autoComplete="off"
/>
</FormControl>
<FormControl id="password_1" isRequired>
<FormLabel>Password</FormLabel>
<InputGroup>
<Input
type={show ? "text" : "password"}
placeholder="Enter Your Password"
value={password}
onChange={(e) => {
setPassword(e.target.value);
}}
autoComplete="off"
/>
<InputRightElement width="4.5rem">
<Button h="1.75rem" size="sm" onClick={handleClick}>
{show ? "Hide" : "Show"}
</Button>
</InputRightElement>
</InputGroup>
</FormControl>
<Button
colorScheme="blue"
width="100%"
style={{ marginTop: 17, marginBottom: 4 }}
onClick={submitHandler}
isLoading={loading}
>
Login
</Button>
</VStack>
);
};

export default Login;
Loading