function update_room_info_wrapper(room_code){
    // separate 2 by 2. Function called from separate_room_code.js
    separated_room_code = separateRoomCode(room_code)

    const wrapper = document.getElementById("room_info_wrapper")
    // Clear the wrapper element
    while(wrapper.firstChild){
        wrapper.removeChild(wrapper.firstChild)
    }

    // Create heading element to store room code in
    const room_code_heading = document.createElement("h2")
    room_code_heading.classList.add("font-weight-bold")
    room_code_heading.classList.add("text-center", "cursor-pointer")
    room_code_heading.addEventListener("click", copyRoomCode);
    // Add text to heading
    const text = document.createTextNode(separated_room_code)
    room_code_heading.appendChild(text)

    // Create join button
    const join_room_btn = document.createElement("a")
    join_room_btn.href = `/room/${room_code}`
    const join_room_btn_text = document.createTextNode("Join room now!")
    const btn_classes = ["d-block", "text-center", "remove-underline", "rounded", "shadow-sm", "border", "w-100", "py-2", "pink-bg", "text-white"]
    btn_classes.forEach(cls => {
        join_room_btn.classList.add(cls)
    })
    join_room_btn.appendChild(join_room_btn_text)

    // Add heading to now empty wrapper
    wrapper.appendChild(room_code_heading)
    wrapper.appendChild(join_room_btn)
}
// Updates the room info wrapper with room code
Updates the room info wrapper with room code
Updates the room info wrapper with room code
function update_room_info_wrapper(room_code){
    separated_room_code = separateRoomCode(room_code)
    const wrapper = document.getElementById("room_info_wrapper")
    while(wrapper.firstChild){
        wrapper.removeChild(wrapper.firstChild)
    }
    const room_code_heading = document.createElement("h2")
    room_code_heading.classList.add("font-weight-bold")
    room_code_heading.classList.add("text-center", "cursor-pointer")
    room_code_heading.addEventListener("click", copyRoomCode);
    const text = document.createTextNode(separated_room_code)
    room_code_heading.appendChild(text)
    const join_room_btn = document.createElement("a")
    join_room_btn.href = `/room/${room_code}`
    const join_room_btn_text = document.createTextNode("Join room now!")
    const btn_classes = ["d-block", "text-center", "remove-underline", "rounded", "shadow-sm", "border", "w-100", "py-2", "pink-bg", "text-white"]
    btn_classes.forEach(cls => {
        join_room_btn.classList.add(cls)
    })
    join_room_btn.appendChild(join_room_btn_text)
    wrapper.appendChild(room_code_heading)
    wrapper.appendChild(join_room_btn)
}
function update_room_info_wrapper ( room_code ) { separated_room_code = separateRoomCode ( room_code ) const wrapper = document . getElementById ( "room_info_wrapper" ) while ( wrapper . firstChild ) { wrapper . removeChild ( wrapper . firstChild ) } const room_code_heading = document . createElement ( "h2" ) room_code_heading . classList . add ( "font-weight-bold" ) room_code_heading . classList . add ( "text-center" , "cursor-pointer" ) room_code_heading . addEventListener ( "click" , copyRoomCode ) ; const text = document . createTextNode ( separated_room_code ) room_code_heading . appendChild ( text ) const join_room_btn = document . createElement ( "a" ) join_room_btn . href = ` ${ room_code } ` const join_room_btn_text = document . createTextNode ( "Join room now!" ) const btn_classes = [ "d-block" , "text-center" , "remove-underline" , "rounded" , "shadow-sm" , "border" , "w-100" , "py-2" , "pink-bg" , "text-white" ] btn_classes . forEach ( cls => { join_room_btn . classList . add ( cls ) } ) join_room_btn . appendChild ( join_room_btn_text ) wrapper . appendChild ( room_code_heading ) wrapper . appendChild ( join_room_btn ) }
Updates the room info wrapper with room code
Updates the room info wrapper with room code
// separate 2 by 2. Function called from separate_room_code.js // Clear the wrapper element // Create heading element to store room code in // Add text to heading // Create join button // Add heading to now empty wrapper