Overnap

방이 하나도 없을 때 안내 메세지 추가

......@@ -28,7 +28,12 @@ const Rooms: React.FC = () => {
});
}, []);
useEffect(refreshRooms, []);
useEffect(() => {
// 뒤로가기 키로 빠져나오면 ping listener를 unsubscribe
socket.off('ping');
refreshRooms();
}, []);
return (
<Main>
......@@ -37,7 +42,11 @@ const Rooms: React.FC = () => {
<Create />
</div>
<div className='mt-auto w-screen flex flex-col items-center'>
{rooms.map((room) => (<RoomBlock key={room.uuid} room={room} />))}
{
rooms.length > 0 ?
rooms.map((room) => (<RoomBlock key={room.uuid} room={room} />))
: (<div className='text-lg'>There's no room at all.</div>)
}
</div>
</Main>
)
......