TheExkaliburg / MoreFair

Other
12 stars 17 forks source link

Combining successive Chat Messages #70

Open minotalen opened 2 years ago

minotalen commented 2 years ago

there's space and legibility wasted by displaying names multiple times. We can omit the name if a user sends multiple messages in a row.

vanilla js removal for illustration:

function removeDuplicateChatMessages() {
    let chatHead = document.getElementsByClassName('message-header');
    let prevName = null;
    for(let i= 0; i < chatHead.length; i++){
        if(prevName == chatHead[i].children[0].innerText) {
            chatHead[i].style.display = "none";
            prevName = chatHead[i];
        } 
        if(prevName = null) prevName = chatHead.children[0].innerText;
        else prevName = chatHead[i].children[0].innerText;
    }
}

Considerations:

AdrianEdelen commented 10 months ago

Would it make sense to re-attach the header if a certain amount of time has passed? this gives a new timestamp to differentiate one thought that is multiple messages versus a message with a significant time gap.