From 7f8223677e3bcf2688d9b1e8e0b54add88d01e22 Mon Sep 17 00:00:00 2001 From: shriyakalakata Date: Mon, 4 Mar 2024 02:02:43 -0500 Subject: [PATCH 1/5] Fix search bar bug --- templates/decks.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/decks.html b/templates/decks.html index 7e11833..cce0a19 100644 --- a/templates/decks.html +++ b/templates/decks.html @@ -34,7 +34,7 @@

{{ deck.title }}

searchBar.addEventListener("input", function() { const searchTerm = searchBar.value.toLowerCase(); deckLinks.forEach(function(link) { - const deckTitle = link.querySelector(".deck-title").textContent.toLowerCase(); + const deckTitle = link.querySelector("h3").textContent.toLowerCase(); if (deckTitle.includes(searchTerm)) { link.style.display = "block"; } else { From 9e8165494042201f56725dbf3b364cb108ec34e0 Mon Sep 17 00:00:00 2001 From: shriyakalakata Date: Mon, 4 Mar 2024 02:58:56 -0500 Subject: [PATCH 2/5] Change and move delete deck button --- static/css/style.css | 8 ++++++++ templates/decks.html | 10 +++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/static/css/style.css b/static/css/style.css index fb26fc6..e82e917 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -55,7 +55,15 @@ p a{ } .delete-deck { + position: relative; font-size: 40px; + top: 50; + left: 0; + color: #5e4d47; + background-color: transparent; + border: none; + cursor: pointer; + font-weight: bold; } .add-deck h3 { diff --git a/templates/decks.html b/templates/decks.html index cce0a19..6efb367 100644 --- a/templates/decks.html +++ b/templates/decks.html @@ -15,13 +15,13 @@

{{ deck.title }}

{% endfor %} {% for deck in personalDecks %} -
- - - -
>
+
+ + + +

{{ deck.title }}

From e6069fa32f93ac194d4b88a409ab8fe4ca826f39 Mon Sep 17 00:00:00 2001 From: shriyakalakata Date: Mon, 4 Mar 2024 03:13:45 -0500 Subject: [PATCH 3/5] Clean up unused CSS --- static/css/style.css | 50 -------------------------------------------- 1 file changed, 50 deletions(-) diff --git a/static/css/style.css b/static/css/style.css index e82e917..533fde7 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -132,34 +132,6 @@ p a{ } -/* #add-deck-form { - position: fixed; - top: 50%; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - display: flex; - flex-direction: column; - justify-content: space-evenly; - margin: auto; - width: 90%; - aspect-ratio: 8 / 5; - padding: 10px; - margin-bottom: 10%; - border-radius: .5rem; - background: #7F5F59; - text-align: center; -} */ - -/* #add-deck-form input[type=submit] { - color: #63514F; - background: #D9D9D9; - text-align: center; - font-size: 55px; - border-radius: .5rem; - padding: 40px; -} */ - #add-deck-form input[type=text] { color: #fafafa; background-color: transparent; @@ -170,32 +142,10 @@ p a{ } -/* #add-deck-form label { - color: #D9D9D9; - text-align: center; - font-size: 55px; - border-radius: .5rem; -} */ - #add-deck-form p { - /* position: absolute; */ - /* top: .1rem; */ - /* left: 1rem; */ color: #fafafa; - /* margin: 0; */ } -/* .add-deck-input { - display: flex; - justify-content: space-between; - flex-direction: column; - align-items: center; - margin: auto; - width: 90%; - aspect-ratio: 9 / 5; - -} */ - .vertical-align { display: flex; justify-content: space-between; From a0f6c185aff28393aae6a1c27e148402c8bdaca8 Mon Sep 17 00:00:00 2001 From: shriyakalakata Date: Mon, 4 Mar 2024 03:40:59 -0500 Subject: [PATCH 4/5] Fix bug: don't allow decks with duplicate names --- app.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app.py b/app.py index ca72d1a..c324c1f 100644 --- a/app.py +++ b/app.py @@ -90,6 +90,13 @@ def createDeck(username): if (not current_user.is_authenticated or current_user.id != username): return redirect(url_for('login')) title = request.form["title"] + + # Check if the title already exists in personalDecks + existingDeck = db.users.find_one({"user_id": username, "personalDecks.title": title}) + # if title already exists, don't create new deck + if existingDeck: + return redirect(url_for('allDecks', username=username)) + newDeck = {"title": title, "cards": []} db.users.update_one({"user_id": username}, {"$push": {"personalDecks": newDeck}}) # would rendirect to decks From cd848481e84d45d1f162f6bd21ba14801219ea1f Mon Sep 17 00:00:00 2001 From: shriyakalakata Date: Mon, 4 Mar 2024 03:55:08 -0500 Subject: [PATCH 5/5] Move login/signup error messages to outside the card --- static/css/style.css | 2 +- templates/login.html | 6 +++--- templates/signup.html | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/static/css/style.css b/static/css/style.css index 533fde7..e1097c2 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -222,7 +222,7 @@ p a{ } .signup-error, .login-error { - font-size: 25px; + font-size: 30px; } .search-container { diff --git a/templates/login.html b/templates/login.html index f2130c9..a629446 100644 --- a/templates/login.html +++ b/templates/login.html @@ -6,11 +6,11 @@
- {% if invalid_login %} - - {% endif %}
+{% if invalid_login %} + +{% endif %} {% endblock %} diff --git a/templates/signup.html b/templates/signup.html index d659d7b..fa9a946 100644 --- a/templates/signup.html +++ b/templates/signup.html @@ -10,11 +10,11 @@ {% endif %} - {% if passwords_dont_match %} - - {% endif %} +{% if passwords_dont_match %} + +{% endif %} {% endblock %}