[IMPROVEMENT] Add "Message" option to Room Info (#3029)

* [CHORE] Go to room from hashtag

* Layout tweaks

Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
Gung Wah 2021-04-01 21:54:39 +08:00 committed by GitHub
parent 656127aaab
commit 0ff916dc50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 10 deletions

View File

@ -306,7 +306,9 @@ class RoomInfoView extends React.Component {
const onActionPress = async() => { const onActionPress = async() => {
try { try {
if (this.isDirect) {
await this.createDirect(); await this.createDirect();
}
onPress(); onPress();
} catch { } catch {
EventEmitter.emit(LISTENER, { message: I18n.t('error-action-not-allowed', { action: I18n.t('Create_Direct_Messages') }) }); EventEmitter.emit(LISTENER, { message: I18n.t('error-action-not-allowed', { action: I18n.t('Create_Direct_Messages') }) });
@ -333,7 +335,7 @@ class RoomInfoView extends React.Component {
return ( return (
<View style={styles.roomButtonsContainer}> <View style={styles.roomButtonsContainer}>
{this.renderButton(this.goRoom, 'message', I18n.t('Message'))} {this.renderButton(this.goRoom, 'message', I18n.t('Message'))}
{jitsiEnabled ? this.renderButton(this.videoCall, 'camera', I18n.t('Video_call')) : null} {jitsiEnabled && this.isDirect ? this.renderButton(this.videoCall, 'camera', I18n.t('Video_call')) : null}
</View> </View>
); );
} }
@ -360,10 +362,10 @@ class RoomInfoView extends React.Component {
style={{ backgroundColor: themes[theme].backgroundColor }} style={{ backgroundColor: themes[theme].backgroundColor }}
testID='room-info-view' testID='room-info-view'
> >
<View style={[styles.avatarContainer, this.isDirect && styles.avatarContainerDirectRoom, { backgroundColor: themes[theme].auxiliaryBackground }]}> <View style={[styles.avatarContainer, { backgroundColor: themes[theme].auxiliaryBackground }]}>
{this.renderAvatar(room, roomUser)} {this.renderAvatar(room, roomUser)}
<View style={styles.roomTitleContainer}>{ getRoomTitle(room, this.t, roomUser?.name, roomUser?.username, roomUser?.statusText, theme) }</View> <View style={styles.roomTitleContainer}>{ getRoomTitle(room, this.t, roomUser?.name, roomUser?.username, roomUser?.statusText, theme) }</View>
{this.isDirect ? this.renderButtons() : null} {this.renderButtons()}
</View> </View>
{this.renderContent()} {this.renderContent()}
</SafeAreaView> </SafeAreaView>

View File

@ -16,15 +16,12 @@ export default StyleSheet.create({
justifyContent: 'center' justifyContent: 'center'
}, },
avatarContainer: { avatarContainer: {
minHeight: 240, minHeight: 320,
flexDirection: 'column', flexDirection: 'column',
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
marginBottom: 20 marginBottom: 20,
}, paddingVertical: 8
avatarContainerDirectRoom: {
paddingVertical: 16,
minHeight: 320
}, },
avatar: { avatar: {
marginHorizontal: 10 marginHorizontal: 10