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 diff --git a/static/css/style.css b/static/css/style.css index fb26fc6..e1097c2 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 { @@ -124,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; @@ -162,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; @@ -264,7 +222,7 @@ p a{ } .signup-error, .login-error { - font-size: 25px; + font-size: 30px; } .search-container { diff --git a/templates/decks.html b/templates/decks.html index 7e11833..6efb367 100644 --- a/templates/decks.html +++ b/templates/decks.html @@ -15,13 +15,13 @@

{{ deck.title }}

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

{{ deck.title }}

@@ -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 { 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 %} -

Password or username is invalid

- {% endif %}
+{% if invalid_login %} +

Password or username is invalid

+{% 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 %} -

The passwords don't match.

- {% endif %} +{% if passwords_dont_match %} +

The passwords don't match.

+{% endif %} {% endblock %}