|
35 | 35 | </div> |
36 | 36 |
|
37 | 37 | <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"> |
40 | 40 | <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" |
52 | 42 | :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" |
57 | 47 | @muteParticipant="handleMuteParticipant" |
58 | 48 | @kickParticipant="handleKickParticipant" |
59 | 49 | @lowerHand="handleLowerHand" |
60 | 50 | /> |
61 | 51 | </div> |
62 | 52 |
|
63 | 53 | <div |
64 | | - v-if="!showCurrentUser && filteredParticipants.length === 0" |
| 54 | + v-if="allVisibleParticipants.length === 0" |
65 | 55 | class="text-ink-gray-5 text-sm text-center mt-8 px-4" |
66 | 56 | > |
67 | 57 | {{ searchQuery ? "No participants found" : "No other participants" }} |
@@ -184,6 +174,32 @@ const showCurrentUser = computed(() => { |
184 | 174 | return name.includes(query); |
185 | 175 | }); |
186 | 176 |
|
| 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 | +
|
187 | 203 | const currentUserData = computed<Participant>(() => ({ |
188 | 204 | user_id: props.currentUser?.user_id || "", |
189 | 205 | user_name: props.currentUser?.full_name || props.currentUser?.name || "You", |
|
0 commit comments