-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/arpita-32/WordWise
- Loading branch information
Showing
47 changed files
with
6,939 additions
and
3,284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
document.addEventListener('DOMContentLoaded', function () { | ||
const slides = document.querySelector('.slides'); | ||
const radioButtons = document.querySelectorAll('input[name="radio-btn"]'); | ||
const labels = document.querySelectorAll('.manual-btn'); | ||
const prevButton = document.getElementById('prevSlide'); | ||
const nextButton = document.getElementById('nextSlide'); | ||
let currentSlide = 0; | ||
|
||
function showSlide(index) { | ||
slides.style.transform = `translateX(-${index * 14.29}%)`; | ||
radioButtons[index].checked = true; | ||
updateActiveLabel(index); | ||
} | ||
|
||
function updateActiveLabel(index) { | ||
labels.forEach((label, i) => { | ||
if (i === index) { | ||
label.classList.add('active'); | ||
} else { | ||
label.classList.remove('active'); | ||
} | ||
}); | ||
} | ||
|
||
function nextSlide() { | ||
currentSlide = (currentSlide + 1) % radioButtons.length; | ||
showSlide(currentSlide); | ||
} | ||
function prevSlide() { | ||
currentSlide = (currentSlide - 1 + radioButtons.length) % radioButtons.length; | ||
showSlide(currentSlide); | ||
} | ||
|
||
// Add click event listeners to radio buttons | ||
radioButtons.forEach((radio, index) => { | ||
radio.addEventListener('click', () => { | ||
currentSlide = index; | ||
showSlide(currentSlide); | ||
}); | ||
}); | ||
|
||
// Add click event listeners to Prev and Next buttons | ||
prevButton.addEventListener('click', prevSlide); | ||
nextButton.addEventListener('click', nextSlide); | ||
|
||
// Show first slide initially | ||
showSlide(0); | ||
|
||
// Automatic slide change | ||
setInterval(nextSlide, 5000); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import feedback from "../models/feedback.js"; | ||
|
||
export async function saveFeedback(req, resp) { | ||
try { | ||
const { name, userfeedback, email, rating } = req.body; | ||
|
||
if (!name || !userfeedback || !email || typeof rating !== "number") { | ||
return resp.status(400).json({ message: "All fields are required." }); | ||
} | ||
|
||
const newfeedback = new feedback({ name, userfeedback, email, rating }); | ||
|
||
// Save feedback to the database | ||
await newfeedback.save(); | ||
|
||
// Respond with success message | ||
resp | ||
.status(201) | ||
.json({ message: "Feedback saved successfully!", newfeedback }); | ||
} catch (error) { | ||
console.error("Error saving feedback:", error); | ||
resp.status(500).json({ message: "Failed to save feedback.", error }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { mongoose } from "mongoose"; | ||
|
||
const commentSchema = new mongoose.Schema( | ||
{ | ||
name: { | ||
type: String, | ||
required: true, | ||
trim: true, | ||
}, | ||
comment: { | ||
type: String, | ||
required: true, | ||
trim: true, | ||
}, | ||
}, | ||
{ timestamps: true } | ||
); | ||
|
||
const Comment = mongoose.model("Comment", commentSchema); | ||
|
||
export default Comment; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { mongoose } from "mongoose"; | ||
|
||
const feedbackSchema = new mongoose.Schema( | ||
{ | ||
name: { | ||
type: String, | ||
required: true, | ||
trim: true, | ||
}, | ||
userfeedback: { | ||
type: String, | ||
required: true, | ||
trim: true, | ||
}, | ||
email: { | ||
type: String, | ||
required: true, | ||
}, | ||
rating: { | ||
type: Number, | ||
required: true, | ||
}, | ||
}, | ||
{ timestamps: true } | ||
); | ||
|
||
const feedback = mongoose.model(" feedback", feedbackSchema); | ||
|
||
export default feedback; |
Oops, something went wrong.