Add fix for mobile poll and message break word #54 #53

This commit is contained in:
Alex
2023-09-17 19:18:03 +02:00
parent 57905368e2
commit 8bdf9e6e77
7 changed files with 27 additions and 6 deletions

View File

@@ -165,12 +165,14 @@ Hooks.PostForm = {
e.preventDefault()
submitBtn.click()
} else {
if (TA.value.length > 2) {
if (TA.value.length > 1 && TA.value.length < 256) {
submitBtn.classList.remove("opacity-50")
submitBtn.classList.add("opacity-100")
submitBtn.disabled = false
} else {
submitBtn.classList.add("opacity-50")
submitBtn.classList.remove("opacity-100")
submitBtn.disabled = true
}
}
},
@@ -198,12 +200,14 @@ Hooks.PostForm = {
updated() {
const submitBtn = document.getElementById("submitBtn")
const TA = document.getElementById("postFormTA")
if (TA.value.length > 2) {
if (TA.value.length > 1 && TA.value.length < 256) {
submitBtn.classList.remove("opacity-50")
submitBtn.classList.add("opacity-100")
submitBtn.disabled = false
} else {
submitBtn.classList.add("opacity-50")
submitBtn.classList.remove("opacity-100")
submitBtn.disabled = true
}
},
destroyed() {
@@ -480,6 +484,19 @@ window.addEventListener("phx:page-loading-stop", info => {
topbar.hide()
})
// Used to fix the scroll issue on mobile on poll panel
window.addEventListener("claper:toggle-poll", (event) => {
let extended = document.getElementById("extended-poll")
let parent = document.getElementById("poll-wrapper-parent")
if (extended.style.display == "block") {
parent.classList.add("overflow-y-auto")
parent.classList.add("h-full")
} else {
parent.classList.remove("overflow-y-auto")
parent.classList.remove("h-full")
}
})
const renderOnlineUsers = function(presences) {
let onlineUsers = Presence.list(presences, (_id, {metas: [user, ...rest]}) => {
return onlineUserTemplate(user);