diff --git a/website/client/assets/svg/like.svg b/website/client/assets/svg/like.svg index 56f24f5ebe..6e1887df20 100644 --- a/website/client/assets/svg/like.svg +++ b/website/client/assets/svg/like.svg @@ -1,3 +1,3 @@ - + diff --git a/website/client/components/chat/chatMessages.vue b/website/client/components/chat/chatMessages.vue new file mode 100644 index 0000000000..534d43b26c --- /dev/null +++ b/website/client/components/chat/chatMessages.vue @@ -0,0 +1,139 @@ + + + + + diff --git a/website/client/components/chat/copyAsTodoModal.vue b/website/client/components/chat/copyAsTodoModal.vue new file mode 100644 index 0000000000..57e571a382 --- /dev/null +++ b/website/client/components/chat/copyAsTodoModal.vue @@ -0,0 +1,66 @@ + + + diff --git a/website/client/components/guilds/guild.vue b/website/client/components/guilds/guild.vue index 9f3076f0d7..d3fa9270ee 100644 --- a/website/client/components/guilds/guild.vue +++ b/website/client/components/guilds/guild.vue @@ -20,40 +20,13 @@ .col-12 h3(v-once) {{ $t('chat') }} - textarea(:placeholder="$t('chatPlaceHolder')") - button.btn.btn-secondary.send-chat.float-right(v-once) {{ $t('send') }} + textarea(:placeholder="$t('chatPlaceHolder')", v-model='newMessage') + button.btn.btn-secondary.send-chat.float-right(v-once, @click='sendMessage()') {{ $t('send') }} .hr .hr-middle(v-once) {{ $t('today') }} - .row - .col-md-2 - .svg-icon(v-html="icons.like") - .col-md-10 - .card(v-for="msg in group.chat", :key="msg.id") - .card-block - h3.leader Character name - span 2 hours ago - .clearfix - strong.float-left {{msg.user}} - .float-right {{msg.timestamp}} - .text {{msg.text}} - hr - span.action(v-once) - .svg-icon(v-html="icons.like") - | {{$t('like')}} - span.action(v-once) - .svg-icon(v-html="icons.copy") - | {{$t('copyAsTodo')}} - span.action(v-once) - .svg-icon(v-html="icons.report") - | {{$t('report')}} - span.action(v-once) - .svg-icon(v-html="icons.delete") - | {{$t('delete')}} - span.action.float-right - .svg-icon(v-html="icons.liked") - | +3 + chat-message(:chat.sync='group.chat', :group-id='group._id', group-name='group.name') .col-md-4.sidebar .guild-background.row @@ -379,10 +352,10 @@ import groupUtilities from 'client/mixins/groupsUtilities'; import { mapState } from 'client/libs/store'; import membersModal from './membersModal'; import ownedQuestsModal from './ownedQuestsModal'; -import { TAVERN_ID } from 'common/script/constants'; import quests from 'common/script/content/quests'; import percent from 'common/script/libs/percent'; import groupFormModal from './groupFormModal'; +import chatMessage from '../chat/chatMessages'; import bCollapse from 'bootstrap-vue/lib/components/collapse'; import bCard from 'bootstrap-vue/lib/components/card'; @@ -404,7 +377,7 @@ import downIcon from 'assets/svg/down.svg'; export default { mixins: [groupUtilities], - props: ['guildId'], + props: ['groupId'], components: { membersModal, ownedQuestsModal, @@ -412,6 +385,7 @@ export default { bCard, bTooltip, groupFormModal, + chatMessage, }, directives: { bToggle, @@ -441,6 +415,7 @@ export default { information: true, challenges: true, }, + newMessage: '', }; }, computed: { @@ -512,8 +487,6 @@ export default { // Load challenges // Load group tasks for group plan // Load approvals for group plan - } else if (this.$route.path.startsWith('/guilds/tavern')) { - this.groupId = TAVERN_ID; } this.fetchGuild(); }, @@ -522,6 +495,14 @@ export default { $route: 'fetchGuild', }, methods: { + async sendMessage () { + let response = await this.$store.dispatch('chat:postChat', { + groupId: this.group._id, + message: this.newMessage, + }); + this.group.chat.unshift(response.message); + this.newMessage = ''; + }, updateGuild () { this.$store.state.editingGroup = this.group; this.$root.$emit('show::modal', 'guild-form'); diff --git a/website/client/components/guilds/tavern.vue b/website/client/components/guilds/tavern.vue index 1095b19089..fa441218a6 100644 --- a/website/client/components/guilds/tavern.vue +++ b/website/client/components/guilds/tavern.vue @@ -9,8 +9,8 @@ .col-12 h3(v-once) {{ $t('welcomeToTavern') }} - textarea(:placeholder="$t('chatPlaceHolder')") - button.btn.btn-secondary.send-chat.float-right(v-once) {{ $t('send') }} + textarea(:placeholder="$t('chatPlaceHolder')", v-model='newMessage') + button.btn.btn-secondary.send-chat.float-right(v-once, @click='sendMessage()') {{ $t('send') }} .container.community-guidelines(v-if='communityGuidelinesAccepted') .row @@ -21,34 +21,7 @@ .hr .hr-middle(v-once) {{ $t('today') }} - .row - .col-md-2 - .svg-icon(v-html="icons.like") - .col-md-10 - .card(v-for="msg in group.chat", :key="msg.id") - .card-block - h3.leader Character name - span 2 hours ago - .clearfix - strong.float-left {{msg.user}} - .float-right {{msg.timestamp}} - .text {{msg.text}} - hr - span.action(v-once) - .svg-icon(v-html="icons.like") - | {{$t('like')}} - span.action(v-once) - .svg-icon(v-html="icons.copy") - | {{$t('copyAsTodo')}} - span.action(v-once) - .svg-icon(v-html="icons.report") - | {{$t('report')}} - span.action(v-once) - .svg-icon(v-html="icons.delete") - | {{$t('delete')}} - span.action.float-right - .svg-icon(v-html="icons.liked") - | +3 + chat-message(:chat.sync='group.chat', :group-id='group._id', group-name='group.name') .col-md-4.sidebar .section @@ -96,7 +69,7 @@ li a(herf='', v-once) {{ $t('faq') }} li - a(herf='', v-once) {{ $t('glossary') }} + a(herf='', v-html="$t('glossary')") li a(herf='', v-once) {{ $t('wiki') }} li @@ -106,7 +79,7 @@ li a(herf='', v-once) {{ $t('requestFeature') }} li - a(herf='', v-once) {{ $t('communityForum') }} + a(herf='', v-html="$t('communityForum')") li a(herf='', v-once) {{ $t('askQuestionGuild') }} @@ -138,7 +111,6 @@