Added roomID to top nav, fix tests

This commit is contained in:
Daniel Seripap 2016-12-27 12:53:01 -05:00
parent 77adbce1a1
commit 5d66217e8e
4 changed files with 24 additions and 8 deletions

View File

@ -25,7 +25,7 @@ export default class App {
} }
return '/' + chatName; return '/' + chatName;
}; }
init() { init() {
this._chat = new Chat(this._darkwire, this._socket); this._chat = new Chat(this._darkwire, this._socket);
@ -37,7 +37,7 @@ export default class App {
$('input.share-text').click(() => { $('input.share-text').click(() => {
$(this).focus(); $(this).focus();
$(this).select(); $(this).select();
this.setSelectionRange(0, 9999); $(this).setSelectionRange(0, 9999);
}); });
const windowHandler = new WindowHandler(this._darkwire, this._socket, this._chat); const windowHandler = new WindowHandler(this._darkwire, this._socket, this._chat);
@ -118,7 +118,7 @@ export default class App {
this._socket.on('disconnect', (data) => { this._socket.on('disconnect', (data) => {
this._darkwire.connected = false; this._darkwire.connected = false;
this._chat.log('Disconnected from server, automatically reloading chatroom in 10 seconds.', { this._chat.log('Disconnected from server, automatically reconnecting in 4 seconds.', {
error: true, error: true,
}); });
this.retryConnection(); this.retryConnection();
@ -259,6 +259,7 @@ export default class App {
} }
this._chat.log(moment().format('MMMM Do YYYY, h:mm:ss a'), {info: true}); this._chat.log(moment().format('MMMM Do YYYY, h:mm:ss a'), {info: true});
$('#roomName').text(this._roomId);
this._darkwire.updateUsername(username).then((socketData) => { this._darkwire.updateUsername(username).then((socketData) => {
this._chat.chatPage.show(); this._chat.chatPage.show();
this._chat.inputMessage.focus(); this._chat.inputMessage.focus();
@ -296,7 +297,7 @@ export default class App {
retryConnection() { retryConnection() {
window.setTimeout(() => { window.setTimeout(() => {
window.location.reload(); window.location.reload();
}, 10000); }, 4000);
} }
} }

View File

@ -364,3 +364,15 @@ html.no-touchevents .chat #input-icons {
color: #FFF; color: #FFF;
background-color: red; background-color: red;
} }
.room-name-top {
float: left;
text-align: center;
padding: 16px;
}
.room-name-top p {
margin: 0;
color: palegoldenrod;
font-weight: bold;
}

View File

@ -28,6 +28,9 @@
<a class="navbar-brand" href="javascript:void(0)"> <a class="navbar-brand" href="javascript:void(0)">
<img src="/logo.png"> <img src="/logo.png">
</a> </a>
<span class="room-name-top">
<p id="roomName" class="room-name"></p>
</span>
<span class="participants"> <span class="participants">
<span class="glyphicon glyphicon-user"></span>&nbsp;<span id="participants"></span> <span class="glyphicon glyphicon-user"></span>&nbsp;<span id="participants"></span>
</span> </span>