Skip to content

Commit

Permalink
#2393 - Add ButtonSubmit.vue for 'Send message' button (#2402)
Browse files Browse the repository at this point in the history
* replace btn-link with button-submit component / asyncify the method

* remove unused console.log
  • Loading branch information
SebinSong authored Oct 30, 2024
1 parent a1294ef commit 3b142e9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
8 changes: 6 additions & 2 deletions frontend/views/components/ButtonSubmit.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template lang='pug'>
button.is-loader(
type='submit'
:type='type'
ref='btn'
v-bind='$attrs'
v-on='bindListeners'
Expand Down Expand Up @@ -43,7 +43,11 @@ https://github.com/okTurtles/group-income/pull/854/files#r388638068
export default ({
name: 'ButtonSubmit',
props: {
disabled: Boolean
disabled: Boolean,
type: {
type: String,
default: 'submit'
}
},
data: () => ({
ephemeral: {
Expand Down
17 changes: 10 additions & 7 deletions frontend/views/components/ProfileCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,12 @@ tooltip(
) Add payment information

.buttons(v-if='!isSelf')
i18n.button.is-outlined.is-small(
tag='button'
@click='sendMessage'
button-submit.is-outlined.is-small(
type='button'
data-test='buttonSendMessage'
) Send message
@click='sendMessage'
)
i18n Send message

i18n.button.is-outlined.is-small(
v-if='groupShouldPropose || isGroupCreator'
Expand All @@ -85,6 +86,7 @@ tooltip(
<script>
import sbp from '@sbp/sbp'
import AvatarUser from '@components/AvatarUser.vue'
import ButtonSubmit from '@components/ButtonSubmit.vue'
import UserName from '@components/UserName.vue'
import Tooltip from '@components/Tooltip.vue'
import ModalClose from '@components/modal/ModalClose.vue'
Expand Down Expand Up @@ -114,7 +116,8 @@ export default ({
AvatarUser,
ModalClose,
UserName,
Tooltip
Tooltip,
ButtonSubmit
},
computed: {
...mapGetters([
Expand Down Expand Up @@ -165,10 +168,10 @@ export default ({
toggleTooltip () {
this.$refs.tooltip.toggle()
},
sendMessage () {
async sendMessage () {
const chatRoomID = this.ourGroupDirectMessageFromUserIds(this.contractID)
if (!chatRoomID) {
this.createDirectMessage(this.contractID)
await this.createDirectMessage(this.contractID)
} else {
if (!this.ourGroupDirectMessages[chatRoomID].visible) {
this.setDMVisibility(chatRoomID, true)
Expand Down

0 comments on commit 3b142e9

Please sign in to comment.