diff --git a/backend/Advanced b/backend/Advanced new file mode 100644 index 0000000..e69de29 diff --git a/backend/App b/backend/App new file mode 100644 index 0000000..e69de29 diff --git a/backend/Apps b/backend/Apps new file mode 100644 index 0000000..e69de29 diff --git a/backend/data/blooms.py b/backend/data/blooms.py index 7e280cf..f733220 100644 --- a/backend/data/blooms.py +++ b/backend/data/blooms.py @@ -16,6 +16,10 @@ class Bloom: def add_bloom(*, sender: User, content: str) -> Bloom: + + if len(content) > 280: + raise ValueError("Bloom content cannot exceed 280 characters") + hashtags = [word[1:] for word in content.split(" ") if word.startswith("#")] now = datetime.datetime.now(tz=datetime.UTC) @@ -27,7 +31,7 @@ def add_bloom(*, sender: User, content: str) -> Bloom: bloom_id=bloom_id, sender_id=sender.id, content=content, - timestamp=datetime.datetime.now(datetime.UTC), + timestamp=now, ), ) for hashtag in hashtags: diff --git a/front-end/components/bloom-form.mjs b/front-end/components/bloom-form.mjs index e047f9a..8afbbeb 100644 --- a/front-end/components/bloom-form.mjs +++ b/front-end/components/bloom-form.mjs @@ -55,4 +55,5 @@ function handleTyping(event) { counter.textContent = `${textarea.value.length} / ${maxLength}`; } + export {createBloomForm, handleBloomSubmit, handleTyping}; diff --git a/front-end/index.html b/front-end/index.html index 89d6b13..b1793d4 100644 --- a/front-end/index.html +++ b/front-end/index.html @@ -4,14 +4,14 @@ Purple Forest - +

Purple Forest Share a Bloom

Please enable JavaScript in your browser.

- + diff --git a/front-end/views/profile.mjs b/front-end/views/profile.mjs index dd2b92a..31139a9 100644 --- a/front-end/views/profile.mjs +++ b/front-end/views/profile.mjs @@ -39,8 +39,8 @@ function profileView(username) { createLogin ); document - .querySelector("[data-action='login']") - ?.addEventListener("click", handleLogin); + .querySelector("[data-form='login']") + ?.addEventListener("submit", handleLogin); const profileData = state.profiles.find((p) => p.username === username); if (profileData) {