Fix/mobile breakouts: Clicking one user would select another user (#21351)
This commit is contained in:
parent
a9e0e872b1
commit
5c85b0a4d4
@ -18,7 +18,7 @@ interface RoomUserListProps {
|
||||
confirm: () => void;
|
||||
selectedRoom: number;
|
||||
rooms: {
|
||||
[key:number]: {
|
||||
[key: number]: {
|
||||
id: number;
|
||||
name: string;
|
||||
users: BreakoutUser[];
|
||||
@ -34,24 +34,16 @@ const RoomUserList: React.FC<RoomUserListProps> = ({
|
||||
confirm,
|
||||
}) => {
|
||||
const intl = useIntl();
|
||||
|
||||
const users = useMemo(() => {
|
||||
const userElements = Object.values(rooms).sort((a, b) => {
|
||||
if (a.id === selectedRoom) {
|
||||
return -1; // Move itemToMove to the front
|
||||
}
|
||||
if (b.id === selectedRoom) {
|
||||
return 1; // Move itemToMove to the front
|
||||
}
|
||||
return 0;
|
||||
}).map((room) => {
|
||||
return room.users.map((user) => {
|
||||
return (
|
||||
return Object.values(rooms).map((room) => {
|
||||
return room.users.map((user) => (
|
||||
<Styled.SelectUserContainer id={user.userId} key={`breakout-user-${user.userId}`}>
|
||||
<Styled.Round>
|
||||
<input
|
||||
type="checkbox"
|
||||
id={`itemId${room.id}`}
|
||||
defaultChecked={selectedRoom === room.id}
|
||||
id={`user-${user.userId}-room-${room.id}`}
|
||||
checked={selectedRoom === room.id}
|
||||
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
if (e.target.checked) {
|
||||
moveUser(user.userId, room.id, selectedRoom);
|
||||
@ -61,20 +53,17 @@ const RoomUserList: React.FC<RoomUserListProps> = ({
|
||||
}}
|
||||
/>
|
||||
{/* eslint-disable-next-line */}
|
||||
<label htmlFor={`itemId${room.id}`}>
|
||||
<input type="hidden" id={`itemId${room.id}`} />
|
||||
</label>
|
||||
<label htmlFor={`user-${user.userId}-room-${room.id}`} />
|
||||
</Styled.Round>
|
||||
<Styled.TextName>
|
||||
{user.name}
|
||||
{((room.id !== selectedRoom) && room.id !== 0) ? `\t[${room.id}]` : ''}
|
||||
{room.id !== 0 && room.id !== selectedRoom ? `\t[${room.id}]` : ''}
|
||||
</Styled.TextName>
|
||||
</Styled.SelectUserContainer>
|
||||
);
|
||||
});
|
||||
));
|
||||
}).flat();
|
||||
return userElements;
|
||||
}, [rooms, selectedRoom]);
|
||||
}, [rooms, selectedRoom, moveUser]);
|
||||
|
||||
return (
|
||||
<Styled.SelectUserScreen>
|
||||
<Styled.Header>
|
||||
|
Loading…
Reference in New Issue
Block a user