Skip to content

Commit 7fa1503

Browse files
committed
✨ Typing indicator is here, thanks @senky
#10
1 parent f9ba80f commit 7fa1503

File tree

5 files changed

+21
-27
lines changed

5 files changed

+21
-27
lines changed

demo/src/TestArea.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ export default {
3434
}
3535
},
3636
methods: {
37-
_handleSubmit () {
37+
_handleSubmit() {
3838
this.onMessage(this.$refs.textArea.value)
3939
this.$refs.textArea.value = ''
40+
this.onTyping('')
4041
},
41-
_handleTyping () {
42+
_handleTyping() {
4243
this.onTyping(this.$refs.textArea.value)
4344
}
4445
}
@@ -60,7 +61,7 @@ export default {
6061
color: #516996;
6162
font-weight: 600;
6263
font-size: 28px;
63-
}
64+
}
6465
6566
.demo-test-area--title-sub {
6667
color: #4e8cff;
@@ -81,9 +82,8 @@ export default {
8182
color: #516996;
8283
}
8384
84-
8585
.demo-test-area--button {
86-
font-family: Avenir Next, Helvetica Neue, Helvetica,sans-serif;
86+
font-family: Avenir Next, Helvetica Neue, Helvetica, sans-serif;
8787
font-weight: 400;
8888
margin-top: 20px;
8989
user-select: none;

dist/index.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ssr.index.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ChatWindow.vue

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,31 @@ export default {
2727
UserInput
2828
},
2929
props: {
30-
'showEmoji': {
30+
showEmoji: {
3131
type: Boolean,
3232
default: false
3333
},
34-
'showFile': {
34+
showFile: {
3535
type: Boolean,
3636
default: false
3737
},
38-
'agentProfile': {
38+
agentProfile: {
3939
type: Object,
4040
required: true
4141
},
42-
'onUserInputSubmit': {
42+
onUserInputSubmit: {
4343
type: Function,
4444
required: true
4545
},
46-
'onClose': {
46+
onClose: {
4747
type: Function,
4848
required: true
4949
},
50-
'messageList': {
50+
messageList: {
5151
type: Array,
5252
default: () => []
5353
},
54-
'isOpen': {
54+
isOpen: {
5555
type: Boolean,
5656
default: () => false
5757
},
@@ -64,25 +64,17 @@ export default {
6464
default: () => false
6565
}
6666
},
67-
data () {
68-
return {
69-
70-
}
67+
data() {
68+
return {}
7169
},
7270
computed: {
73-
messages () {
71+
messages() {
7472
let messages = this.messageList
75-
if (this.showTypingIndicator) {
76-
messages.push({
77-
author: 'them',
78-
type: 'typing'
79-
})
80-
}
73+
8174
return messages
8275
}
8376
},
84-
methods: {
85-
}
77+
methods: {}
8678
}
8779
</script>
8880
<style scoped>
@@ -101,7 +93,7 @@ export default {
10193
justify-content: space-between;
10294
transition: 0.3s ease-in-out;
10395
border-radius: 10px;
104-
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
96+
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
10597
}
10698
10799
.sc-chat-window.closed {

src/MessageList.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="sc-message-list" ref="scrollList">
33
<Message v-for="(message, idx) in messages" :message="message" :chatImageUrl="chatImageUrl" :key="idx" />
4-
<Message v-if="showTypingIndicator" :message="{author: 'them', type: 'typing'}" :chatImageUrl="chatImageUrl" :key="idx" />
4+
<Message v-show="showTypingIndicator" :message="{author: 'them', type: 'typing'}" :chatImageUrl="chatImageUrl" :key="idx" />
55
</div>
66
</template>
77
<script>

0 commit comments

Comments
 (0)