forked from vhaudiquet/rhema-together
The invite dialog was reachable only from the invite button, and who was in the room showed only as avatars in the top bar. Selecting an avatar, the member count, or the People button now opens one dialog: a scrollable member list with the invite link below it. The owner removes a member from the row after a confirmation, and the top bar drops them without reloading the room. The server already refuses to remove the owner. Invite link creation is unchanged.
97 lines
2.7 KiB
Vue
97 lines
2.7 KiB
Vue
<script setup lang="ts">
|
|
import { computed } from 'vue'
|
|
import { PanelRight, PanelRightClose, Settings, Users } from 'lucide-vue-next'
|
|
import type { Member } from '~/types'
|
|
|
|
const props = defineProps<{
|
|
roomName: string
|
|
members: Member[]
|
|
onlineIds: string[]
|
|
isOwner: boolean
|
|
paneOpen: boolean
|
|
}>()
|
|
|
|
const emit = defineEmits<{ people: []; togglePane: []; settings: [] }>()
|
|
|
|
const online = computed(() => new Set(props.onlineIds))
|
|
|
|
function avatarUrl(member: Member): string | null {
|
|
if (!member.avatar_updated_at) return null
|
|
return `/api/avatars/${member.account_id}?v=${member.avatar_updated_at}`
|
|
}
|
|
const visible = computed(() => props.members.slice(0, 5))
|
|
const extra = computed(() => props.members.slice(5))
|
|
const extraTitle = computed(() => extra.value.map((member) => member.display_name).join(', '))
|
|
</script>
|
|
|
|
<template>
|
|
<header class="room-topbar">
|
|
<h1 class="room-name">{{ roomName }}</h1>
|
|
|
|
<div class="room-topbar-spacer" />
|
|
|
|
<div class="presence">
|
|
<div class="presence-avatars" aria-label="Room members">
|
|
<button
|
|
v-for="member in visible"
|
|
:key="member.id"
|
|
type="button"
|
|
class="avatar-btn"
|
|
:aria-label="`Show people, ${member.display_name}`"
|
|
@click="emit('people')"
|
|
>
|
|
<AppAvatar
|
|
:name="member.display_name"
|
|
:color="member.color"
|
|
:src="avatarUrl(member)"
|
|
:offline="!online.has(member.id)"
|
|
size="sm"
|
|
aria-hidden="true"
|
|
/>
|
|
</button>
|
|
<button
|
|
v-if="extra.length > 0"
|
|
type="button"
|
|
class="more-people"
|
|
:title="extraTitle"
|
|
:aria-label="`Show all ${members.length} people`"
|
|
@click="emit('people')"
|
|
>
|
|
+{{ extra.length }}
|
|
</button>
|
|
</div>
|
|
|
|
<button
|
|
type="button"
|
|
class="icon-btn"
|
|
aria-label="People"
|
|
title="People"
|
|
@click="emit('people')"
|
|
>
|
|
<Users :size="16" aria-hidden="true" />
|
|
</button>
|
|
|
|
<button
|
|
type="button"
|
|
class="icon-btn"
|
|
:aria-label="paneOpen ? 'Close side pane' : 'Open side pane'"
|
|
:title="paneOpen ? 'Close side pane' : 'Open side pane'"
|
|
@click="emit('togglePane')"
|
|
>
|
|
<component :is="paneOpen ? PanelRightClose : PanelRight" :size="16" aria-hidden="true" />
|
|
</button>
|
|
|
|
<button
|
|
v-if="isOwner"
|
|
type="button"
|
|
class="icon-btn"
|
|
aria-label="Room settings"
|
|
title="Room settings"
|
|
@click="emit('settings')"
|
|
>
|
|
<Settings :size="16" aria-hidden="true" />
|
|
</button>
|
|
</div>
|
|
</header>
|
|
</template>
|