Don't need user to see chat. Increased to fetch last 100 messages.

This commit is contained in:
2020-04-03 13:55:26 +02:00
parent 09648f0b2d
commit 706ef44491
2 changed files with 16 additions and 21 deletions

View File

@@ -82,7 +82,7 @@ export default {
}; };
}, },
created() { created() {
getChatHistory().then(messages => (this.chatHistory = messages)); getChatHistory(0, 100).then(messages => (this.chatHistory = messages));
}, },
mounted() { mounted() {
this.track(); this.track();

View File

@@ -2,7 +2,6 @@
<div class="chat-container"> <div class="chat-container">
<hr /> <hr />
<h2>Chat</h2> <h2>Chat</h2>
<div v-if="usernameSet" class="chat-inner-container">
<div class="history" ref="history"> <div class="history" ref="history">
<div <div
v-for="(history, index) in chatHistory" v-for="(history, index) in chatHistory"
@@ -13,13 +12,12 @@
<span class="message">{{ history.message }}</span> <span class="message">{{ history.message }}</span>
</div> </div>
</div> </div>
<div class="input"> <div v-if="usernameSet" class="input">
<input @keyup.enter="sendMessage" type="text" v-model="message" placeholder="Melding.." /> <input @keyup.enter="sendMessage" type="text" v-model="message" placeholder="Melding.." />
<button @click="sendMessage">Send</button> <button @click="sendMessage">Send</button>
<button @click="removeUsername">Logg ut</button> <button @click="removeUsername">Logg ut</button>
</div> </div>
</div> <div v-else class="username-dialog">
<div v-if="!usernameSet" class="username-dialog">
<input <input
type="text" type="text"
@keyup.enter="setUsername" @keyup.enter="setUsername"
@@ -127,6 +125,7 @@ hr {
} }
} }
.chat-container { .chat-container {
height: 100%;
width: 50%; width: 50%;
@include mobile { @include mobile {
@@ -142,10 +141,6 @@ input {
display: flex; display: flex;
} }
.chat-container,
.chat-inner-container {
height: 95%;
}
.history { .history {
height: 75%; height: 75%;