Skip to content

Commit 64a09cb

Browse files
authored
Merge pull request #197 from a-kriya/noprop
Use showDeletion and showEdition from store
2 parents 1eed80d + df5ca54 commit 64a09cb

File tree

6 files changed

+5
-46
lines changed

6 files changed

+5
-46
lines changed

demo/src/App.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
:chosenColor="chosenColor"
55
:colors="colors"
66
/>
7-
<beautiful-chat
7+
<beautiful-chat
88
:alwaysScrollToBottom="alwaysScrollToBottom"
99
:close="closeChat"
1010
:colors="colors"
@@ -35,7 +35,7 @@
3535
👍
3636
</button>
3737
</template>
38-
<template v-slot:text-message-body="scopedProps">
38+
<template v-slot:text-message-body="scopedProps">
3939
<p class="sc-message--text-content" v-html="scopedProps.messageText"></p>
4040
<p v-if="scopedProps.message.data.meta" class='sc-message--meta' :style="{color: scopedProps.messageColors.color}">{{scopedProps.message.data.meta}}</p>
4141
<p v-if="scopedProps.message.isEdited || scopedProps.message.liked" class='sc-message--edited'>

src/ChatWindow.vue

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
:show-typing-indicator="showTypingIndicator"
2020
:colors="colors"
2121
:always-scroll-to-bottom="alwaysScrollToBottom"
22-
:show-edition="showEdition"
23-
:show-deletion="showDeletion"
2422
:show-confirmation-deletion="showConfirmationDeletion"
2523
:confirmation-deletion-message="confirmationDeletionMessage"
2624
:message-styling="messageStyling"
@@ -128,14 +126,6 @@ export default {
128126
type: Boolean,
129127
required: true
130128
},
131-
showEdition: {
132-
type: Boolean,
133-
required: true
134-
},
135-
showDeletion: {
136-
type: Boolean,
137-
required: true
138-
},
139129
showConfirmationDeletion: {
140130
type: Boolean,
141131
required: true

src/Launcher.vue

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
:is-open="isOpen"
2222
:show-emoji="showEmoji"
2323
:show-file="showFile"
24-
:show-edition="showEdition"
25-
:show-deletion="showDeletion"
2624
:show-confirmation-deletion="showConfirmationDeletion"
2725
:confirmation-deletion-message="confirmationDeletionMessage"
2826
:show-header="showHeader"
@@ -245,7 +243,6 @@ export default {
245243
deep: true,
246244
immediate: true,
247245
handler(props) {
248-
// TODO: optimize
249246
for (const prop in props) {
250247
store.setState(prop, props[prop])
251248
}

src/Message.vue

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
:message="message"
2626
:message-colors="messageColors"
2727
:message-styling="messageStyling"
28-
:show-edition="showEdition"
29-
:show-deletion="showDeletion"
3028
:show-confirmation-deletion="showConfirmationDeletion"
3129
:confirmation-deletion-message="confirmationDeletionMessage"
3230
@remove="$emit('remove')"
@@ -97,14 +95,6 @@ export default {
9795
type: Object,
9896
required: true
9997
},
100-
showEdition: {
101-
type: Boolean,
102-
required: true
103-
},
104-
showDeletion: {
105-
type: Boolean,
106-
required: true
107-
},
10898
showConfirmationDeletion: {
10999
type: Boolean,
110100
required: true

src/MessageList.vue

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
:user="profile(message.author)"
1313
:colors="colors"
1414
:message-styling="messageStyling"
15-
:show-edition="showEdition"
16-
:show-deletion="showDeletion"
1715
:show-confirmation-deletion="showConfirmationDeletion"
1816
:confirmation-deletion-message="confirmationDeletionMessage"
1917
@remove="$emit('remove', message)"
@@ -45,8 +43,6 @@
4543
:user="profile(showTypingIndicator)"
4644
:colors="colors"
4745
:message-styling="messageStyling"
48-
:show-edition="showEdition"
49-
:show-deletion="showDeletion"
5046
:show-confirmation-deletion="showConfirmationDeletion"
5147
:confirmation-deletion-message="confirmationDeletionMessage"
5248
/>
@@ -86,14 +82,6 @@ export default {
8682
type: Boolean,
8783
required: true
8884
},
89-
showEdition: {
90-
type: Boolean,
91-
required: true
92-
},
93-
showDeletion: {
94-
type: Boolean,
95-
required: true
96-
},
9785
showConfirmationDeletion: {
9886
type: Boolean,
9987
required: true

src/messages/TextMessage.vue

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
</template>
4343

4444
<script>
45+
import {mapState} from '../store/'
4546
import IconBase from './../components/IconBase.vue'
4647
import IconEdit from './../components/icons/IconEdit.vue'
4748
import IconCross from './../components/icons/IconCross.vue'
@@ -70,14 +71,6 @@ export default {
7071
type: Boolean,
7172
required: true
7273
},
73-
showEdition: {
74-
type: Boolean,
75-
required: true
76-
},
77-
showDeletion: {
78-
type: Boolean,
79-
required: true
80-
},
8174
showConfirmationDeletion: {
8275
type: Boolean,
8376
required: true
@@ -101,7 +94,8 @@ export default {
10194
},
10295
isEditing() {
10396
return (store.state.editMessage && store.state.editMessage.id) === this.message.id
104-
}
97+
},
98+
...mapState(['showDeletion', 'showEdition'])
10599
},
106100
methods: {
107101
edit() {

0 commit comments

Comments
 (0)