2021-04-09 12:30:25 +00:00
|
|
|
import React from 'react';
|
2022-08-24 09:46:22 +00:00
|
|
|
import { WithTranslation } from 'react-i18next';
|
|
|
|
import { View } from 'react-native';
|
2021-04-09 12:30:25 +00:00
|
|
|
|
2022-08-24 09:46:22 +00:00
|
|
|
import { translate } from '../../../base/i18n/functions';
|
|
|
|
import { connect } from '../../../base/redux/functions';
|
|
|
|
import Switch from '../../../base/ui/components/native/Switch';
|
2022-02-22 16:39:06 +00:00
|
|
|
import {
|
|
|
|
DISABLED_TRACK_COLOR,
|
|
|
|
ENABLED_TRACK_COLOR,
|
|
|
|
THUMB_COLOR
|
2022-08-24 09:46:22 +00:00
|
|
|
|
|
|
|
// @ts-ignore
|
2022-07-28 07:28:29 +00:00
|
|
|
} from '../../../settings/components/native/styles';
|
2021-04-09 12:30:25 +00:00
|
|
|
|
2022-08-24 09:46:22 +00:00
|
|
|
// @ts-ignore
|
2022-02-22 16:39:06 +00:00
|
|
|
import styles from './styles';
|
2021-04-09 12:30:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} props of {@link LobbyModeSwitch}.
|
|
|
|
*/
|
2022-08-24 09:46:22 +00:00
|
|
|
interface Props extends WithTranslation {
|
2021-04-09 12:30:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* True if the lobby mode is currently enabled for this conference.
|
|
|
|
*/
|
|
|
|
lobbyEnabled: boolean,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback to be invoked when handling enable-disable lobby mode switch.
|
|
|
|
*/
|
2022-08-24 09:46:22 +00:00
|
|
|
onToggleLobbyMode: (on?: boolean) => void;
|
|
|
|
}
|
2021-04-09 12:30:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Component meant to Enable/Disable lobby mode.
|
|
|
|
*
|
|
|
|
* @returns {React$Element<any>}
|
|
|
|
*/
|
|
|
|
function LobbyModeSwitch(
|
|
|
|
{
|
|
|
|
lobbyEnabled,
|
|
|
|
onToggleLobbyMode
|
|
|
|
}: Props) {
|
|
|
|
|
|
|
|
return (
|
|
|
|
<View style = { styles.lobbySwitchContainer }>
|
|
|
|
<Switch
|
2022-08-24 09:46:22 +00:00
|
|
|
checked = { lobbyEnabled }
|
|
|
|
onChange = { onToggleLobbyMode }
|
2021-04-09 12:30:25 +00:00
|
|
|
style = { styles.lobbySwitchIcon }
|
2022-02-17 14:51:00 +00:00
|
|
|
thumbColor = { THUMB_COLOR }
|
2022-02-22 16:39:06 +00:00
|
|
|
trackColor = {{
|
|
|
|
true: ENABLED_TRACK_COLOR,
|
|
|
|
false: DISABLED_TRACK_COLOR
|
2022-08-24 09:46:22 +00:00
|
|
|
}} />
|
2021-04-09 12:30:25 +00:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default translate(connect()(LobbyModeSwitch));
|