This repository was archived by the owner on Oct 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathRequests.tsx
More file actions
48 lines (41 loc) · 1.47 KB
/
Requests.tsx
File metadata and controls
48 lines (41 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { useRealtimeKitMeeting, useRealtimeKitSelector } from '@cloudflare/realtimekit-react';
import { Check, X } from 'react-feather';
export default function Requests() {
const { meeting } = useRealtimeKitMeeting();
const participants = useRealtimeKitSelector((m) => m.participants.joined).toArray();
const requestedParticipants = participants.filter(
(p) => p.stageStatus === 'REQUESTED_TO_JOIN_STAGE'
);
if (!meeting.self.permissions.acceptStageRequests) {
return null;
}
return (
<div className="w-full min-h-[20vh] max-h-[50vh] p-4 bg-gray-200">
<h2 className="text-lg font-semibold">Requests</h2>
{requestedParticipants.length === 0 && (
<p className="text-xs text-gray-600">There are no requests.</p>
)}
<div className="flex flex-col gap-2 mt-3">
{requestedParticipants.map((p) => (
<div className="flex items-center justify-between text-sm" key={p.id}>
<div>{p.name}</div>
<div className="flex gap-2">
<button
className="icon-btn text-red-600"
onClick={() => meeting.stage.denyAccess([p.id])}
>
<X />
</button>
<button
className="icon-btn text-green-700"
onClick={() => meeting.stage.grantAccess([p.id])}
>
<Check />
</button>
</div>
</div>
))}
</div>
</div>
);
}