import React from 'react'; import { View, Text } from 'react-native'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import I18n from '../../i18n'; import Button from '../../containers/Button'; import styles from './styles'; import { themes } from '../../constants/colors'; import { withTheme } from '../../theme'; import FormContainer, { FormContainerInner } from '../../containers/FormContainer'; import ServerAvatar from './ServerAvatar'; import { getShowLoginButton } from '../../selectors/login'; class WorkspaceView extends React.Component { static navigationOptions = { title: I18n.t('Your_workspace') } static propTypes = { navigation: PropTypes.object, theme: PropTypes.string, Site_Name: PropTypes.string, Site_Url: PropTypes.string, server: PropTypes.string, Assets_favicon_512: PropTypes.object, registrationForm: PropTypes.string, registrationText: PropTypes.string, showLoginButton: PropTypes.bool, inviteLinkToken: PropTypes.string } get showRegistrationButton() { const { registrationForm, inviteLinkToken } = this.props; return registrationForm === 'Public' || (registrationForm === 'Secret URL' && inviteLinkToken?.length); } login = () => { const { navigation, Site_Name } = this.props; navigation.navigate('LoginView', { title: Site_Name }); } register = () => { const { navigation, Site_Name } = this.props; navigation.navigate('RegisterView', { title: Site_Name }); } render() { const { theme, Site_Name, Site_Url, Assets_favicon_512, server, registrationText, showLoginButton } = this.props; return ( {Site_Name} {Site_Url} {showLoginButton ? (