From 70ef099b68407254a8b92dd88f1fe1a52a02d962 Mon Sep 17 00:00:00 2001 From: "Aditya_Parmar@dev" <105008414+Adityajparmar37@users.noreply.github.com> Date: Fri, 31 May 2024 16:27:16 +0530 Subject: [PATCH 01/19] Sign up and sign in will work as well as loader added to sign up and sign in page --- src/pages/Login.jsx | 281 +++++++++++++++++++++---------------- src/pages/Signup.jsx | 319 +++++++++++++++++++++++++++++-------------- 2 files changed, 381 insertions(+), 219 deletions(-) diff --git a/src/pages/Login.jsx b/src/pages/Login.jsx index b359ecd..8f62b85 100644 --- a/src/pages/Login.jsx +++ b/src/pages/Login.jsx @@ -1,18 +1,29 @@ -import React, { useState, useEffect } from "react"; -import { AiOutlineEye, AiOutlineEyeInvisible } from "react-icons/ai"; -import { Link, useNavigate } from "react-router-dom"; +import React, { + useState, + useEffect, +} from "react"; +import { + AiOutlineEye, + AiOutlineEyeInvisible, +} from "react-icons/ai"; +import { + Link, + useNavigate, +} from "react-router-dom"; import { toast } from "react-hot-toast"; import axios from "axios"; -import logo from "../assets/logo2.png" - +import logo from "../assets/logo2.png"; +import Loader from "../components/Loader/Loader"; function Login() { const [formData, setFormData] = useState({ email: "", - accountType : "", + accountType: "", password: "", }); - const [showPassword, setShowPassword] = useState(false); + const [showPassword, setShowPassword] = + useState(false); + const [loading, setLoading] = useState(false); const navigate = useNavigate(); function changeHandler(event) { @@ -22,127 +33,169 @@ function Login() { })); } - function submitHandler(event) { - - event.preventDefault(); - - - if(formData.accountType === "User"){ + if (formData.accountType === "User") { + //Loader will show till the api fetching is done as show as promise is resolved the loader will be not shown + setLoading(true); const apiUrl = `${process.env.REACT_APP_BASE_URL}/studentLogin`; - // const apiUrl = `http://localhost:4000/api/v1/studentLogin`; - - axios.post(apiUrl , formData) - .then((response)=>{ - toast.success("User Logged in "); - navigate("/home"); - }) - .catch((error)=>{ - toast.error("Failed to login") - }); - } - - else{ - + //const apiUrl = `http://localhost:4000/api/v1/studentLogin`; + + axios + .post(apiUrl, formData) + .then((response) => { + setLoading(false); + toast.success("User Logged in "); + navigate("/home"); + }) + .catch((error) => { + //Loader will show till the api fetching is done as show as promise is resolved the loader will be not shown + setLoading(false); + toast.error("Failed to login"); + }); + } else { + //Loader will show till the api fetching is done as show as promise is resolved the loader will be not shown const apiUrl = `${process.env.REACT_APP_BASE_URL}/canteenLogin`; - - axios.post(apiUrl , formData) - .then((response)=>{ - toast.success("User Logged in "); - navigate(`/section/${response.data.cantId}`); - }) - .catch((error)=>{ - toast.error("Failed to login") - }); + setLoading(true); + + axios + .post(apiUrl, formData) + .then((response) => { + setLoading(false); + toast.success("User Logged in "); + navigate( + `/section/${response.data.cantId}` + ); + }) + .catch((error) => { + //Loader will show till the api fetching is done as show as promise is resolved the loader will be not shown + setLoading(false); + toast.error("Failed to login"); + }); } } return ( -
- -
- -
- logo -

Connecting You to Your College Canteens

-
- -
-
-
-
- -
- -
- -
- -

Hello Again!

-

Welcome Back

- -
- + <> + {loading ? ( + + ) : ( +
+
+
+ logo +

+ Connecting You to Your College + Canteens +

+
+ +
+
+
+
-
- -
- -
- - setShowPassword((prev) => !prev)} - > - {showPassword ? : } - +
+ +

+ Hello Again! +

+

+ Welcome Back +

+ +
+ +
+ +
+ +
+ +
+ + + setShowPassword( + (prev) => !prev + ) + }> + {showPassword ? ( + + ) : ( + + )} + +
+ + + + + + Don't have an account? Sign Up + + +
- - - - - Don't have an account? Sign Up - - - - -
- -
+
+ )} + ); } export default Login; - diff --git a/src/pages/Signup.jsx b/src/pages/Signup.jsx index e6a6005..bb66e45 100644 --- a/src/pages/Signup.jsx +++ b/src/pages/Signup.jsx @@ -1,12 +1,19 @@ import React, { useState } from "react"; -import { Link, useNavigate } from "react-router-dom"; -import { AiOutlineEye, AiOutlineEyeInvisible } from "react-icons/ai"; +import { + Link, + useNavigate, +} from "react-router-dom"; +import { + AiOutlineEye, + AiOutlineEyeInvisible, +} from "react-icons/ai"; import { toast } from "react-hot-toast"; import axios from "axios"; -import logo from "../assets/logo2.png" -import Icon from 'react-icons-kit'; -import { arrows_circle_check } from 'react-icons-kit/linea/arrows_circle_check' -import { arrows_exclamation } from 'react-icons-kit/linea/arrows_exclamation' +import logo from "../assets/logo2.png"; +import Icon from "react-icons-kit"; +import { arrows_circle_check } from "react-icons-kit/linea/arrows_circle_check"; +import { arrows_exclamation } from "react-icons-kit/linea/arrows_exclamation"; +import Loader from "../components/Loader/Loader"; function Signup() { const [formData, setFormData] = useState({ @@ -16,55 +23,57 @@ function Signup() { accountType: "", password: "", }); - const [showPassword, setShowPassword] = useState(false); - const [lowerValidated, setLowerValidated] = useState(false); - const [upperValidated, setUpperValidated] = useState(false); - const [numberValidated, setNumberValidated] = useState(false); - const [specialValidated, setSpecialValidated] = useState(false); - const [lengthValidated, setLengthValidated] = useState(false); - + const [loading, setLoading] = useState(false); + const [showPassword, setShowPassword] = + useState(false); + const [lowerValidated, setLowerValidated] = + useState(false); + const [upperValidated, setUpperValidated] = + useState(false); + const [numberValidated, setNumberValidated] = + useState(false); + const [specialValidated, setSpecialValidated] = + useState(false); + const [lengthValidated, setLengthValidated] = + useState(false); const navigate = useNavigate(); function PasswordChecker(event) { - const lower = new RegExp('(?=.*[a-z])'); - const upper = new RegExp('(?=.*[A-Z])'); - const number = new RegExp('(?=.*[0-9])'); - const special = new RegExp('(?=.*[!@#\$%\^&\*])'); - const length = new RegExp('(?=.{8,})') + const lower = new RegExp("(?=.*[a-z])"); + const upper = new RegExp("(?=.*[A-Z])"); + const number = new RegExp("(?=.*[0-9])"); + const special = new RegExp( + "(?=.*[!@#$%^&*])" + ); + const length = new RegExp("(?=.{8,})"); const value = event.target.value; if (lower.test(value)) { setLowerValidated(true); - } - else { + } else { setLowerValidated(false); } if (upper.test(value)) { setUpperValidated(true); - } - else { + } else { setUpperValidated(false); } if (number.test(value)) { setNumberValidated(true); - } - else { + } else { setNumberValidated(false); } if (special.test(value)) { setSpecialValidated(true); - } - else { + } else { setSpecialValidated(false); } if (length.test(value)) { setLengthValidated(true); - } - else { + } else { setLengthValidated(false); } - setFormData((prevData) => ({ ...prevData, [event.target.name]: event.target.value, @@ -80,49 +89,90 @@ function Signup() { function submitHandler(event) { event.preventDefault(); - console.log("ENV FILE",process.env.REACT_APP_BASE_URL); + console.log( + "ENV FILE", + process.env.REACT_APP_BASE_URL + ); - if (lowerValidated && upperValidated && numberValidated && specialValidated && lengthValidated) { + if ( + lowerValidated && + upperValidated && + numberValidated && + specialValidated && + lengthValidated + ) { if (formData.accountType === "User") { - // const apiUrl = `${process.env.REACT_APP_BASE_URL}/studentSignup`; - const apiUrl = `http://localhost:4000/api/v1/studentSignup`; - + //Loader will show till the api fetching is done as show as promise is resolved the loader will be not shown + setLoading(true); + const apiUrl = `${process.env.REACT_APP_BASE_URL}/studentSignup`; + //const apiUrl = `http://localhost:4000/api/v1/studentSignup`; + axios .post(apiUrl, formData) .then((response) => { - toast.success("Account Created succesfully"); + setLoading(false); + toast.success( + "Account Created succesfully" + ); navigate("/home"); }) .catch((error) => { - toast.error("Failed To create account"); + //If promise is not resolved the loader will be not shown + setLoading(false); + toast.error( + "Failed To create account" + ); }); } else { + //Loader will show till the api fetching is done as show as promise is resolved the loader will be not shown + setLoading(true); const apiUrl = `${process.env.REACT_APP_BASE_URL}/canteenSignup`; - axios .post(apiUrl, formData) .then((response) => { - toast.success("Account Created succesfully"); - navigate(`/section/${response.data.cantId}`); + setLoading(false); + toast.success( + "Account Created succesfully" + ); + navigate( + `/section/${response.data.cantId}` + ); }) .catch((error) => { - console.log("Errorrr:->",error); - toast.error("Failed To create account"); + //If promise is not resolved the loader will be not shown + setLoading(false); + console.log("Errorrr:->", error); + toast.error( + "Failed To create account" + ); }); } } else { - toast.error("Password must pass all the criteria"); + toast.error( + "Password must pass all the criteria" + ); } } return ( -
+ <> + { + loading ? ( + + ) : ( + <> +
- logo + logo

- Connecting You to Your College Canteens + Connecting You to Your College + Canteens

@@ -135,8 +185,7 @@ function Signup() {
+ onSubmit={submitHandler}>

Hello There!

@@ -186,13 +235,18 @@ function Signup() { name="accountType" onChange={changeHandler} value={formData.accountType} - className="mt-1 p-2 w-full border rounded-2xl" - > - - +
@@ -200,7 +254,9 @@ function Signup() { setShowPassword((prev) => !prev)} - > + onClick={() => + setShowPassword((prev) => !prev) + }> {showPassword ? ( ) : ( - + )}
- Already have an account? Login + + Already have an account? Login + {/* @@ -235,96 +295,145 @@ function Signup() { */} -
-
+
+
{lowerValidated ? ( - - + + ) : ( - - + + )} At least one lowercase letter
-
+
{upperValidated ? ( - - + + ) : ( - - + + )} At least one uppercase letter
-
+
{numberValidated ? ( - - + + ) : ( - - + + )} At least one number
-
+
{specialValidated ? ( - - + + ) : ( - - + + )} At least one special character
-
+
{lengthValidated ? ( - - + + ) : ( - - + + )} At least 8 characters
-
); + + ) + } + + ) } export default Signup; From d94d5412dc956c7767ed78b8a2b3f4f47ab3450b Mon Sep 17 00:00:00 2001 From: mohit-bhandari45 Date: Mon, 3 Jun 2024 10:53:54 +0530 Subject: [PATCH 02/19] Readme files updates --- README.md | 29 +++++++++++++++++------------ package.json | 1 + server/package.json | 2 +- src/pages/Signup.jsx | 1 + 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 007afdc..69fba0f 100644 --- a/README.md +++ b/README.md @@ -62,30 +62,35 @@ Welcome to Foodies, your go-to college dining companion! Designed for seamless c ## To get started with contributing to the FoodiesWeb project, follow these steps: -1. **Navigate to the Project Directory:** +1. **Fork and clone the repository** +2. **Navigate to the Project Directory:** ```bash - cd path/to/FoodiesWeb + cd FoodiesWeb ``` -2. **Split Terminal for Backend Setup** +3. **Split Terminal for Backend Setup** -3. **Navigate to the Server Directory:** +4. **Navigate to the Server Directory:** ```bash - cd path/to/FoodiesWeb/server + cd server ``` -4. **Install Dependencies (in both terminals):** +5. **Install Dependencies (in both terminals):** ```bash npm install ``` -5. **Start the Backend Server (in the terminal within the /server directory):**
+ + ### **ENV Variables** + Setup MongoDB local host instance and port in env file in your local device. Default port is 4000 + Sample uri is given below. + ``` + PORT=3000 + DATABASE_URL="http://localhost:21713/foods" + ``` + +6. **Start the Backend Server (in the terminal within the /server directory):**
In the terminal where you navigated to the /server directory, run the following command to start the backend server: ```bash nodemon server.js ``` -6. **Navigate to the src (with Backend Running):**
- In the other terminal, run the following command to navigate to the src folder (frontend): - ```bash - cd src - ``` 7. **Start the React App (with Backend Running):**
After navigating run the following command to start the React app with the backend server running successfully: ```bash diff --git a/package.json b/package.json index e33361c..8718817 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "@testing-library/user-event": "^13.5.0", "aos": "^2.3.4", "axios": "^1.5.1", + "dotenv": "^16.4.5", "framer-motion": "^11.1.9", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/server/package.json b/server/package.json index c4dd360..38bb8fe 100644 --- a/server/package.json +++ b/server/package.json @@ -16,7 +16,7 @@ "cookie-parser": "^1.4.6", "cors": "^2.8.5", "datauri": "^4.1.0", - "dotenv": "^16.3.1", + "dotenv": "^16.4.5", "express": "^4.18.2", "express-async-handler": "^1.2.0", "faker": "^5.5.3", diff --git a/src/pages/Signup.jsx b/src/pages/Signup.jsx index e6a6005..ac1f61b 100644 --- a/src/pages/Signup.jsx +++ b/src/pages/Signup.jsx @@ -94,6 +94,7 @@ function Signup() { navigate("/home"); }) .catch((error) => { + console.log(error) toast.error("Failed To create account"); }); } else { From 72e3f95ffa2b9ad416d7400e86a71668f55648b2 Mon Sep 17 00:00:00 2001 From: Kevin <68507333+shubhammjha22@users.noreply.github.com> Date: Tue, 4 Jun 2024 12:27:27 +0530 Subject: [PATCH 03/19] Create automate bot Bot added for automate greeting whenever issue/PR is made --- .github/workflows/greetings.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/greetings.yml diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml new file mode 100644 index 0000000..b66af21 --- /dev/null +++ b/.github/workflows/greetings.yml @@ -0,0 +1,24 @@ +name: 'Greetings' + +on: + fork: + push: + branches: [main] + issues: + types: [opened] + pull_request_target: + types: [opened] + +jobs: + welcome: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: EddieHubCommunity/gh-action-community/src/welcome@main + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + issue-message: | + Congratulations, @${{ github.actor }}! 🎉 Thank you for creating your issue. Your contribution is greatly appreciated and we look forward to working with you to resolve the issue. Keep up the great work! + pr-message: | + Great job, @${{ github.actor }}! 🎉 Thank you for submitting your pull request. Your contribution is valuable and we appreciate your efforts to improve our project. + footer: 'We will promptly review your changes and offer feedback. Keep up the excellent work! Kindly remember to check our [contributing guidelines](https://github.com/VanshKing30/FoodiesWeb/blob/main/CONTRIBUTING.md)' From 5023cdeee28cb7b5180c6b955e0219a55accc251 Mon Sep 17 00:00:00 2001 From: Karan-Semwal Date: Tue, 4 Jun 2024 12:50:55 +0530 Subject: [PATCH 04/19] Centering news elements --- src/pages/News.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/News.jsx b/src/pages/News.jsx index b0c0e98..2ef82cc 100644 --- a/src/pages/News.jsx +++ b/src/pages/News.jsx @@ -39,10 +39,10 @@ function News() { (
-

+

Trending Food and Health News

-
+
{articles.map((article, index) => ( From 4889fdb1554a6e835ac08d3544449b9ea52d2d70 Mon Sep 17 00:00:00 2001 From: Passionatelytoooadorable <128183101+Passionatelytoooadorable@users.noreply.github.com> Date: Tue, 4 Jun 2024 13:54:57 +0530 Subject: [PATCH 05/19] Create LEARN.md --- LEARN.md | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 LEARN.md diff --git a/LEARN.md b/LEARN.md new file mode 100644 index 0000000..04a329e --- /dev/null +++ b/LEARN.md @@ -0,0 +1,68 @@ +# FoodiesWeb + + +
+

Table of Contents

+
    +
  1. + Introduction +
  2. +
  3. + Features +
  4. +
  5. + Tech Stacks +
  6. +
  7. + Snapshots +
  8. +
+
+ +# Introduction: + +The Project "Foodies" enables the end users to register online, read and select the food from e-menu card and order food online by just selecting the food that the user want to have using android application. It is designed for seamless campus culinary experiences and they can access daily canteen menus, make informed dietary choices with Spoonacular integration, and empower canteen efficiency. This system will minimize the queues in the canteen and make hassle-free payments using the unique id provided to the students and the faculty by the college. + +# Features: + +- **Menu Exploration**: Easily check out daily menus of all campus canteens from personal devices. +- **Nutritional Insights**: Access nutritional information for dishes, aiding in informed dietary choices. +- **Canteen Optimization**: Assist canteen owners with menu planning and recipe suggestions, enhancing efficiency. +- **User-Friendly Interface**: Effortless sign-up for students and secure login credentials for canteen owners. +- **Health News**: Stay informed with health-related articles, empowering users to make healthier dietary choices. + +# Tech Stacks: + +1. JavaScript: 96.6% + +2. HTML: 1.9% + +3. CSS: 1.3% + +4. Dockerfile: 0.2% + +a. React.js: Provides a sleek and efficient frontend. + +b. Tailwind CSS: Ensures stylish and user-friendly designs. + +c. Express.js: Powers the backend operations. + +d. MongoDB Atlas and Mongoose: Store and manage important data. + +e. Spoonacular API: Offers nutritional information and recipe ideas. + +f. G News API: Fetches health-related articles. + +g. Bcrypt and JWT: Ensure data security and protection. + +# Snapshots: + +
+
+
+
+ + +## 🙏 Support + +This project needs a ⭐️ from you. Don't forget to leave a star ⭐️ From 3fe7964816d5821609ca00d17e3a680a9561c8d0 Mon Sep 17 00:00:00 2001 From: Siddheya Kulkarni <115717746+Asymtode712@users.noreply.github.com> Date: Tue, 4 Jun 2024 16:27:02 +0530 Subject: [PATCH 06/19] added autocomment-iss-close.yml --- .github/workflows/autocomment-iss-close.yml | 29 +++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/autocomment-iss-close.yml diff --git a/.github/workflows/autocomment-iss-close.yml b/.github/workflows/autocomment-iss-close.yml new file mode 100644 index 0000000..3acbe0a --- /dev/null +++ b/.github/workflows/autocomment-iss-close.yml @@ -0,0 +1,29 @@ +name: Comment on Issue Close + +on: + issues: + types: [closed] + +jobs: + greet-on-close: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - name: Greet User + uses: actions/github-script@v5 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const issue = context.payload.issue; + const issueCreator = issue.user.login; + const issueNumber = issue.number; + + const greetingMessage = `Hello @${issueCreator}! Your issue #${issueNumber} has been closed. Thank you for your contribution!`; + + github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issueNumber, + body: greetingMessage + }); \ No newline at end of file From 131b46778573f7dc9870635c09a5113e18f2c95b Mon Sep 17 00:00:00 2001 From: Siddheya Kulkarni <115717746+Asymtode712@users.noreply.github.com> Date: Tue, 4 Jun 2024 16:31:16 +0530 Subject: [PATCH 07/19] created close-old-issue.yml --- .github/workflows/close-old-issue.yml | 37 +++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/close-old-issue.yml diff --git a/.github/workflows/close-old-issue.yml b/.github/workflows/close-old-issue.yml new file mode 100644 index 0000000..319c284 --- /dev/null +++ b/.github/workflows/close-old-issue.yml @@ -0,0 +1,37 @@ +name: Close Old Issues +on: + schedule: + - cron: "0 0 * * *" + +jobs: + close-issues: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Close Old Issues + run: | + open_issues=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + "https://api.github.com/repos/${{ github.repository }}/issues?state=open" \ + | jq -r '.[] | .number') + for issue in $open_issues; do + # Get the last updated timestamp of the issue + last_updated=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + "https://api.github.com/repos/${{ github.repository }}/issues/$issue" \ + | jq -r '.updated_at') + days_since_update=$(( ( $(date +%s) - $(date -d "$last_updated" +%s) ) / 86400 )) + if [ $days_since_update -gt 30 ]; then + curl -s -X PATCH -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + -d '{"state":"closed"}' \ + "https://api.github.com/repos/${{ github.repository }}/issues/$issue" + + # Add a comment explaining when the issue will be closed + curl -s -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + -d '{"body":"This issue has been automatically closed because it has been inactive for more than 30 days. If you believe this is still relevant, feel free to reopen it or create a new one. Thank you!"}' \ + "https://api.github.com/repos/${{ github.repository }}/issues/$issue/comments" + fi + done \ No newline at end of file From b378b97659873ca63b9cb6278f6dd36e65d31e46 Mon Sep 17 00:00:00 2001 From: Saksham2k3s Date: Wed, 5 Jun 2024 01:19:59 +0530 Subject: [PATCH 08/19] Solved issue 174 --- package.json | 1 + server/config/database.js | 1 + server/server.js | 3 ++ src/index.js | 1 - src/pages/Login.jsx | 30 +++++++++++-------- src/pages/Signup.jsx | 62 +++++++++++++++++++++------------------ 6 files changed, 57 insertions(+), 41 deletions(-) diff --git a/package.json b/package.json index e33361c..8718817 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "@testing-library/user-event": "^13.5.0", "aos": "^2.3.4", "axios": "^1.5.1", + "dotenv": "^16.4.5", "framer-motion": "^11.1.9", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/server/config/database.js b/server/config/database.js index 44cfef0..820c338 100644 --- a/server/config/database.js +++ b/server/config/database.js @@ -5,6 +5,7 @@ require("dotenv").config(); const dbConnect = () =>{ mongoose.connect(process.env.DATABASE_URL,{ + useNewUrlParser : true, useUnifiedTopology : true, }) diff --git a/server/server.js b/server/server.js index 62f7e99..0339668 100644 --- a/server/server.js +++ b/server/server.js @@ -1,10 +1,13 @@ const express = require("express"); const app = express(); +const dotenv = require('dotenv') +dotenv.config({path : ".env"}); const cors = require("cors"); var cookieParser = require("cookie-parser"); const PORT = process.env.PORT || 4000; const cloudinaryConfig = require("./config/cloudinaryConfig"); + app.use( cors({ origin: "*", diff --git a/src/index.js b/src/index.js index bda112c..062e0e2 100644 --- a/src/index.js +++ b/src/index.js @@ -4,7 +4,6 @@ import './index.css'; import App from './App'; import { BrowserRouter } from 'react-router-dom'; import { Toaster } from 'react-hot-toast'; - const root = ReactDOM.createRoot(document.getElementById('root')); root.render( diff --git a/src/pages/Login.jsx b/src/pages/Login.jsx index b359ecd..98a9edd 100644 --- a/src/pages/Login.jsx +++ b/src/pages/Login.jsx @@ -13,6 +13,7 @@ function Login() { password: "", }); const [showPassword, setShowPassword] = useState(false); + const [loading, setLoading] = useState(false) const navigate = useNavigate(); function changeHandler(event) { @@ -23,7 +24,7 @@ function Login() { } - function submitHandler(event) { + async function submitHandler(event) { event.preventDefault(); @@ -32,17 +33,22 @@ function Login() { if(formData.accountType === "User"){ - const apiUrl = `${process.env.REACT_APP_BASE_URL}/studentLogin`; - // const apiUrl = `http://localhost:4000/api/v1/studentLogin`; + // const apiUrl = `${process.env.REACT_APP_BASE_URL}/studentLogin`; + const apiUrl = `http://localhost:4000/api/v1/studentLogin`; - axios.post(apiUrl , formData) - .then((response)=>{ - toast.success("User Logged in "); + try { + setLoading(true); + + const response = await axios.post(apiUrl, formData); + + toast.success("Unable to login!"); navigate("/home"); - }) - .catch((error)=>{ - toast.error("Failed to login") - }); + } catch (error) { + toast.error("Failed To Login. Please try again."); + console.error(error); + } finally { + setLoading(false); + } } else{ @@ -128,8 +134,8 @@ function Login() {
- diff --git a/src/pages/Signup.jsx b/src/pages/Signup.jsx index e6a6005..78464c7 100644 --- a/src/pages/Signup.jsx +++ b/src/pages/Signup.jsx @@ -22,7 +22,7 @@ function Signup() { const [numberValidated, setNumberValidated] = useState(false); const [specialValidated, setSpecialValidated] = useState(false); const [lengthValidated, setLengthValidated] = useState(false); - + const [loading, setLoading] = useState(false); const navigate = useNavigate(); @@ -78,38 +78,43 @@ function Signup() { })); } - function submitHandler(event) { + async function submitHandler(event) { event.preventDefault(); console.log("ENV FILE",process.env.REACT_APP_BASE_URL); if (lowerValidated && upperValidated && numberValidated && specialValidated && lengthValidated) { if (formData.accountType === "User") { - // const apiUrl = `${process.env.REACT_APP_BASE_URL}/studentSignup`; - const apiUrl = `http://localhost:4000/api/v1/studentSignup`; - - axios - .post(apiUrl, formData) - .then((response) => { - toast.success("Account Created succesfully"); - navigate("/home"); - }) - .catch((error) => { - toast.error("Failed To create account"); - }); + // const apiUrl = `${process.env.REACT_APP_BASE_URL}/studentSignup`; + const apiUrl = `http://localhost:8000/api/v1/studentSignup`; + try { + setLoading(true); + + const response = await axios.post(apiUrl, formData); + + toast.success("Account Created Successfully!"); + navigate("/home"); + } catch (error) { + toast.error("Failed To Create Account. Please try again."); + console.error(error); + } finally { + setLoading(false); + } } else { - const apiUrl = `${process.env.REACT_APP_BASE_URL}/canteenSignup`; - - - axios - .post(apiUrl, formData) - .then((response) => { - toast.success("Account Created succesfully"); - navigate(`/section/${response.data.cantId}`); - }) - .catch((error) => { - console.log("Errorrr:->",error); - toast.error("Failed To create account"); - }); + const apiUrl = `http://localhost:8000/api/v1/canteenSignup` + // const apiUrl = `${process.env.REACT_APP_BASE_URL}/canteenSignup`; + try { + setLoading(true); + + const response = await axios.post(apiUrl, formData); + + toast.success("Account Created Successfully!"); + navigate("/home"); + } catch (error) { + toast.error("Failed To Create Account. Please try again."); + console.error(error); + } finally { + setLoading(false); + } } } else { toast.error("Password must pass all the criteria"); @@ -221,8 +226,9 @@ function Signup() { From 771c44071a9f5715aada05a10fa24e3a816dbb65 Mon Sep 17 00:00:00 2001 From: Hack2Health Date: Wed, 5 Jun 2024 13:50:34 +0530 Subject: [PATCH 09/19] Updated Footer Signed-off-by: Hemashree M S --- src/components/Footer.jsx | 57 ++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/src/components/Footer.jsx b/src/components/Footer.jsx index 1dbdda3..7292143 100644 --- a/src/components/Footer.jsx +++ b/src/components/Footer.jsx @@ -1,23 +1,36 @@ -import { Link } from "react-router-dom" +import React from 'react'; -export default function Footer(){ - return ( -
-
- - title - -

Discover culinary bliss with our diverse array of recipes and foodie resources – your ultimate destination for gastronomic inspiration.

-
    -
  • - About -
  • -
  • - News -
  • -
- © 2024-2025 Foodies™. All Rights Reserved. -
-
- ) -} \ No newline at end of file +const Footer = () => { + return ( +
+
+
+ +
+
+
+

Company

+ +
+
+

Legal Pages

+
    +
  • Privacy Policy
  • +
  • Terms and Conditions
  • +
  • Licensing
  • +
+
+
+
+
+ © 2024-2025 Foodies™. All Rights Reserved. +
+
+ ) +} + +export default Footer \ No newline at end of file From 9a91f6a354ab71db57cf3bf12dc544e84a6c7c5a Mon Sep 17 00:00:00 2001 From: Hack2Health Date: Wed, 5 Jun 2024 15:05:39 +0530 Subject: [PATCH 10/19] Updated Footer.jsx Signed-off-by: Hemashree M S --- src/components/Footer.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Footer.jsx b/src/components/Footer.jsx index 7292143..407dda8 100644 --- a/src/components/Footer.jsx +++ b/src/components/Footer.jsx @@ -9,7 +9,7 @@ const Footer = () => {
-

Company

+

Company

-

Legal Pages

+

Legal Pages

  • Privacy Policy
  • Terms and Conditions
  • From 57f3331f7149acceaeae12a30dd21749572f5b35 Mon Sep 17 00:00:00 2001 From: Abhigna Arsam <125258286+Abhigna-arsam@users.noreply.github.com> Date: Wed, 5 Jun 2024 18:33:40 +0530 Subject: [PATCH 11/19] Update README.md --- README.md | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 69fba0f..1c16aed 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,30 @@ image

    Connecting You to Your College Canteens

    + + + + + + + + + + + + + + + + + + + + + +
    🌟 Stars🍴 Forks🐛 Issues🔔 Open PRs🔕 Close PRs last commit
    StarsForksIssuesOpen Pull RequestsClose Pull RequestsClose Pull Requests
    +
+ # Tech Stacks ![](https://img.shields.io/badge/React-61DAFB?style=for-the-badge&logo=react&color=blue) @@ -163,5 +187,13 @@ To learn React, check out the [React documentation](https://reactjs.org/). -

Thank you for being a part of this project! +

Our Contributors ❤️

+
+

Thank you for being a part of this project!

+ +![Contributors](https://contrib.rocks/image?repo=VanshKing30/FoodiesWeb)
+ + +
+

(Back to top)

From 3dca5e0846575588b8ce57f88f266af0afad8b7b Mon Sep 17 00:00:00 2001 From: Hack2Health Date: Wed, 5 Jun 2024 20:26:59 +0530 Subject: [PATCH 12/19] Added Legal Pages Signed-off-by: Hemashree M S --- src/App.js | 6 +++ src/components/Footer.jsx | 6 +-- src/pages/Licensing.jsx | 53 +++++++++++++++++++++++ src/pages/PrivacyPolicy.jsx | 74 ++++++++++++++++++++++++++++++++ src/pages/TermsandConditions.jsx | 49 +++++++++++++++++++++ 5 files changed, 185 insertions(+), 3 deletions(-) create mode 100644 src/pages/Licensing.jsx create mode 100644 src/pages/PrivacyPolicy.jsx create mode 100644 src/pages/TermsandConditions.jsx diff --git a/src/App.js b/src/App.js index fa87545..83bb81f 100644 --- a/src/App.js +++ b/src/App.js @@ -11,6 +11,9 @@ import SectionPage from './pages/SectionPage'; import News from './pages/News'; import NotFound from './pages/NotFound'; import Loader from './components/Loader/Loader'; +import PrivacyPolicy from './pages/PrivacyPolicy'; +import TermsandConditions from './pages/TermsandConditions'; +import Licensing from './pages/Licensing'; const Layout = ({ children }) => { return ( @@ -32,6 +35,9 @@ function App() { } /> } /> }/> + }/> + }/> + }/> }/> } /> diff --git a/src/components/Footer.jsx b/src/components/Footer.jsx index 407dda8..653d4a3 100644 --- a/src/components/Footer.jsx +++ b/src/components/Footer.jsx @@ -19,9 +19,9 @@ const Footer = () => {

Legal Pages

diff --git a/src/pages/Licensing.jsx b/src/pages/Licensing.jsx new file mode 100644 index 0000000..2d4cbea --- /dev/null +++ b/src/pages/Licensing.jsx @@ -0,0 +1,53 @@ +import Aos from 'aos'; +import React, { useEffect, useState } from 'react'; +import "aos/dist/aos.css"; +import Loader from '../components/Loader/Loader'; +import Navbar from '../components/Navbar'; +import Footer from '../components/Footer'; + +const Licensing = () => { + const [loading, setLoading] = useState(false); + + useEffect(() => { + setLoading(true); + Aos.init({ duration: 800 }); + setLoading(false); + }, []); + + return ( + <> + {loading ? ( + + ) : ( +
+ +
+

Licensing

+
+

Welcome to Foodies, your ultimate college dining companion! By accessing and using the Foodies mobile application, you agree to be bound by the following licensing terms:


+

1. License Grant


+

Subject to your compliance with these terms and conditions, Foodies grants you a limited, non-exclusive, non-transferable, revocable license to use the Foodies mobile application for your personal, non-commercial use.


+

2. Restrictions


+

You may not:


+
    +
  • Modify, adapt, or create derivative works of the Foodies app.
  • +
  • Reverse engineer, decompile, or disassemble the Foodies app.
  • +
  • Use the Foodies app for any illegal or unauthorized purpose.
  • +
  • Remove or alter any copyright, trademark, or other proprietary notices from the Foodies app.
  • +
+

3. Ownership


+

Foodies retains all rights, title, and interest in and to the Foodies mobile application, including all intellectual property rights.


+

4. Termination


+

This license is effective until terminated by you or Foodies. Foodies may terminate this license at any time without notice if you breach any of these terms and conditions.


+

5. Contact Us


+

If you have any questions, concerns, or feedback about the licensing terms, please contact us at contact@foodiesapp.com.

+
+
+
+
+ )} + + ) +} + +export default Licensing; diff --git a/src/pages/PrivacyPolicy.jsx b/src/pages/PrivacyPolicy.jsx new file mode 100644 index 0000000..41dfd7c --- /dev/null +++ b/src/pages/PrivacyPolicy.jsx @@ -0,0 +1,74 @@ +import Aos from 'aos'; +import React, { useEffect, useState } from 'react'; +import "aos/dist/aos.css"; +import Loader from '../components/Loader/Loader'; +import Navbar from '../components/Navbar'; +import Footer from '../components/Footer'; + +const PrivacyPolicy = () => { + const [loading, setLoading] = useState(false); + + useEffect(() => { + setLoading(true); + Aos.init({ duration: 800 }); + setLoading(false); + }, []); + + return ( + <> + {loading ? ( + + ) : ( +
+ +
+

Privacy Policy

+
+

Welcome to Foodies, your ultimate college dining companion! At Foodies, we are committed to ensuring the privacy and security of our users' personal information. This Privacy Policy outlines how we collect, use, and protect your data when you use our platform. By using Foodies, you agree to the practices described in this Privacy Policy.


+

1. Information We Collect


+
    +
  • Personal Information: When you sign up for Foodies, we collect certain personal information such as your name, email address, and college affiliation.
  • +
  • Usage Data: We may collect information about how you interact with our platform, including your browsing history, search queries, and preferences.
  • +
  • Location Information: With your consent, we may collect your precise or approximate location to provide you with relevant dining options and services.
  • +
  • Device Information: We may collect information about the device you use to access Foodies, including your device type, operating system, and unique device identifiers.
  • +
+

2. How We Use Your Information


+
    +
  • Providing Services: We use the information we collect to provide you with access to our platform, including personalized dining recommendations, menu exploration, and nutritional insights.
  • +
  • Improving User Experience: We analyze usage data to improve and optimize our platform, enhance user experience, and develop new features.
  • +
  • Communication: We may use your contact information to send you important updates, announcements, and promotional offers related to Foodies.
  • +
  • Personalization: We use your data to personalize your experience on Foodies, including recommending dining options based on your preferences and dietary restrictions.
  • +
+

3. Data Security


+
    +
  • Encryption: We employ industry-standard security measures to protect your personal information from unauthorized access, disclosure, alteration, or destruction.
  • +
  • User Authentication: We use secure authentication mechanisms to ensure that only authorized users can access their account information.
  • +
  • Data Minimization: We only collect and retain the information necessary to provide our services and fulfill our legal obligations.
  • +
+

4. Sharing of Information


+
    +
  • Third-Party Service Providers: We may share your information with trusted third-party service providers who assist us in operating our platform, processing payments, or delivering services.
  • +
  • Legal Compliance: We may disclose your information if required to do so by law or in response to valid legal requests from law enforcement authorities or other government agencies.
  • +
+

5. Your Choices


+
    +
  • Opt-Out: You can opt-out of receiving promotional communications from Foodies by following the instructions provided in our emails or by contacting us directly.
  • +
  • Access and Update: You can access and update your personal information by logging into your Foodies account and navigating to the settings section.
  • +
  • Location Sharing: You can control whether to share your location information with Foodies through your device settings or app permissions.
  • +
+

6. Children's Privacy


+

Foodies is not intended for use by children under the age of 13. We do not knowingly collect personal information from children under 13. If you believe that we have inadvertently collected personal information from a child under 13, please contact us immediately so that we can take appropriate action.


+

7. Changes to this Privacy Policy


+

We may update this Privacy Policy from time to time to reflect changes in our practices or for other operational, legal, or regulatory reasons. We will notify you of any material changes by posting the updated Privacy Policy on our website or through other communication channels.


+

8. Contact Us


+

If you have any questions, concerns, or feedback about this Privacy Policy or our privacy practices, please contact us at contact@foodiesapp.com.

+
+
+
+
+ )} + + ) +} + +export default PrivacyPolicy; diff --git a/src/pages/TermsandConditions.jsx b/src/pages/TermsandConditions.jsx new file mode 100644 index 0000000..9516cbd --- /dev/null +++ b/src/pages/TermsandConditions.jsx @@ -0,0 +1,49 @@ +import Aos from 'aos'; +import React, { useEffect, useState } from 'react'; +import "aos/dist/aos.css"; +import Loader from '../components/Loader/Loader'; +import Navbar from '../components/Navbar'; +import Footer from '../components/Footer'; + +const TermsAndConditions = () => { + const [loading, setLoading] = useState(false); + + useEffect(() => { + setLoading(true); + Aos.init({ duration: 800 }); + setLoading(false); + }, []); + + return ( + <> + {loading ? ( + + ) : ( +
+ +
+

Terms and Conditions

+
+

Welcome to Foodies, your ultimate college dining companion! By accessing and using the Foodies mobile application, you accept and agree to be bound by the following terms and conditions:


+

1. Use of the App


+

The Foodies app is intended for personal, non-commercial use only. You may not use the app for any illegal or unauthorized purpose. You agree to comply with all applicable laws and regulations when using the app.


+

2. User Accounts


+

In order to access certain features of the app, you may be required to create a user account. You are responsible for maintaining the security of your account and are liable for any activity that occurs under your account.


+

3. Content


+

The content provided on the Foodies app, including menus, nutritional information, and health news, is for informational purposes only. We do not guarantee the accuracy, completeness, or reliability of any content on the app.


+

4. Privacy


+

Your privacy is important to us. Please refer to our Privacy Policy to understand how we collect, use, and protect your personal information when you use the Foodies app.


+

5. Modifications to Terms


+

We reserve the right to modify or replace these terms and conditions at any time. Any changes will be effective immediately upon posting on the app. Your continued use of the app after any such changes constitutes your acceptance of the new terms and conditions.


+

6. Contact Us


+

If you have any questions, concerns, or feedback about these terms and conditions, please contact us at contact@foodiesapp.com.

+
+
+
+
+ )} + + ) +} + +export default TermsAndConditions; From 8a5b347c37ecb425d8a72cde9b4a47d6f60e75d4 Mon Sep 17 00:00:00 2001 From: Siddheya Kulkarni <115717746+Asymtode712@users.noreply.github.com> Date: Wed, 5 Jun 2024 23:03:26 +0530 Subject: [PATCH 13/19] created close-old-pr.yml --- .github/workflows/close-old-pr.yml | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/close-old-pr.yml diff --git a/.github/workflows/close-old-pr.yml b/.github/workflows/close-old-pr.yml new file mode 100644 index 0000000..32367c5 --- /dev/null +++ b/.github/workflows/close-old-pr.yml @@ -0,0 +1,34 @@ +name: Close Stale PRs + +on: + schedule: + - cron: '0 0 * * *' # Runs daily at midnight + pull_request: + types: + - opened + - reopened + - synchronize + +permissions: + pull-requests: write + issues: write + +jobs: + close_stale_prs: + runs-on: ubuntu-latest + permissions: + pull-requests: write + + steps: + - uses: actions/stale@v7 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-pr-message: 'This PR has been automatically closed due to inactivity from the owner for 15 days.' + days-before-pr-stale: 15 + days-before-pr-close: 0 + exempt-pr-author: false + exempt-pr-labels: '' + only-labels: '' + operations-per-run: 30 + remove-stale-when-updated: true + debug-only: false \ No newline at end of file From 9dc51b0ffa3153fbb370be05c37e3347015b8f32 Mon Sep 17 00:00:00 2001 From: AadiJain06 <160418101+AadiJain06@users.noreply.github.com> Date: Wed, 5 Jun 2024 23:44:11 +0530 Subject: [PATCH 14/19] Dark and Light Theme --- package.json | 1 - src/App.js | 41 +++++++++++++----------------- src/components/Footer.jsx | 53 +++++++++++++++------------------------ src/components/Navbar.jsx | 22 +++++++++++----- src/pages/About.jsx | 24 +++++++++--------- src/pages/Home.jsx | 2 +- src/pages/News.jsx | 4 +-- src/themeContext.js | 28 +++++++++++++++++++++ tailwind.config.js | 7 ++++++ 9 files changed, 104 insertions(+), 78 deletions(-) create mode 100644 src/themeContext.js diff --git a/package.json b/package.json index 8718817..e33361c 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,6 @@ "@testing-library/user-event": "^13.5.0", "aos": "^2.3.4", "axios": "^1.5.1", - "dotenv": "^16.4.5", "framer-motion": "^11.1.9", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/src/App.js b/src/App.js index 83bb81f..f4066a8 100644 --- a/src/App.js +++ b/src/App.js @@ -1,4 +1,3 @@ - import React from 'react'; import './App.css'; import { Route, Routes } from 'react-router-dom'; @@ -11,13 +10,11 @@ import SectionPage from './pages/SectionPage'; import News from './pages/News'; import NotFound from './pages/NotFound'; import Loader from './components/Loader/Loader'; -import PrivacyPolicy from './pages/PrivacyPolicy'; -import TermsandConditions from './pages/TermsandConditions'; -import Licensing from './pages/Licensing'; +import { ThemeProvider } from './themeContext'; const Layout = ({ children }) => { return ( -
+
{children}
); @@ -25,25 +22,23 @@ const Layout = ({ children }) => { function App() { return ( -
- - } /> - } /> - } /> - } /> - } /> - } /> - } /> - }/> - }/> - }/> - }/> - }/> - } /> - -
+ +
+ + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + +
+
); } export default App; - diff --git a/src/components/Footer.jsx b/src/components/Footer.jsx index 653d4a3..835ae98 100644 --- a/src/components/Footer.jsx +++ b/src/components/Footer.jsx @@ -1,36 +1,23 @@ import React from 'react'; -const Footer = () => { - return ( -
-
-
- -
-
-
-

Company

- -
-
-

Legal Pages

- -
-
-
-
- © 2024-2025 Foodies™. All Rights Reserved. -
-
- ) +export default function Footer(){ + return ( +
+
+ + title + +

Discover culinary bliss with our diverse array of recipes and foodie resources – your ultimate destination for gastronomic inspiration.

+
    +
  • + About +
  • +
  • + News +
  • +
+ © 2024-2025 Foodies™. All Rights Reserved. +
+
+ ) } - -export default Footer \ No newline at end of file diff --git a/src/components/Navbar.jsx b/src/components/Navbar.jsx index 5b20a5b..2dd725f 100644 --- a/src/components/Navbar.jsx +++ b/src/components/Navbar.jsx @@ -1,18 +1,20 @@ -import React, { useState } from "react"; +import React, { useState,useContext } from "react"; import { Link } from "react-router-dom"; import logo from "../assets/logo2.png"; import { motion, AnimatePresence,useScroll} from "framer-motion"; import { IoClose } from "react-icons/io5"; import { GiHamburgerMenu } from "react-icons/gi"; - +import { MdDarkMode } from "react-icons/md"; +import { ThemeContext } from '../themeContext'; const Navbar = () => { + const { theme, toggleTheme } = useContext(ThemeContext); const [isOpen, setIsOpen] = useState(false); const {scrollYProgress} = useScroll(); const toggleMenu = () => { setIsOpen(!isOpen); }; return ( -
-
+
+ +
+
+