bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/waiting-users/waiting-users-graphql/guest-items/guestPendingUser.tsx

46 lines
1.5 KiB
TypeScript
Raw Normal View History

import React from 'react';
import Styled from '../styles';
import { GuestWaitingUser } from '../queries';
import renderGuestUserItem from './guestUserItem';
const ALLOW_STATUS = 'ALLOW';
const DENY_STATUS = 'DENY';
const renderPendingUsers = (
message: string,
usersArray: Array<GuestWaitingUser>,
action: (users: Array<GuestWaitingUser>, status: string) => void,
privateMessageVisible: (id: string) => void,
setPrivateGuestLobbyMessage: (msg: string, userId: string) => void,
privateGuestLobbyMessage: (userId: string) => string | null,
isGuestLobbyMessageEnabled: boolean,
) => {
if (!usersArray.length) return null;
return (
<Styled.PendingUsers>
<Styled.MainTitle>{message}</Styled.MainTitle>
<Styled.UsersWrapper>
<Styled.Users>
{usersArray.map((user, idx) => renderGuestUserItem(
user.user.name ?? '',
user.user.color ?? '',
() => action([user], ALLOW_STATUS),
() => action([user], DENY_STATUS),
user.user.role ?? '',
idx + 1,
user.user.userId ?? '',
user.user.avatar ?? '',
() => privateMessageVisible(`privateMessage-${user.user.userId}`),
(msg: string) => setPrivateGuestLobbyMessage(msg, user?.user?.userId ?? ''),
privateGuestLobbyMessage(user?.user?.userId ?? '') ?? '',
isGuestLobbyMessageEnabled,
))}
</Styled.Users>
</Styled.UsersWrapper>
</Styled.PendingUsers>
);
};
export default renderPendingUsers;