f05cfd0cf8
* 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
36 lines
1.2 KiB
TypeScript
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,
|
|
};
|