feat(native-participants-pane) removed button component, fixed icons inside paper button component and reverted actions.js files

This commit is contained in:
Calin Chitu 2021-05-19 18:56:08 +03:00 committed by Hristo Terezov
parent 08a4da22f3
commit cb0b68f840
7 changed files with 33 additions and 187 deletions

View File

@ -23,24 +23,3 @@ export function toggleLobbyMode(enabled: boolean) {
}
};
}
/**
* Approves (lets in) or rejects a knocking participant.
*
* @param {string} id - The id of the knocking participant.
* @param {boolean} approved - True if the participant is approved, false otherwise.
* @returns {Function}
*/
export function setKnockingParticipantApproval(id: string, approved: boolean) {
return async (dispatch: Dispatch<any>, getState: Function) => {
const conference = getCurrentConference(getState);
if (conference) {
if (approved) {
conference.lobbyApproveAccess(id);
} else {
conference.lobbyDenyAccess(id);
}
}
};
}

View File

@ -5,7 +5,6 @@ import { openDialog } from '../base/dialog';
import { DisableLobbyModeDialog, EnableLobbyModeDialog } from './components/native';
export * from './actions.web';
export * from './actions.any';
/**
* Action to show the dialog to disable lobby mode.

View File

@ -1,3 +0,0 @@
// @flow
export * from './actions.any';

View File

@ -1,3 +0,0 @@
// @flow
export * from './actions.any';

View File

@ -1,115 +0,0 @@
// @flow
import React from 'react';
import { View } from 'react-native';
import { Button as PaperButton } from 'react-native-paper';
import { Icon } from '../../../base/icons';
let buttonContent;
/**
* The type of the React {@code Component} props of {@link Button}
*/
type Props = {
/**
* Button content.
*/
content?: string,
/**
* Is the button icon type?
*/
iconButton?: boolean,
/**
* Style for the icon
*/
iconStyle?: Object,
/**
* Size of the icon.
*/
iconSize?: number,
/**
* Icon component source.
*/
iconSrc?: Object,
/**
* Button mode.
*/
mode?: string,
/**
* Style of button's inner content.
*/
contentStyle?: Object,
/**
* The action to be performed when the button is pressed.
*/
onPress?: Function,
/**
* An external style object passed to the component.
*/
style?: Object,
/**
* Theme to be applied.
*/
theme?: Object
};
/**
* Close button component.
*
* @returns {React$Element<any>}
*/
function Button({
iconButton,
iconStyle,
iconSize,
iconSrc,
content,
contentStyle,
mode,
onPress,
style,
theme
}: Props) {
if (iconButton) {
buttonContent
= (<View
/* eslint-disable-next-line react-native/no-inline-styles */
style = {{
height: 0,
width: 0
}}>
<Icon
size = { iconSize }
src = { iconSrc }
style = { iconStyle } />
</View>);
} else {
buttonContent = content;
}
return (
<PaperButton
contentStyle = { contentStyle }
mode = { mode }
onPress = { onPress }
style = { style }
theme = { theme }>
{ buttonContent }
</PaperButton>
);
}
export default Button;

View File

@ -3,16 +3,14 @@
import React, { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { View } from 'react-native';
import { withTheme } from 'react-native-paper';
import { Button, withTheme } from 'react-native-paper';
import { useDispatch, useSelector } from 'react-redux';
import { IconClose, IconHorizontalPoints } from '../../../base/icons';
import { Icon, IconClose, IconHorizontalPoints } from '../../../base/icons';
import { JitsiModal } from '../../../base/modal';
import { isLocalParticipantModerator } from '../../../base/participants';
import { close } from '../../actions.any';
import Button from './Button';
import { LobbyParticipantList } from './LobbyParticipantList';
import styles from './styles';
@ -47,11 +45,13 @@ function ParticipantsPane({ theme }: Props) {
style = { styles.participantsPane }>
<View style = { styles.header }>
<Button
contentStyle = { styles.muteAllContent }
iconButton = { true }
iconSize = { 16 }
iconSrc = { IconClose }
iconStyle = { styles.closeIcon }
contentStyle = { styles.closeIcon }
/* eslint-disable-next-line react/jsx-no-bind */
icon = { () =>
(<Icon
size = { 16 }
src = { IconClose } />)
}
mode = 'contained'
onPress = { closePane }
style = { styles.closeButton }
@ -61,31 +61,30 @@ function ParticipantsPane({ theme }: Props) {
}
}} />
</View>
<LobbyParticipantList />
{
isLocalModerator
&& <View style = { styles.footer }>
<Button
content = { t('participantsPane.actions.muteAll') }
contentStyle = { styles.muteAllContent }
onPress = { closePane }
style = { styles.muteAllButton } />
<Button
contentStyle = { styles.muteAllContent }
iconButton = { true }
iconSize = { 16 }
iconSrc = { IconHorizontalPoints }
iconStyle = { styles.moreIcon }
mode = 'contained'
onPress = { closePane }
style = { styles.moreButton }
theme = {{
colors: {
primary: palette.action02
}
}} />
</View>
}
<View style = { styles.footer }>
<Button
contentStyle = { styles.muteAllContent }
onPress = { closePane }
style = { styles.muteAllButton } >
{ t('participantsPane.actions.muteAll') }
</Button>
<Button
contentStyle = { styles.moreIcon }
/* eslint-disable-next-line react/jsx-no-bind */
icon = { () =>
(<Icon
size = { 16 }
src = { IconHorizontalPoints } />)
}
mode = 'contained'
onPress = { closePane }
style = { styles.moreButton }
theme = {{
colors: {
primary: palette.action02
}
}} />
</View>
</JitsiModal>
);
}

View File

@ -147,16 +147,6 @@ export default {
...buttonContent
},
moreButtonPaper: {
...smallButton,
height: 48
},
moreIconPaper: {
alignItems: 'center',
flexDirection: 'row-reverse'
},
muteAllButton: {
...button,
paddingBottom: 12,