From 2759b9b119e8225fb8e9c9b4cc38ab3a2595df4f Mon Sep 17 00:00:00 2001 From: Saksham2k3s Date: Wed, 3 Jul 2024 17:24:09 +0530 Subject: [PATCH 1/4] Solved issue 390 --- src/pages/Login.jsx | 2 +- src/pages/News.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/Login.jsx b/src/pages/Login.jsx index 7d03006..773752c 100644 --- a/src/pages/Login.jsx +++ b/src/pages/Login.jsx @@ -59,7 +59,7 @@ function Login() { const apiUrl = formData.accountType === "User" - ? 'http://localhost:4000/api/v1/studentLogin' : 'http://localhost:4000/api/v1/canteenLogin' + ? 'http://localhost:8000/api/v1/studentLogin' : 'http://localhost:8000/api/v1/canteenLogin' diff --git a/src/pages/News.jsx b/src/pages/News.jsx index 93fe3c8..0ca0f41 100644 --- a/src/pages/News.jsx +++ b/src/pages/News.jsx @@ -46,7 +46,7 @@ function News() {

Trending Food and Health News

-
+
{articles.map((article, index) => ( From e4187a6c7bf6c4d9d1ffa3a7d139731b31dae753 Mon Sep 17 00:00:00 2001 From: Saksham2k3s Date: Wed, 3 Jul 2024 18:08:35 +0530 Subject: [PATCH 2/4] Solved issue 391 --- src/components/NewsCard.jsx | 9 +++++++-- src/pages/Login.jsx | 2 +- src/pages/News.jsx | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/components/NewsCard.jsx b/src/components/NewsCard.jsx index df92e36..62dda98 100644 --- a/src/components/NewsCard.jsx +++ b/src/components/NewsCard.jsx @@ -1,9 +1,13 @@ import React from "react"; +import { Link } from "react-router-dom"; function NewsCard({ article }) { const { title, description, source, publishedAt, url, image } = article; console.log(image) - + const maxDescriptionLength = 100; + const truncatedDescription = description.length > maxDescriptionLength + ? description.substring(0, maxDescriptionLength) + "..." + : description; const defaultImage = "https://images.7news.com.au/publication/C-14905251/b0baa6a78bc17d1185f03003c8f7989917db9b9f-16x9-x0y75w800h450.jpg?imwidth=1200"; @@ -25,7 +29,8 @@ function NewsCard({ article }) {
{`${source.name} • ${new Date( publishedAt ).toLocaleString()}`}
-

{description}

+

{truncatedDescription}

+ Read More
{ fetchNews(process.env.REACT_APP_DEFAULT_QUERY); - }, []); + }, []); return ( <> @@ -49,7 +49,7 @@ function News() {
- {articles.map((article, index) => ( + {articles?.map((article, index) => ( ))}
From 59a6473bed78bb22eae3ecc0cb38b7d0c14fb934 Mon Sep 17 00:00:00 2001 From: Ayushmaanagarwal1121 Date: Wed, 3 Jul 2024 23:27:31 +0530 Subject: [PATCH 3/4] Fixed Issues --- src/pages/AddFoodItem.jsx | 10 +++++----- src/pages/EditProfile.jsx | 2 +- src/pages/Foodlist.jsx | 14 ++++++++------ src/pages/Rateus.jsx | 10 ++++++---- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/pages/AddFoodItem.jsx b/src/pages/AddFoodItem.jsx index 8264ef8..ee0cd2b 100644 --- a/src/pages/AddFoodItem.jsx +++ b/src/pages/AddFoodItem.jsx @@ -103,10 +103,10 @@ function AddFoodItem() { }; return ( -
+

Add Food Item

@@ -117,7 +117,7 @@ function AddFoodItem() { name="dish" value={formData.dish} onChange={handleChange} - className="w-full p-2 border border-gray-300 rounded mt-1" + className="w-full p-2 border border-gray-300 rounded mt-1 text-black" required />
@@ -128,7 +128,7 @@ function AddFoodItem() { name="dishId" value={formData.dishId} onChange={handleChange} - className="w-full p-2 border border-gray-300 rounded mt-1" + className="w-full p-2 border border-gray-300 rounded mt-1 text-black" required />
@@ -155,7 +155,7 @@ function AddFoodItem() { name="description" value={formData.description} onChange={handleChange} - className="w-full p-2 border border-gray-300 rounded mt-1" + className="w-full p-2 border border-gray-300 rounded mt-1 text-black" rows="3" >
diff --git a/src/pages/EditProfile.jsx b/src/pages/EditProfile.jsx index 00e4b72..65a718c 100644 --- a/src/pages/EditProfile.jsx +++ b/src/pages/EditProfile.jsx @@ -112,7 +112,7 @@ const EditProfile = () => { value={formData.name} disabled={!edit} onChange={handleChange} - className="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" + className={`shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline `} />
diff --git a/src/pages/Foodlist.jsx b/src/pages/Foodlist.jsx index f20f816..4113905 100644 --- a/src/pages/Foodlist.jsx +++ b/src/pages/Foodlist.jsx @@ -24,8 +24,7 @@ const Foodlist = () => { try { setLoading(true); const response = await fetch( - `${process.env.REACT_APP_BASE_URL}/${_id}/${mealType}`, - { + `${process.env.REACT_APP_BASE_URL}/${_id}/${mealType}`, { method: "GET", headers: { "Content-Type": "application/json", @@ -40,7 +39,10 @@ const Foodlist = () => { setLoading(false); } }; - + function handleClose(){ + setEditModal(false) + console.log(editModal) + } const handleDelete = async (dishId, mealType) => { try { const token = localStorage.getItem("token"); @@ -135,7 +137,7 @@ const Foodlist = () => { useEffect(() => { fetchData("breakfast", setBreakfast); fetchData("lunch", setLunch); - fetchData("dinner", setDinner); + fetchData("dinner", setLunch); }, [_id]); const handleDishClick = async (dishId) => { @@ -186,7 +188,7 @@ const Foodlist = () => { }; return ( -
+
@@ -363,7 +365,7 @@ const Foodlist = () => { {editModal && ( setEditModal(false)} + onCancel={handleClose} onUpdate={handleUpdateDish} /> )} diff --git a/src/pages/Rateus.jsx b/src/pages/Rateus.jsx index 14ac6d8..43e908d 100644 --- a/src/pages/Rateus.jsx +++ b/src/pages/Rateus.jsx @@ -1,12 +1,14 @@ -import React, { useState } from 'react'; +import React, { useState,useContext } from 'react'; import { ToastContainer, toast } from 'react-toastify'; import 'react-toastify/dist/ReactToastify.css'; import Footer from "../components/Footer"; import Navbar from "../components/Navbar"; +import { ThemeContext } from "../themeContext"; const RateUs = () => { const [rating, setRating] = useState(''); const [feedback, setFeedback] = useState(''); + const { theme } = useContext(ThemeContext); const handleRatingClick = (emoji) => { setRating(emoji); @@ -32,12 +34,12 @@ const RateUs = () => { }} > -
+
-

Rate Our Website

+

Rate Our Website

{['😢', '😡', '😐', '😊', '🤩'].map((emoji) => ( Date: Thu, 4 Jul 2024 02:50:33 +0800 Subject: [PATCH 4/4] Solved issue 393 --- src/pages/AddFoodItem.jsx | 3 +- src/pages/EditProfile.jsx | 66 +++++++++++++++++++++++++-------------- src/pages/Login.jsx | 2 +- src/pages/SectionPage.jsx | 2 ++ src/pages/Signup.jsx | 4 ++- 5 files changed, 50 insertions(+), 27 deletions(-) diff --git a/src/pages/AddFoodItem.jsx b/src/pages/AddFoodItem.jsx index 8264ef8..86b5b16 100644 --- a/src/pages/AddFoodItem.jsx +++ b/src/pages/AddFoodItem.jsx @@ -60,6 +60,7 @@ function AddFoodItem() { break; case "Dinner": apiUrl = `${process.env.REACT_APP_BASE_URL}/${canteenId}/dinner/add`; + console.log("This is api url",apiUrl); break; default: toast.error("Please select a meal type."); @@ -103,7 +104,7 @@ function AddFoodItem() { }; return ( -
+
{ const { _id } = useParams(); // Assuming you have canteen ID in the URL const navigate = useNavigate(); // useNavigate hook for navigation const [edit, setEditable] = useState(false); + const [editName, setEditName] = useState(false); + const [editEmail, setEditEmail] = useState(false); + const [editCollegeName, setEditCollegeName] = useState(false); + const [editImage, setEditImage] = useState(false); const [formData, setFormData] = useState({ name: '', email: '', @@ -93,12 +98,13 @@ const EditProfile = () => { return ( <> -
+

Edit Profile

@@ -106,52 +112,64 @@ const EditProfile = () => { - + + setEditName(!editName)} /> +
- + + setEditEmail(!editEmail)} /> +
- + + setEditCollegeName(!editCollegeName)} /> +
- + + setEditImage(!editImage)} /> +
{formData.canteenImage ? ( Canteen ) : ( @@ -159,7 +177,7 @@ const EditProfile = () => { )}
- {!edit && ( + {/* {!edit && ( - )} - {edit && ( + )} */} + <> - )}
diff --git a/src/pages/Login.jsx b/src/pages/Login.jsx index 7d03006..773752c 100644 --- a/src/pages/Login.jsx +++ b/src/pages/Login.jsx @@ -59,7 +59,7 @@ function Login() { const apiUrl = formData.accountType === "User" - ? 'http://localhost:4000/api/v1/studentLogin' : 'http://localhost:4000/api/v1/canteenLogin' + ? 'http://localhost:8000/api/v1/studentLogin' : 'http://localhost:8000/api/v1/canteenLogin' diff --git a/src/pages/SectionPage.jsx b/src/pages/SectionPage.jsx index 7589ec2..3076897 100644 --- a/src/pages/SectionPage.jsx +++ b/src/pages/SectionPage.jsx @@ -116,7 +116,9 @@ const SectionPage = () => { Product List
+
{view === "add" ? : } +
)}
diff --git a/src/pages/Signup.jsx b/src/pages/Signup.jsx index b6f6204..c30b3c1 100644 --- a/src/pages/Signup.jsx +++ b/src/pages/Signup.jsx @@ -66,7 +66,7 @@ function Signup() { // : `${process.env.REACT_APP_BASE_URL}/canteenSignup`; const apiUrl = formData.accountType === "User" - ? 'http://localhost:4000/api/v1/studentSignup' : 'http://localhost:4000/api/v1/canteenSignup' + ? 'http://localhost:8000/api/v1/studentSignup' : 'http://localhost:8000/api/v1/canteenSignup' @@ -74,6 +74,8 @@ function Signup() { setLoading(true); const response = await axios.post(apiUrl, formData); + + console.log("This is response", response.data); toast.success("Account Created Successfully!");