Skip to content

Commit

Permalink
Merge pull request #2842 from Vin205/main
Browse files Browse the repository at this point in the history
Reading Mood Tracker
  • Loading branch information
RishabhDhawad authored Aug 10, 2024
2 parents 53d5f97 + 090c3b8 commit 5d5c3a1
Show file tree
Hide file tree
Showing 3 changed files with 268 additions and 0 deletions.
142 changes: 142 additions & 0 deletions assets/html/custom.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Virtual Bookshelves</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f5f5f5;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
flex-direction: column;
}

.bookshelf-container {
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
width: 500px;
}

h1 {
color: #333;
text-align: center;
}

.add-shelf-container, .bookshelves {
margin-top: 20px;
}

.add-shelf-container input {
padding: 10px;
width: calc(100% - 20px);
border-radius: 5px;
border: 1px solid #ccc;
margin-bottom: 10px;
}

.add-shelf-container button {
padding: 10px 20px;
background-color: #007BFF;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
width: 100%;
margin-bottom: 10px;
}

.add-shelf-container button:hover {
background-color: #0056b3;
}

.bookshelf {
margin-top: 10px;
padding: 10px;
background-color: #f0f0f0;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
}

.bookshelf h3 {
margin: 0;
margin-bottom: 10px;
font-size: 18px;
}

.bookshelf ul {
list-style-type: none;
padding: 0;
}

.bookshelf ul li {
padding: 5px;
background-color: #e9e9e9;
margin-bottom: 5px;
border-radius: 5px;
}
</style>
</head>
<body>

<div class="bookshelf-container">
<h1>Virtual Bookshelves</h1>

<div class="add-shelf-container">
<input type="text" id="shelfName" placeholder="Enter Bookshelf Name">
<button onclick="addShelf()">Add Bookshelf</button>
</div>

<div class="bookshelves" id="bookshelves">
<!-- Bookshelves will be dynamically added here -->
</div>
</div>

<script>
function addShelf() {
const shelfName = document.getElementById('shelfName').value;
if (shelfName.trim() === '') {
alert('Please enter a name for the bookshelf.');
return;
}

const bookshelfContainer = document.createElement('div');
bookshelfContainer.className = 'bookshelf';

const bookshelfTitle = document.createElement('h3');
bookshelfTitle.innerText = shelfName;

const bookList = document.createElement('ul');

const addBookButton = document.createElement('button');
addBookButton.innerText = 'Add Book';
addBookButton.onclick = function() {
const bookName = prompt('Enter the name of the book:');
if (bookName && bookName.trim() !== '') {
const bookItem = document.createElement('li');
bookItem.innerText = bookName;
bookList.appendChild(bookItem);
} else {
alert('Book name cannot be empty.');
}
};

bookshelfContainer.appendChild(bookshelfTitle);
bookshelfContainer.appendChild(bookList);
bookshelfContainer.appendChild(addBookButton);

document.getElementById('bookshelves').appendChild(bookshelfContainer);

document.getElementById('shelfName').value = ''; // Clear input field
}
</script>

</body>
</html>
116 changes: 116 additions & 0 deletions assets/html/mood.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Reading Mood Tracker</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f5f5f5;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}

.tracker-container {
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
text-align: center;
width: 300px;
}

h1 {
color: #333;
margin-bottom: 20px;
}

.mood-selection {
margin-bottom: 20px;
}

select {
padding: 10px;
width: 100%;
border-radius: 5px;
border: 1px solid #ccc;
margin-bottom: 20px;
}

button {
padding: 10px 20px;
background-color: #007BFF;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
width: 100%;
margin-bottom: 20px;
}

button:hover {
background-color: #0056b3;
}

.suggestion-box {
margin-top: 20px;
font-size: 18px;
color: #333;
}
</style>
</head>
<body>

<div class="tracker-container">
<h1>Reading Mood Tracker</h1>
<div class="mood-selection">
<label for="mood">Select Your Current Mood:</label>
<select id="mood">
<option value="happy">Happy</option>
<option value="sad">Sad</option>
<option value="motivated">Motivated</option>
<option value="relaxed">Relaxed</option>
<option value="adventurous">Adventurous</option>
</select>
</div>
<button onclick="suggestBook()">Get Book Suggestion</button>
<div id="suggestion" class="suggestion-box"></div>
</div>

<script>
function suggestBook() {
const mood = document.getElementById("mood").value;
let suggestion;

switch(mood) {
case "happy":
suggestion = "Try reading 'The Alchemist' by Paulo Coelho!";
break;
case "sad":
suggestion = "How about 'The Book Thief' by Markus Zusak?";
break;
case "motivated":
suggestion = "You might enjoy 'Atomic Habits' by James Clear.";
break;
case "relaxed":
suggestion = "'The Little Prince' by Antoine de Saint-Exupéry could be a good choice.";
break;
case "adventurous":
suggestion = "Check out 'The Hobbit' by J.R.R. Tolkien!";
break;
default:
suggestion = "Select a mood to get a book suggestion!";
break;
}

document.getElementById("suggestion").innerHTML = suggestion;
}
</script>

</body>
</html>
10 changes: 10 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@




/* Dark Mode Styles */
.dark-mode .readmore-anim {
font-size: 18px;
Expand Down Expand Up @@ -1384,6 +1385,12 @@
<li class="dropdown-menu-item">
<a href="./assets/html/ConnReader.html" class="navbar-link" data-nav-link><i class="ri-price-tag-3-fill"></i>Reader Connection</a>
</li>
<li class="dropdown-menu-item">
<a href="./assets/html/mood.html" class="navbar-link">Reading Mood Tracker</a>
</li>
<li class="dropdown-menu-item">
<a href="./assets/html/custom.html" class="navbar-link">Virtual Bookshelves</a>
</li>
<li class="dropdown-menu-item">
<a href="./assets/html/quiz.html" class="navbar-link">Quizes</a>
</li>
Expand Down Expand Up @@ -2894,6 +2901,9 @@ <h3 class="card-sty" style="text-align: center;">Organizations</h3>






<!-- rate us -->


Expand Down

0 comments on commit 5d5c3a1

Please sign in to comment.