Skip to content

Commit 8131aa6

Browse files
committed
Displaying a warning message for flagged messages
1 parent 8b95bc1 commit 8131aa6

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/components/ChatTile.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
</p>
2323
</div>
2424

25+
<p v-if="displayWarning" class="warning-message">
26+
The message you're trying to send was flagged as offensive. Please consider minding the language you use in this meeting.
27+
</p>
28+
2529
<form @submit="submitForm">
2630
<div class="input">
2731
<label for="message">Type a message...</label>
@@ -59,7 +63,8 @@ export default {
5963
chat,
6064
send,
6165
text: "",
62-
model: null
66+
model: null,
67+
displayWarning: false,
6368
};
6469
},
6570
beforeCreate() {
@@ -76,9 +81,10 @@ export default {
7681
// Send chat message using prop method from CallTile.vue
7782
async submitForm(e) {
7883
e.preventDefault();
84+
this.displayWarning = false;
7985
8086
const hasToxicContent = await this.analyzeInputText(this.text);
81-
// this.sendMessage(this.text);
87+
hasToxicContent ? this.displayWarning = true : this.sendMessage(this.text);
8288
this.text = "";
8389
},
8490
async analyzeInputText(text) {
@@ -169,6 +175,10 @@ form {
169175
color: #6b7785;
170176
}
171177
178+
.warning-message {
179+
color: red;
180+
}
181+
172182
@media screen and (max-width: 700px) {
173183
.chat-container {
174184
width: calc(100% - 104px);

0 commit comments

Comments
 (0)