Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Bgmi10 committed Jul 25, 2024
2 parents 373d726 + 7c29c34 commit 1fc434c
Show file tree
Hide file tree
Showing 21 changed files with 581 additions and 214 deletions.
28 changes: 27 additions & 1 deletion server/controllers/canteenController.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,32 @@ const getAllCanteen = async (req, res, next) => {
}
};

const getCanteenData = async(req, res) => {
const canteenId = req.params.id;
try {
const canteenData = await Canteen.findById(canteenId);
console.log("this is canteen",canteenData);
if(!canteenData){
res.status(500).json({
success: false,
message: "Error while fetching canteen data",
});
}

return res.status(200).json({
success: true,
data: canteenData,
message: "Canteen Data Successfully!",
});

} catch (error) {
res.status(500).json({
success: false,
message: "Error while fetching canteen data",
});
}
}

const getBreakfast = async (req, res, next) => {
try {
const id = req.params.id;
Expand Down Expand Up @@ -527,8 +553,8 @@ module.exports = {
updateBreakfastDish,
updateLunchDish,
updateDinnerDish,

feedback,
canteenFeedbackRender,
addSocialMediaLinks,
getCanteenData
};
18 changes: 18 additions & 0 deletions server/controllers/feedbackController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const asyncHandler = require('express-async-handler');
const Feedback = require("../models/studentfeeback");

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 feedback = new Feedback({ message, canteenId, userId });
await feedback.save();
res.status(201).json({ message: 'Feedback submitted successfully' });
});

module.exports = { submitFeedback };
4 changes: 4 additions & 0 deletions server/models/canteenLoginInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ const canteenSchema = new Schema({
canteenImage: {
type: String, // Assuming you're storing the URL or base64 string of the image
},
contactNumber : {
type : String,
default : ''
},
canteenSocialMediaLinks: {
Instagram: {
type: String,
Expand Down
11 changes: 11 additions & 0 deletions server/models/studentfeeback.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const mongoose = require('mongoose');
const Schema = mongoose.Schema;

const studentfeedbackSchema = new Schema({
message: { type: String, required: true },
canteenId: { type: mongoose.Schema.Types.ObjectId, ref: 'Canteen', required: true },
userId: { type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true },
createdAt: { type: Date, default: Date.now }
});

module.exports = mongoose.model('StudentFeedback', studentfeedbackSchema );
11 changes: 11 additions & 0 deletions server/routes/student.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ const express = require("express");
const { auth, studentAuth, isCanteen } = require("../middlewares/auth");
const router = express.Router();
const authController = require("../controllers/Auth");
<<<<<<< HEAD
const { getCanteenData } = require("../controllers/canteenController");
=======
const feedbackController = require("../controllers/feedbackController");
>>>>>>> 56cd98b40c82e9849270fe2c43ef735b8fe058bc

router.post("/studentSignup", authController.studentSignup);
router.post("/studentLogin", authController.studentLogin);
Expand All @@ -12,6 +17,12 @@ router.get("/resetPassword/:id/:token", authController.verifyLink);
router.post("/newPassword/:id/:token", authController.resetPassword);
router.get("/studentLogout", studentAuth, authController.studentLogout);
router.get("/canteenLogout", auth, authController.canteenLogout);
<<<<<<< HEAD
router.get("/canteen/:id", getCanteenData);
=======
router.post('/submitFeedback', feedbackController.submitFeedback);

>>>>>>> 56cd98b40c82e9849270fe2c43ef735b8fe058bc
router.post(
"/changeStudentPassword",
studentAuth,
Expand Down
8 changes: 7 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ import { ThemeProvider } from "./themeContext";
import ContactUs from "./pages/ContactUs";
import EditProfile from "./pages/EditProfile";
import OtpVerify from "./pages/OtpVerify";
// import Contributors from "./pages/Contributors";

import { Contributors } from "./pages/Contributors";
import Navbar from "./components/Navbar";


import Newss from "./components/Blog/newss";


const Layout = ({ children }) => {
return (
<div className="bg-cover bg-center min-h-screen bg-gradient-to-t from-blue-950 via-blue-950 to-gray-900 bg-no-repeat dark:bg-none ">
Expand Down Expand Up @@ -75,6 +80,7 @@ function App() {
<Route path="/login" element={<Login />} />
<Route path="/signup" element={<Signup />} />
<Route path="/contact" element={<ContactUs />} />
<Route path="/contributors" element={<Contributors/>}/>

{token ? (
<Route
Expand Down Expand Up @@ -177,7 +183,7 @@ function App() {
path="/news"
element={
<Layout>
<News />
<Newss />
</Layout>
}
/>
Expand Down
Binary file added src/assets/news1.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/news1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/news2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/news3.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
130 changes: 130 additions & 0 deletions src/components/Blog/newss.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
.BlogpageContainer_main{
background-color: var(--color-background);

}
.BlogpageContainer {
max-width: 1300px;
margin: auto;
display: flex;
align-items: center;
justify-content: center;
}

.BlogpageContainer_main .header {
text-align: left;
background-color: var(--color-primary);
opacity: 0.9;
width: 100%;
margin-bottom: 45px;
margin-top: 120px;
padding: 0px 20px;
display: flex;
align-items: center;
justify-content: flex-start;



}
.BlogpageContainer_main .header h1 {
font-size: 2.5em;
width: 100%;
text-align: center;
max-width: 1300px;
margin: auto;
font-weight: 700;
color: var(--color-text-primary);
}
.BlogpageContainer .container {
display: flex;
flex-wrap: wrap;
padding: 0px 20px;
justify-content: space-around;
gap: 20px;
margin-bottom: 60px;
}

.BlogpageContainer .card {
background: white;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
overflow: hidden;
width: calc(33% - 40px);
/* max-width: 300px; */
min-height: 300px;
margin: 10px;
cursor: pointer;
transition: transform 0.2s;
}

.BlogpageContainer .card:hover {
transform: translateY(-10px);
}

.BlogpageContainer .image {
width: 100%;
height: 150px;
object-fit: cover;
}

.BlogpageContainer .content1 {
padding: 15px;
}

.BlogpageContainer .content1 h2 {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;

overflow: hidden;
text-overflow: ellipsis;
font-weight: 600;
font-size: 1.5em;
margin: 0 0 10px 0;
transition: all 0.3s ease-in-out;
}
.BlogpageContainer .content1 h2:hover {
text-decoration: underline;
}

.BlogpageContainer .content1 p {
color: gray;
margin: 0;
}

/* Responsive styles */
@media (max-width: 1200px) {
.BlogpageContainer .card {
width: calc(33.33% - 40px); /* 3 cards per row */
}
.BlogpageContainer_main .header h1 {
font-size: 2rem;
}
}

@media (max-width: 900px) {
.BlogpageContainer_main .header h1 {
font-size: 1.75rem;
}
.BlogpageContainer .card {
width: calc(50% - 40px); /* 2 cards per row */
}
}

@media (max-width: 600px) {
.BlogpageContainer_main .header h1 {
font-size: 1.5rem;
}
.BlogpageContainer .container {
gap: 10px;
}
.BlogpageContainer .content1 h2 {
font-size: 0.9em;
}
.BlogpageContainer .content1 p {
font-size: 0.7em;
}
.BlogpageContainer .card {
width: 100%; /* 1 card per row */
min-height: auto;
}
}
Loading

0 comments on commit 1fc434c

Please sign in to comment.