Skip to content

Commit

Permalink
feat(chat): new group member sidebar for group chats (#4747)
Browse files Browse the repository at this point in the history
* feat(sidebar): show group members in group chat

* feat(chat): wip added typing status

* fix: remove dummy text
  • Loading branch information
josephmcg committed Sep 14, 2022
1 parent 352813c commit 905573b
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 28 deletions.
62 changes: 62 additions & 0 deletions components/views/chat/UserList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<template>
<div class="user-list hover-scroll">
<TypographyText>
{{ $t('pages.chat.members', { count: userDetails.length }) }}
</TypographyText>
<div v-for="user in userDetails" :key="user.did" class="user">
<UiUserState :user="user" :conversation-id="conversationId" />
<TypographyText class="ellipsis">
{{ user.name }}
</TypographyText>
</div>
</div>
</template>

<script lang="ts">
import Vue, { computed, ComputedRef, reactive } from 'vue'
import iridium from '~/libraries/Iridium/IridiumManager'
import { conversationHooks } from '~/components/compositions/conversations'
import { User } from '~/libraries/Iridium/users/types'
export default Vue.extend({
setup() {
const { conversation, conversationId } = conversationHooks()
const state = reactive({
users: iridium.users,
})
const userDetails: ComputedRef<User[]> = computed(() => {
if (!conversation.value) {
return []
}
const arr = conversation.value.participants.map((p) =>
state.users.getUser(p),
) as User[]
return arr.sort((a, b) => a.name.localeCompare(b.name))
})
return { conversation, conversationId, userDetails }
},
})
</script>

<style lang="less" scoped>
.user-list {
display: flex;
flex-direction: column;
gap: 16px;
padding: 16px;
width: 240px;
overflow-y: auto;
background: @foreground-gradient;
box-shadow: @ui-shadow;
user-select: none;
.user {
display: flex;
gap: 8px;
align-items: center;
}
}
</style>
1 change: 1 addition & 0 deletions components/views/navigation/toolbar/Toolbar.less
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
rgba(58, 58, 80, 0.4);
border-radius: @corner-rounding;
position: relative;
margin-right: 16px;

// temp for uicomingsoon
> span {
Expand Down
8 changes: 2 additions & 6 deletions components/views/navigation/toolbar/Toolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,9 @@ export default Vue.extend({
userDetails,
} = conversationHooks()
const subtitleText: ComputedRef<string> = computed(() => {
const subtitleText: ComputedRef<string | undefined> = computed(() => {
if (isGroup.value) {
return (
conversation?.value?.participants
?.map((did) => iridium.users.getUser(did)?.name)
.join(', ') ?? ''
)
return
}
// todo - replace with user status message set in profile settings
return iridium.users.ephemeral.status[otherDids.value[0]] || 'offline'
Expand Down
1 change: 1 addition & 0 deletions locales/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ export default {
no_more: 'No more messages.',
},
add_reaction: 'Add reaction',
members: 'Members - {count}',
},
newMessage: {
new_message: 'New Message',
Expand Down
10 changes: 7 additions & 3 deletions pages/chat/Chat.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
:max-viewable-users="10"
:fullscreen-max-viewable-users="20"
/>
<Conversation />
<Chatbar />
<!-- <WalletMini v-if="ui.modals.walletMini" /> -->
<div class="outer-wrapper">
<div class="inner-wrapper">
<Conversation />
<Chatbar />
</div>
<UserList v-if="isGroup" />
</div>
</div>
8 changes: 0 additions & 8 deletions pages/chat/Chat.less

This file was deleted.

48 changes: 37 additions & 11 deletions pages/chat/_id.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,49 @@
<template src="./Chat.html"></template>

<script lang="ts">
import Vue from 'vue'
import Vue, { computed, ComputedRef, reactive } from 'vue'
import iridium from '~/libraries/Iridium/IridiumManager'
import { conversationHooks } from '~/components/compositions/conversations'
export default Vue.extend({
name: 'Chat',
layout: 'desktop',
data() {
return {
webrtc: iridium.webRTC.state,
}
},
computed: {
isActiveCall(): boolean {
return iridium.webRTC.isActiveCall(this.$route.params.id)
},
setup() {
const { conversationId, conversation, isGroup } = conversationHooks()
const state = reactive({
webrtc: iridium.webRTC,
})
const isActiveCall: ComputedRef<boolean> = computed(() => {
return state.webrtc.isActiveCall(conversationId.value)
})
return { conversation, isGroup, isActiveCall }
},
})
</script>

<style lang="less" src="./Chat.less" scoped></style>
<style lang="less" scoped>
.chat {
display: flex;
flex-direction: column;
flex-grow: 1;
justify-content: flex-end;
padding: 16px 0 16px 16px;
min-width: 0;
.outer-wrapper {
display: flex;
overflow: hidden;
flex-grow: 1;
gap: 8px;
.inner-wrapper {
display: flex;
flex-direction: column;
flex-grow: 1;
}
}
}
</style>

0 comments on commit 905573b

Please sign in to comment.