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

feat(chat): new group member sidebar for group chats #4747

Merged
merged 3 commits into from
Sep 14, 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
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>