feat: send feedback

This commit is contained in:
fryorcraken.eth 2022-10-05 11:36:04 +11:00
parent aa08cfaf1d
commit a9e2c398a7
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 7 additions and 0 deletions

View File

@ -58,6 +58,7 @@
<label for='textInput'>Message text</label>
<input disabled id='textInput' placeholder='Type your message here' type='text'>
<button disabled id='sendButton' type='button'>Send message using Light Push</button>
<span id='sending-status'></span>
<br/>
<div id="messages"></div>
</div>
@ -115,6 +116,7 @@
const textInput = document.getElementById('textInput');
const sendButton = document.getElementById('sendButton');
const sendingStatusSpan = document.getElementById('sending-status');
const messagesDiv = document.getElementById('messages')
@ -385,9 +387,14 @@
const msg = ProtoChatMessage.create({text, nick, timestamp: timestamp.valueOf()});
const payload = ProtoChatMessage.encode(msg).finish();
console.log("Sending message with proof...")
sendingStatusSpan.innerText = 'sending...'
await node.lightPush.push(encoder, {payload, timestamp});
sendingStatusSpan.innerText = 'sent!'
console.log("Message sent!")
textInput.value = null;
setTimeout(() => {
sendingStatusSpan.innerText = ''
}, 1000)
};
</script>
</body>