init ratchets

This commit is contained in:
2025-03-09 17:43:20 +01:00
parent 35ff9cb240
commit 744e1fae29
3 changed files with 55 additions and 17 deletions

View File

@@ -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';