Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2393 - Add ButtonSubmit.vue for 'Send message' button #2402

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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