Skip to content

Commit 73aec1f

Browse files
committed
refactor(participant-list): use the component only once and better border logic
1 parent b43bfbf commit 73aec1f

2 files changed

Lines changed: 35 additions & 21 deletions

File tree

frontend/src/components/PeoplePanel.vue

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,33 +35,23 @@
3535
</div>
3636

3737
<div class="flex-1 overflow-y-auto">
38-
<!-- Current User -->
39-
<div v-if="showCurrentUser" class="border-b border-gray-200">
38+
<!-- All Participants -->
39+
<div v-if="allVisibleParticipants.length > 0">
4040
<PeopleParticipantTile
41-
:participant="currentUserData"
42-
:isCurrentUser="true"
43-
:showHostBadge="isCreator"
44-
:canControlParticipant="false"
45-
/>
46-
</div>
47-
48-
<!-- Remote Participants -->
49-
<div v-if="filteredParticipants.length > 0">
50-
<PeopleParticipantTile
51-
v-for="participant in filteredParticipants"
41+
v-for="participant in allVisibleParticipants"
5242
:key="participant.user_id"
53-
:participant="participant"
54-
:isCurrentUser="false"
55-
:showHostBadge="participant.user_id === creatorUserId"
56-
:canControlParticipant="isCreator"
43+
:participant="participant.participantData"
44+
:isCurrentUser="participant.isCurrentUser"
45+
:showHostBadge="participant.showHostBadge"
46+
:canControlParticipant="participant.canControlParticipant"
5747
@muteParticipant="handleMuteParticipant"
5848
@kickParticipant="handleKickParticipant"
5949
@lowerHand="handleLowerHand"
6050
/>
6151
</div>
6252

6353
<div
64-
v-if="!showCurrentUser && filteredParticipants.length === 0"
54+
v-if="allVisibleParticipants.length === 0"
6555
class="text-ink-gray-5 text-sm text-center mt-8 px-4"
6656
>
6757
{{ searchQuery ? "No participants found" : "No other participants" }}
@@ -184,6 +174,32 @@ const showCurrentUser = computed(() => {
184174
return name.includes(query);
185175
});
186176
177+
const allVisibleParticipants = computed(() => {
178+
const participants = [];
179+
180+
if (showCurrentUser.value) {
181+
participants.push({
182+
user_id: props.currentUser?.user_id || "",
183+
participantData: currentUserData.value,
184+
isCurrentUser: true,
185+
showHostBadge: isCreator.value,
186+
canControlParticipant: false,
187+
});
188+
}
189+
190+
for (const participant of filteredParticipants.value) {
191+
participants.push({
192+
user_id: participant.user_id,
193+
participantData: participant,
194+
isCurrentUser: false,
195+
showHostBadge: participant.user_id === props.creatorUserId,
196+
canControlParticipant: isCreator.value,
197+
});
198+
}
199+
200+
return participants;
201+
});
202+
187203
const currentUserData = computed<Participant>(() => ({
188204
user_id: props.currentUser?.user_id || "",
189205
user_name: props.currentUser?.full_name || props.currentUser?.name || "You",

frontend/src/components/PeopleParticipantTile.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<template>
2-
<div
3-
class="flex items-center gap-3 p-3 rounded-lg transition-colors"
4-
>
2+
<div class="flex items-center gap-3 py-3 mx-4 border-b border-gray-200 last:border-b-0 transition-colors">
53
<div class="flex-shrink-0">
64
<div
75
class="relative flex items-center justify-center rounded-full overflow-hidden bg-gradient-to-br from-gray-500 to-gray-600 text-white shadow-inner w-10 h-10"

0 commit comments

Comments
 (0)