init ratchets
This commit is contained in:
@@ -3,25 +3,28 @@ import { create_listener } from "./chat.js";
|
||||
render_rooms_wrapper()
|
||||
|
||||
async function render_rooms_wrapper() {
|
||||
const room_ids = await request_rooms();
|
||||
console.log(room_ids);
|
||||
render_rooms(room_ids);
|
||||
const room_info = await request_rooms();
|
||||
console.log(room_info);
|
||||
render_rooms(room_info);
|
||||
}
|
||||
|
||||
function render_rooms(room_id) {
|
||||
function render_rooms(room_info) {
|
||||
const roomsContainer = document.getElementById('rooms');
|
||||
roomsContainer.innerHTML= '';
|
||||
|
||||
room_id.forEach((roomId) => {
|
||||
room_info.forEach(([roomId, pubkey]) => {
|
||||
const roomDiv = document.createElement('div');
|
||||
roomDiv.id = `room-${roomId}`;
|
||||
roomDiv.classList.add(`key-${pubkey}`);
|
||||
const messagesUl = document.createElement('ul');
|
||||
messagesUl.id = `messages-${roomId}`;
|
||||
const form = document.createElement('form');
|
||||
form.id = `form-${roomId}`;
|
||||
form.classList.add(`key-${pubkey}`);
|
||||
form.action = '';
|
||||
const input = document.createElement('input');
|
||||
input.id = `input-${roomId}`;
|
||||
input.classList.add(`key-${pubkey}`);
|
||||
input.autocomplete = 'off';
|
||||
const button = document.createElement('button');
|
||||
button.textContent = 'Send';
|
||||
|
||||
Reference in New Issue
Block a user