Skip to content

Commit

Permalink
Merge branch 'main' into Feedbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
hustlerZzZ authored Jul 30, 2024
2 parents 32e4428 + 9606082 commit bc01f15
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 24 deletions.
28 changes: 17 additions & 11 deletions server/controllers/feedbackController.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,24 @@ const getFeedbacksByCanteen = asyncHandler(async (req, res) => {
res.status(200).json(feedbacks);
});

const submitFeedback = asyncHandler(async (req, res) => {
const { message, canteenId ,userId} = req.body;


if (!message || !canteenId) {
res.status(400);
throw new Error('Message and Canteen ID are required');
const submitFeedback = asyncHandler(async (req, res) => {
// Validate request inputs
const errors = validationResult(req);
if (!errors.isEmpty()) {
return res.status(400).json({ errors: errors.array() });
}
const { message, canteenId, userId } = req.body;
try {
const feedback = new Feedback({ message, canteenId, userId });
await feedback.save();
res.status(201).json({ message: 'Feedback submitted successfully' });
} catch (error) {
console.error('Error submitting feedback:', error); // Log the error for debugging
res.status(500).json({ error: 'Server error, could not submit feedback' });
}

const feedback = new Feedback({ message, canteenId, userId });
await feedback.save();
res.status(201).json({ message: 'Feedback submitted successfully' });
});

module.exports = { submitFeedback ,getFeedbacksByCanteen };

module.exports = { submitFeedback ,getFeedbacksByCanteen };

4 changes: 4 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
.App {
text-align: center;
}
input::-ms-reveal,
input::-ms-clear {
display: none;
}

.App-logo {
height: 40vmin;
Expand Down
6 changes: 6 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const config = {
apiBaseUrl: process.env.REACT_APP_API_BASE_URL || 'http://localhost:5000',
// Add other configuration settings here
};

export default config;
31 changes: 20 additions & 11 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,33 +1,42 @@
/* Import Tailwind base, components, and utilities */
@tailwind base;
@tailwind components;
@tailwind utilities;
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap');

/* Import Google Font 'Poppins' */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap');

/* General body styling */
body {
margin: 0;
font-family: 'Poppins' , sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: 'Poppins', sans-serif; /* Use Poppins font */
-webkit-font-smoothing: antialiased; /* Smooth fonts for Webkit browsers */
-moz-osx-font-smoothing: grayscale; /* Smooth fonts for macOS browsers */
}

/* Styling for code elements */
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace; /* Use monospace font for code */
}
.text-3xl{

/* Custom margin for text with class 'text-3xl' */
.text-3xl {
margin-top: 80px;
margin-bottom: 40px;
}
::-webkit-scrollbar{

/* Hide scrollbar in Webkit browsers */
::-webkit-scrollbar {
display: none;
}

.Nav__item{
font-size: 12px !important;
font-weight: bolder !important;
/* Styling for navigation items */
.Nav__item {
font-size: 12px !important;
font-weight: bolder !important;
}

/* Hide scrollbar in Firefox and IE/Edge */
* {
scrollbar-width: none; /* Firefox */
-ms-overflow-style: none; /* IE, Edge */
Expand Down
8 changes: 8 additions & 0 deletions src/pages/ContactUs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ const Contact = () => {

const handleEmailSubmit = async (e) => {
e.preventDefault();
if (!form.name || !form.email || !form.message) {
alert("Please fill in all fields before submitting.");
return; // Stop further processing if form is incomplete
}
setLoading(true);

try {
Expand Down Expand Up @@ -62,6 +66,10 @@ const Contact = () => {
};
const handleSaveToDB = async (e) => {
e.preventDefault();
if (!form.name || !form.email || !form.message) {
alert("Please fill in all fields before submitting.");
return; // Stop further processing if form is incomplete
}
setLoading(true);

try {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Signup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function Signup() {
});

const [showConfirmPassword, setShowConfirmPassword] = useState(false);
const [showPassword, setShowPassword] = useState(false);
const [showPassword, setShowPassword] = useState(true);
const [lowerValidated, setLowerValidated] = useState(false);
const [upperValidated, setUpperValidated] = useState(false);
const [numberValidated, setNumberValidated] = useState(false);
Expand Down Expand Up @@ -177,7 +177,7 @@ function Signup() {
<input
required
className="w-full py-2 px-3 border border-gray-300 rounded-2xl"
type={showPassword ? "text" : "password"}
type={!showPassword ? "text" : "password"}
placeholder="Password"
name="password"
value={formData.password}
Expand Down

0 comments on commit bc01f15

Please sign in to comment.