bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/waiting-users/waiting-users-graphql/service.ts
Tainan Felipe f05cfd0cf8
Refactor: migrate waitingUserPanel to TS and graphql (#18677)
* Refactor: migrate waitingUserPanel to TS and graphql

* Small code improvements

* Fix: allow everyone aren't working

* Fix: add a condition for edge cases

* Make the remember choice works well

* Fix TS and eslint errors

* Change eslint

* Change eslint
2023-10-06 14:12:42 -03:00

36 lines
1.2 KiB
TypeScript

import { GuestWaitingUser } from './queries';
import { makeCall } from '/imports/ui/services/api';
export const privateMessageVisible = (id: string) => {
const privateInputSpace = document.getElementById(id);
if (privateInputSpace) {
if (privateInputSpace.style.display === 'block') {
privateInputSpace.style.display = 'none';
} else {
privateInputSpace.style.display = 'block';
}
}
};
export const getNameInitials = (name: string) => {
const nameInitials = name.slice(0, 2);
return nameInitials.replace(/^\w/, (c: string) => c.toUpperCase());
};
export const guestUsersCall = (guestsArray: GuestWaitingUser[], status: string) => makeCall('allowPendingUsers', guestsArray, status);
export const setGuestLobbyMessage = (message: string) => makeCall('setGuestLobbyMessage', message);
export const setPrivateGuestLobbyMessage = (message: string, guestId: string) => makeCall('setPrivateGuestLobbyMessage', message, guestId);
export const changeGuestPolicy = (policyRule: string) => makeCall('changeGuestPolicy', policyRule);
export default {
privateMessageVisible,
guestUsersCall,
setGuestLobbyMessage,
getNameInitials,
changeGuestPolicy,
};