Skip to content

Commit e145aed

Browse files
Merge pull request #32 from mctekk/fix/handle-branch-change
fix: handle chat change
2 parents a553a2e + 90a5dcc commit e145aed

File tree

3 files changed

+65
-93
lines changed

3 files changed

+65
-93
lines changed

package-lock.json

Lines changed: 35 additions & 90 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/chat/index.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ export default {
145145
watch: {
146146
receiver() {
147147
this.unlistenEvents();
148+
},
149+
branchId() {
150+
this.unlistenEvents()
148151
}
149152
},
150153
computed: {
@@ -296,6 +299,10 @@ export default {
296299
297300
sendMessage(message, attributes) {
298301
this.$refs.messenger.sendMessage(message, attributes);
302+
},
303+
304+
focus() {
305+
this.$refs.messenger.focus();
299306
}
300307
}
301308
};

src/components/chat/messager.vue

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export default {
118118
this.isLoading = true;
119119
this.channel = this.activeChannel;
120120
this.updateMembers();
121-
this.getMessages();
121+
this.getMessages()
122122
this.$emit("opened", this.channel.sid);
123123
},
124124
immediate: true
@@ -199,6 +199,7 @@ export default {
199199
this.description = attributes.description;
200200
});
201201
},
202+
202203
leaveChannel() {
203204
this.$emit("left", this.channel);
204205
},
@@ -249,6 +250,9 @@ export default {
249250
this.channel.on("messageAdded", this.addMessage);
250251
this.channel.on("memberUpdated", this.updateMembers);
251252
this.isLoading = false;
253+
this.$nextTick(() => {
254+
this.focus()
255+
})
252256
});
253257
254258
this.channel.on("typingStarted", member => {
@@ -275,6 +279,10 @@ export default {
275279
setTimeout(async () => {
276280
this.channel.updateLastConsumedMessageIndex(index);
277281
});
282+
},
283+
284+
focus() {
285+
this.$refs.Message.focus()
278286
}
279287
}
280288
};
@@ -380,7 +388,7 @@ export default {
380388
}
381389
382390
.btn-action {
383-
background: dodgerblue;
391+
background: #1975BC;
384392
color: white;
385393
height: 34px;
386394
text-align: center;
@@ -389,7 +397,19 @@ export default {
389397
font-size: 0.75rem;
390398
cursor: pointer;
391399
width: 220px !important;
392-
border: 2px solid #ccc;
400+
border: 2px solid #1975BC;
401+
transition: background ease .3s ;
402+
403+
&:hover {
404+
background: darken($color: #1975BC, $amount: 10);
405+
}
406+
407+
&.bg-white {
408+
border-color: #eee;
409+
&:hover {
410+
background-color: silver;
411+
}
412+
}
393413
}
394414
395415
.fade-message-enter {

0 commit comments

Comments
 (0)