feat(dialog) refinaments

This commit is contained in:
Calin Chitu 2022-02-08 17:09:22 +02:00 committed by Calinteodor
parent 8a6b6f2942
commit 06bd279f22
8 changed files with 60 additions and 102 deletions

View File

@ -1,7 +1,7 @@
/* @flow */ /* @flow */
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Platform, Text, View } from 'react-native'; import { Text, View } from 'react-native';
import Dialog from 'react-native-dialog'; import Dialog from 'react-native-dialog';
import { connect as reduxConnect } from 'react-redux'; import { connect as reduxConnect } from 'react-redux';
import type { Dispatch } from 'redux'; import type { Dispatch } from 'redux';
@ -142,26 +142,6 @@ class LoginDialog extends Component<Props, State> {
_connecting: connecting, _connecting: connecting,
t t
} = this.props; } = this.props;
let rightKey;
let leftKey;
let rightOnPress;
let leftOnPress;
let rightDisabled;
let leftDisabled;
if (Platform.OS === 'android') {
rightKey = 'dialog.Ok';
rightOnPress = () => this._onLogin();
rightDisabled = connecting;
leftKey = 'dialog.Cancel';
leftOnPress = () => this._onCancel();
} else {
rightKey = 'dialog.Cancel';
rightOnPress = () => this._onCancel();
leftKey = 'dialog.Ok';
leftOnPress = () => this._onLogin();
leftDisabled = connecting;
}
return ( return (
<View> <View>
@ -187,13 +167,12 @@ class LoginDialog extends Component<Props, State> {
{ this._renderMessage() } { this._renderMessage() }
</Dialog.Description> </Dialog.Description>
<Dialog.Button <Dialog.Button
disabled = { rightDisabled } label = { t('dialog.Cancel') }
label = { t(rightKey) } onPress = { this._onCancel } />
onPress = { rightOnPress } />
<Dialog.Button <Dialog.Button
disabled = { leftDisabled } disabled = { connecting }
label = { t(leftKey) } label = { t('dialog.Ok') }
onPress = { leftOnPress } /> onPress = { this._onLogin } />
</Dialog.Container> </Dialog.Container>
</View> </View>
); );

View File

@ -1,7 +1,7 @@
// @flow // @flow
import React from 'react'; import React from 'react';
import { Platform, View } from 'react-native'; import { View } from 'react-native';
import Dialog from 'react-native-dialog'; import Dialog from 'react-native-dialog';
import { translate } from '../../../i18n'; import { translate } from '../../../i18n';
@ -110,29 +110,6 @@ class ConfirmDialog extends AbstractDialog<Props> {
= isConfirmDestructive = isConfirmDestructive
? styles.destructiveDialogButton : styles.dialogButton; ? styles.destructiveDialogButton : styles.dialogButton;
let rightLabel;
let leftLabel;
let rightOnPress;
let leftOnPress;
let rightStyle;
let leftStyle;
if (Platform.OS === 'android') {
rightLabel = confirmLabel || 'dialog.confirmYes';
rightOnPress = () => this._onSubmit();
rightStyle = dialogButtonStyle;
leftLabel = cancelLabel || 'dialog.confirmNo';
leftOnPress = () => this._onCancel();
leftStyle = styles.dialogButton;
} else {
rightLabel = cancelLabel || 'dialog.confirmNo';
rightOnPress = () => this._onCancel();
rightStyle = styles.dialogButton;
leftLabel = confirmLabel || 'dialog.confirmYes';
leftOnPress = () => this._onSubmit();
leftStyle = dialogButtonStyle;
}
return ( return (
<View> <View>
<Dialog.Container visible = { true }> <Dialog.Container visible = { true }>
@ -144,13 +121,13 @@ class ConfirmDialog extends AbstractDialog<Props> {
{ this._renderDescription() } { this._renderDescription() }
{ children } { children }
<Dialog.Button <Dialog.Button
label = { t(rightLabel) } label = { cancelLabel || t('dialog.confirmNo') }
onPress = { rightOnPress } onPress = { this._onCancel }
style = { rightStyle } /> style = { styles.dialogButton } />
<Dialog.Button <Dialog.Button
label = { t(leftLabel) } label = { confirmLabel || t('dialog.confirmYes') }
onPress = { leftOnPress } onPress = { this._onSubmit }
style = { leftStyle } /> style = { dialogButtonStyle } />
</Dialog.Container> </Dialog.Container>
</View> </View>
); );

View File

@ -97,7 +97,6 @@ class InputDialog<P: Props, S: State> extends AbstractDialog<P, S> {
return ( return (
<View> <View>
<Dialog.Container <Dialog.Container
onBackdropPress = { this._onCancel }
visible = { true }> visible = { true }>
<Dialog.Title> <Dialog.Title>
{ t(titleKey) } { t(titleKey) }
@ -122,6 +121,9 @@ class InputDialog<P: Props, S: State> extends AbstractDialog<P, S> {
</Dialog.Description> </Dialog.Description>
) )
} }
<Dialog.Button
label = { t('dialog.Cancel') }
onPress = { this._onCancel } />
<Dialog.Button <Dialog.Button
label = { t('dialog.Ok') } label = { t('dialog.Ok') }
onPress = { this._onSubmitValue } /> onPress = { this._onSubmitValue } />

View File

@ -1,6 +1,7 @@
// @flow // @flow
import { BoxModel, ColorPalette } from '../../../styles'; import { BoxModel, ColorPalette } from '../../../styles';
import BaseTheme from '../../../ui/components/BaseTheme.native';
const OVERLAY_FONT_COLOR = 'rgba(255, 255, 255, 0.6)'; const OVERLAY_FONT_COLOR = 'rgba(255, 255, 255, 0.6)';
const SECONDARY_ACTION_BUTTON_SIZE = 30; const SECONDARY_ACTION_BUTTON_SIZE = 30;
@ -130,7 +131,8 @@ const SECTION_LIST_STYLES = {
alignItems: 'center', alignItems: 'center',
flex: 1, flex: 1,
flexDirection: 'row', flexDirection: 'row',
padding: 5 marginHorizontal: BaseTheme.spacing[3],
marginVertical: BaseTheme.spacing[2]
}, },
listItemDetails: { listItemDetails: {
@ -162,7 +164,8 @@ const SECTION_LIST_STYLES = {
listSectionText: { listSectionText: {
color: OVERLAY_FONT_COLOR, color: OVERLAY_FONT_COLOR,
fontSize: 14, fontSize: 14,
fontWeight: 'normal' fontWeight: 'normal',
marginLeft: BaseTheme.spacing[2]
}, },
pullToRefresh: { pullToRefresh: {

View File

@ -1,9 +1,10 @@
// @flow // @flow
/* eslint-disable react/no-multi-comp */
import { TransitionPresets } from '@react-navigation/stack'; import { TransitionPresets } from '@react-navigation/stack';
import React from 'react'; import React from 'react';
import { useTranslation } from 'react-i18next';
import { Platform } from 'react-native'; import { Platform } from 'react-native';
import { Text, TouchableRipple } from 'react-native-paper';
import { import {
Icon, Icon,
@ -13,11 +14,20 @@ import {
IconInfo, IconInfo,
IconSettings IconSettings
} from '../../base/icons'; } from '../../base/icons';
import BaseTheme from '../../base/ui/components/BaseTheme'; import BaseTheme from '../../base/ui/components/BaseTheme.native';
import HeaderNavigationButton from './components/HeaderNavigationButton'; import HeaderNavigationButton from './components/HeaderNavigationButton';
import { goBack } from './components/conference/ConferenceNavigationContainerRef'; import { goBack } from './components/conference/ConferenceNavigationContainerRef';
/**
* Close button text color.
*/
export const closeTextColor = {
color: BaseTheme.palette.text01,
marginLeft: BaseTheme.spacing[3]
};
/** /**
* Navigation container theme. * Navigation container theme.
*/ */
@ -196,11 +206,28 @@ export const chatTabBarOptions = {
export const presentationScreenOptions = { export const presentationScreenOptions = {
...conferenceModalPresentation, ...conferenceModalPresentation,
headerBackTitleVisible: false, headerBackTitleVisible: false,
headerLeft: () => ( headerLeft: () => {
const { t } = useTranslation();
if (Platform.OS === 'ios') {
return (
<TouchableRipple
onPress = { goBack }
rippleColor = { BaseTheme.palette.screen01Header }>
<Text style = { closeTextColor }>
{ t('dialog.close') }
</Text>
</TouchableRipple>
);
}
return (
<HeaderNavigationButton <HeaderNavigationButton
onPress = { goBack } onPress = { goBack }
src = { IconClose } /> src = { IconClose } />
), );
},
headerStatusBarHeight: 0, headerStatusBarHeight: 0,
headerStyle: { headerStyle: {
backgroundColor: BaseTheme.palette.screen01Header backgroundColor: BaseTheme.palette.screen01Header

View File

@ -14,7 +14,6 @@ import { ColorSchemeRegistry } from '../../../../base/color-scheme';
import { FIELD_UNDERLINE } from '../../../../base/dialog'; import { FIELD_UNDERLINE } from '../../../../base/dialog';
import { getFeatureFlag, MEETING_PASSWORD_ENABLED } from '../../../../base/flags'; import { getFeatureFlag, MEETING_PASSWORD_ENABLED } from '../../../../base/flags';
import { translate } from '../../../../base/i18n'; import { translate } from '../../../../base/i18n';
import { IconClose } from '../../../../base/icons';
import JitsiScreen from '../../../../base/modal/components/JitsiScreen'; import JitsiScreen from '../../../../base/modal/components/JitsiScreen';
import { isLocalParticipantModerator } from '../../../../base/participants'; import { isLocalParticipantModerator } from '../../../../base/participants';
import { connect } from '../../../../base/redux'; import { connect } from '../../../../base/redux';
@ -24,10 +23,6 @@ import { isInBreakoutRoom } from '../../../../breakout-rooms/functions';
import { toggleLobbyMode } from '../../../../lobby/actions.any'; import { toggleLobbyMode } from '../../../../lobby/actions.any';
import LobbyModeSwitch import LobbyModeSwitch
from '../../../../lobby/components/native/LobbyModeSwitch'; from '../../../../lobby/components/native/LobbyModeSwitch';
import HeaderNavigationButton
from '../../../../mobile/navigation/components/HeaderNavigationButton';
import { goBack }
from '../../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
import { LOCKED_LOCALLY, LOCKED_REMOTELY } from '../../../../room-lock'; import { LOCKED_LOCALLY, LOCKED_REMOTELY } from '../../../../room-lock';
import { import {
endRoomLockRequest, endRoomLockRequest,
@ -107,11 +102,6 @@ type Props = {
*/ */
dispatch: Dispatch<any>, dispatch: Dispatch<any>,
/**
* Default prop for navigation between screen components(React Navigation).
*/
navigation: Object,
/** /**
* Invoked to obtain translated strings. * Invoked to obtain translated strings.
*/ */
@ -162,26 +152,6 @@ class SecurityDialog extends PureComponent<Props, State> {
this._onAddPassword = this._onAddPassword.bind(this); this._onAddPassword = this._onAddPassword.bind(this);
} }
/**
* Implements React's {@link Component#componentDidMount()}. Invoked
* immediately after this component is mounted.
*
* @inheritdoc
* @returns {void}
*/
componentDidMount() {
const { navigation } = this.props;
navigation.setOptions({
headerLeft: () => (
<HeaderNavigationButton
onPress = { goBack }
src = { IconClose }
style = { styles.headerCloseButton } />
)
});
}
/** /**
* Implements {@code SecurityDialog.render}. * Implements {@code SecurityDialog.render}.
* *

View File

@ -113,7 +113,7 @@ class WelcomePage extends AbstractWelcomePage<*> {
} }
style = { styles.drawerNavigationIcon }> style = { styles.drawerNavigationIcon }>
<Icon <Icon
size = { 20 } size = { 24 }
src = { IconMenu } src = { IconMenu }
style = { _headerStyles.headerButtonIcon } /> style = { _headerStyles.headerButtonIcon } />
</TouchableOpacity> </TouchableOpacity>

View File

@ -39,7 +39,7 @@ export default {
audioVideoSwitchContainer: { audioVideoSwitchContainer: {
alignItems: 'center', alignItems: 'center',
flexDirection: 'row', flexDirection: 'row',
marginRight: BaseTheme.spacing[2] marginRight: BaseTheme.spacing[3]
}, },
blankPageText: { blankPageText: {
@ -180,7 +180,8 @@ export default {
*/ */
roomContainer: { roomContainer: {
alignSelf: 'stretch', alignSelf: 'stretch',
flexDirection: 'column' flexDirection: 'column',
marginHorizontal: BaseTheme.spacing[2]
}, },
/** /**
@ -196,8 +197,7 @@ export default {
drawerNavigationIcon: { drawerNavigationIcon: {
height: BaseTheme.spacing[6], height: BaseTheme.spacing[6],
marginLeft: BaseTheme.spacing[1], marginLeft: BaseTheme.spacing[3],
marginTop: BaseTheme.spacing[1],
width: BaseTheme.spacing[6] width: BaseTheme.spacing[6]
}, },