-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweek 12
More file actions
56 lines (55 loc) · 2.2 KB
/
Copy pathweek 12
File metadata and controls
56 lines (55 loc) · 2.2 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
49
50
51
52
53
54
55
56
return (
<tr key={roomId} className={`bg-black/50 border border-slate-900 ${isFull ? 'opacity-70' : ''}`}>
<td className="px-6 py-4 font-light text-white">
{room.roomName}
{isFull && <span className="ml-2 text-red-400 text-sm">(เต็ม)</span>}
</td>
<td className="px-6 py-4 text-white font-light">
{room.members?.length || 0} / {room.maxPlayers}
</td>
<td className="px-6 py-4">
<Link
href={isFull ? '#' : `/room/${roomId}`}
onClick={(e) => {
if (isFull) {
e.preventDefault();
handleJoinRoom(roomId, room);
}
}}
>
<button
className={`px-4 py-2 rounded-md ${
isFull
? 'bg-gray-500 text-gray-300 cursor-not-allowed'
: 'bg-green-500 text-white hover:bg-green-600'
}`}
disabled={isFull}
>
{isFull ? 'เต็ม' : 'Join'}
</button>
</Link>
<Link href={`/room/${roomId}`}>
<button
className="px-4 py-2 m-4 bg-blue-500 text-white rounded-md hover:bg-blue-600"
onClick={() => handleSpectateRoom(roomId, room)}
>
Spectate
</button>
</Link>
</td>
</tr>
);
})
) : (
<tr>
<td colSpan="3" className="px-6 py-4 text-center text-white">
ไม่มีห้องแข่งขัน
</td>
</tr>
)}
</tbody>
</table>
</div>
</div>
);
}