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

chore(userstatus): fixed user state display while changing chat #3170

Merged
merged 1 commit into from
May 20, 2022
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
16 changes: 11 additions & 5 deletions components/ui/Unread/Unread.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,18 @@ export default Vue.extend({
this.$store.dispatch('ui/showProfile', this.user)
},
navigateToUser() {
if (
this.$route.params.address === this.user.address &&
this.$device.isMobile
) {
this.$store.commit('ui/showSidebar', false)
if (this.$route.params.address === this.user.address) {
if (this.$device.isMobile) {
this.$store.commit('ui/showSidebar', false)
}
return
}
this.$store.dispatch('conversation/setConversation', {
id: this.user.address,
type: 'friend',
participants: [this.user],
calling: false,
})
this.$router.push(`/chat/direct/${this.user.address}`)
},
},
Expand Down
1 change: 1 addition & 0 deletions components/views/group/clickable/Clickable.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div
class="group"
v-bind:class="{ 'is-selected' : isSelected}"
@contextmenu="contextMenu"
v-on:click="navigateToGroup(group.id)"
>
Expand Down
4 changes: 4 additions & 0 deletions components/views/group/clickable/Clickable.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
.group {
&.is-selected {
&:extend(.background-semitransparent-lighter);
}

.status {
path {
stroke: @midground;
Expand Down
12 changes: 11 additions & 1 deletion components/views/group/clickable/Clickable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import Vue, { PropType } from 'vue'
import ContextMenu from '~/components/mixins/UI/ContextMenu'
import { Group } from '~/store/groups/types'
import { Message } from '~/types/textile/mailbox'

declare module 'vue/types/vue' {
interface Vue {
Expand All @@ -23,6 +22,11 @@ export default Vue.extend({
}),
required: true,
},
isSelected: {
type: Boolean,
default: false,
required: false,
},
},
data() {
return {
Expand All @@ -46,6 +50,12 @@ export default Vue.extend({
*/
navigateToGroup(address: string) {
this.$router.push(`/chat/groups/${address}`)
this.$store.dispatch('conversation/setConversation', {
id: this.group.id,
type: 'group',
calling: false,
participants: this.group.members,
})
},
},
})
Expand Down
7 changes: 6 additions & 1 deletion components/views/navigation/sidebar/Sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,12 @@
:isTyping="ui.isTyping.address === thing.address"
:isSelected="thing.address === $route.params.address"
/>
<GroupClickable v-else :group="thing" :key="thing.id" />
<GroupClickable
v-else
:group="thing"
:key="thing.id"
:isSelected="thing.id === $route.params.id"
/>
</div>
</div>
<div
Expand Down
6 changes: 6 additions & 0 deletions components/views/user/User.vue
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ export default Vue.extend({
return
}

this.$store.dispatch('conversation/setConversation', {
id: this.user.address,
type: 'friend',
participants: [this.user],
calling: false,
})
this.$router.push(`/chat/direct/${this.user.address}`)
},
async handleShowProfile() {
Expand Down