Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
yash-rajpal committed Sep 3, 2024
1 parent 80b9c35 commit cc14c02
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 73 deletions.
14 changes: 7 additions & 7 deletions app/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"Announcement": "Announcement",
"announcement": "announcement",
"App_users_are_not_allowed_to_log_in_directly": "App users are not allowed to log in directly.",
"Apply_Your_Certificate": "Apply your certificate",
"Apply_Certificate": "Apply certificate",
"ARCHIVE": "ARCHIVE",
"archive": "archive",
"are_typing": "are typing",
Expand Down Expand Up @@ -213,7 +213,7 @@
"Discussions": "Discussions",
"Display": "Display",
"Displays_action_text": "Displays action text",
"Do_you_have_a_certificate": "Do you have a certificate?",
"Do_you_have_a_certificate": "Do you have a certificate for this workspace?",
"Do_you_have_an_account": "Do you have an account?",
"Do_you_really_want_to_key_this_room_question_mark": "Do you really want to {{key}} this room?",
"Documentation": "Documentation",
Expand Down Expand Up @@ -243,6 +243,7 @@
"Edit_Invite": "Edit invite",
"Edit_Status": "Edit status",
"Email": "E-mail",
"email": "Email",
"Email_Notification_Mode_All": "Every mention/DM",
"Email_Notification_Mode_Disabled": "Disabled",
"Empty": "Empty",
Expand All @@ -264,7 +265,6 @@
"Enter_E2EE_Password": "Enter E2EE password",
"Enter_E2EE_Password_description": "To access your encrypted channels and direct messages, enter your encryption password. This is not stored on the server, so you’ll need to use it on every device.",
"Enter_the_code": "Enter the code we just emailed you.",
"Enter_workspace_URL": "Enter workspace URL",
"Error_Download_file": "Error while downloading file",
"Error_play_video": "There was an error while playing this video",
"Error_uploading": "Error uploading",
Expand Down Expand Up @@ -330,6 +330,7 @@
"Invalid_Email": "Invalid email",
"Invalid_or_expired_invite_token": "Invalid or expired invite token",
"Invalid_server_version": "The workspace you're trying to connect is using a version that's not supported by the app anymore: {{currentVersion}}.\n\nWe require version {{minVersion}}",
"Invalid_workspace_URL": "Invalid workspace URL",
"Invisible": "Invisible",
"Invite_Link": "Invite link",
"Invite_user_to_join_channel": "Invite one user to join this channel",
Expand Down Expand Up @@ -488,7 +489,7 @@
"no-videoconf-provider-app-body": "Conference call apps can be installed in the Rocket.Chat Marketplace by a workspace admin.",
"no-videoconf-provider-app-header": "Conference call not available",
"Not_in_channel": "Not in channel",
"Not_RC_Server": "This is not a Rocket.Chat workspace.\n{{contact}}",
"Not_RC_Server": "Contact your workspace admin or search your email inbox for a Rocket.Chat workspace invite.",
"Nothing": "Nothing",
"Nothing_to_save": "Nothing to save!",
"Notification_delay": "Notification delay",
Expand Down Expand Up @@ -819,8 +820,8 @@
"Without_Servers": "Without workspaces",
"Workspace_consumption": "Workspace consumption",
"Workspace_consumption_description": "There’s a set amount of push notifications per month",
"Workspace_URL_Example": "Ex. your-company.rocket.chat",
"Workspaces": "Workspaces",
"Workspace_URL": "Workspace URL",
"Workspace_URL_Example": "open.rocket.chat",
"Would_like_to_place_on_hold": "Would you like to place this chat on hold?",
"Would_you_like_to_return_the_inquiry": "Would you like to return the inquiry?",
"Write_External_Permission": "Gallery permission",
Expand Down Expand Up @@ -854,5 +855,4 @@
"Your_invite_link_will_never_expire": "Your invite link will never expire.",
"Your_password_is": "Your password is",
"Your_push_was_sent_to_s_devices": "Your push was sent to {{s}} devices",
"Your_workspace": "Your workspace"
}
6 changes: 3 additions & 3 deletions app/lib/methods/getServerInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export async function getServerInfo(server: string): Promise<TServerInfoResult>
if (!serverInfo?.success) {
return {
success: false,
message: I18n.t('Not_RC_Server', { contact: I18n.t('Contact_your_server_admin') })
message: I18n.t('Not_RC_Server')
};
}

Expand Down Expand Up @@ -109,14 +109,14 @@ export async function getServerInfo(server: string): Promise<TServerInfoResult>
}
return {
success: false,
message: e.message
message: I18n.t('Not_RC_Server')
};
}
}

return {
success: false,
message: I18n.t('Not_RC_Server', { contact: I18n.t('Contact_your_server_admin') })
message: I18n.t('Not_RC_Server')
};
}

Expand Down
4 changes: 2 additions & 2 deletions app/sagas/selectServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ const getServerInfoSaga = function* getServerInfoSaga({ server, raiseError = tru
const serverInfoResult = yield* call(getServerInfo, server);
if (raiseError) {
if (!serverInfoResult.success) {
Alert.alert(I18n.t('Oops'), serverInfoResult.message);
Alert.alert(I18n.t('Invalid_workspace_URL'), serverInfoResult.message);
yield put(serverFailure());
return;
}
const websocketInfo = yield* call(Services.getWebsocketInfo, { server });
if (!websocketInfo.success) {
Alert.alert(I18n.t('Oops'), websocketInfo.message);
Alert.alert(I18n.t('Invalid_workspace_URL'), websocketInfo.message);
yield put(serverFailure());
return;
}
Expand Down
Binary file added app/static/images/logo_with_name.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions app/views/ForgotPasswordView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,19 @@ const ForgotPasswordView = (): React.ReactElement => {
<FormContainer testID='forgot-password-view'>
<FormContainerInner>
<Text style={[sharedStyles.loginTitle, sharedStyles.textBold, { color: colors.fontTitlesLabels }]}>
{I18n.t('Forgot_password')}
{I18n.t('Reset_password')}
</Text>
<Text>
{I18n.t('email')}
</Text>
<ControlledFormTextInput
name='email'
control={control}
autoFocus
placeholder={I18n.t('Email')}
// placeholder={I18n.t('Email')}
keyboardType='email-address'
returnKeyType='send'
iconLeft='mail'
// iconLeft='mail'
onSubmitEditing={handleSubmit(resetPassword)}
testID='forgot-password-view-email'
containerStyle={sharedStyles.inputLastChild}
Expand Down
5 changes: 4 additions & 1 deletion app/views/LoginView/UserForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { StackNavigationProp } from '@react-navigation/stack';
import * as yup from 'yup';
import { yupResolver } from '@hookform/resolvers/yup';
import { useForm } from 'react-hook-form';
import parse from 'url-parse';

import { loginRequest } from '../../actions/login';
import Button from '../../containers/Button';
Expand Down Expand Up @@ -54,6 +55,7 @@ const UserForm = () => {
isFetching,
Accounts_RegistrationForm,
Site_Name,
Site_Url,
inviteLinkToken,
error,
failure
Expand All @@ -65,6 +67,7 @@ const UserForm = () => {
Accounts_PasswordPlaceholder: state.settings.Accounts_PasswordPlaceholder as string,
Accounts_PasswordReset: state.settings.Accounts_PasswordReset as boolean,
Site_Name: state.settings.Site_Name as string,
Site_Url: state.settings.Site_Url as string,
inviteLinkToken: state.inviteLinks.token,
failure: state.login.failure,
error: state.login.error && state.login.error.data
Expand All @@ -89,7 +92,7 @@ const UserForm = () => {
};

const forgotPassword = () => {
navigation.navigate('ForgotPasswordView', { title: Site_Name });
navigation.navigate('ForgotPasswordView', { title: new parse(Site_Url).hostname });
};

const submit = ({ password, user }: ISubmit) => {
Expand Down
2 changes: 1 addition & 1 deletion app/views/NewServerView/ServerInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const ServerInput = ({
return (
<View style={styles.container}>
<FormTextInput
label={I18n.t('Enter_workspace_URL')}
label={I18n.t('Workspace_URL')}
placeholder={I18n.t('Workspace_URL_Example')}
containerStyle={styles.inputContainer}
value={text}
Expand Down
72 changes: 18 additions & 54 deletions app/views/NewServerView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Q } from '@nozbe/watermelondb';
import { Base64 } from 'js-base64';
import React from 'react';
import { BackHandler, Image, Keyboard, StyleSheet, Text, View } from 'react-native';
import { TouchableOpacity } from 'react-native-gesture-handler';
import { connect } from 'react-redux';
import parse from 'url-parse';

Expand Down Expand Up @@ -37,25 +36,13 @@ const styles = StyleSheet.create({
alignSelf: 'center',
resizeMode: 'contain'
},
title: {
...sharedStyles.textBold,
letterSpacing: 0,
alignSelf: 'center'
},
subtitle: {
...sharedStyles.textRegular,
alignSelf: 'center'
},
certificatePicker: {
alignItems: 'center',
justifyContent: 'flex-end'
},
chooseCertificateTitle: {
...sharedStyles.textRegular
},
chooseCertificate: {
...sharedStyles.textSemibold
},
description: {
...sharedStyles.textRegular,
textAlign: 'center'
Expand Down Expand Up @@ -122,7 +109,7 @@ class NewServerView extends React.Component<INewServerViewProps, INewServerViewS
const { previousServer, navigation, connecting } = this.props;
if (previousServer) {
return navigation.setOptions({
headerTitle: I18n.t('Workspaces'),
headerTitle: I18n.t('Add_server'),
headerLeft: () =>
!connecting ? (
<HeaderButton.CloseModal navigation={navigation} onPress={this.close} testID='new-server-view-close' />
Expand Down Expand Up @@ -293,13 +280,13 @@ class NewServerView extends React.Component<INewServerViewProps, INewServerViewS

renderCertificatePicker = () => {
const { certificate } = this.state;
const { theme, width, height, previousServer } = this.props;
const { theme, width, height, previousServer, connecting } = this.props;
return (
<View
style={[
styles.certificatePicker,
{
marginBottom: verticalScale({ size: previousServer && !isTablet ? 10 : 30, height })
marginTop: verticalScale({ size: previousServer && !isTablet ? 10 : 16, height })
}
]}
>
Expand All @@ -311,24 +298,22 @@ class NewServerView extends React.Component<INewServerViewProps, INewServerViewS
>
{certificate ? I18n.t('Your_certificate') : I18n.t('Do_you_have_a_certificate')}
</Text>
<TouchableOpacity
<Button
onPress={certificate ? this.handleRemove : this.chooseCertificate}
testID='new-server-choose-certificate'
>
<Text
style={[styles.chooseCertificate, { color: themes[theme].fontInfo, fontSize: moderateScale({ size: 13, width }) }]}
>
{certificate ?? I18n.t('Apply_Your_Certificate')}
</Text>
</TouchableOpacity>
title={certificate ?? I18n.t('Apply_Certificate')}
type='secondary'
disabled={connecting}
style={{ marginTop: verticalScale({ size: 16, height }), width: '100%' }}
/>
</View>
);
};

render() {
const { connecting, theme, previousServer, width, height } = this.props;
const { text, connectingOpen, serversHistory } = this.state;
const marginTop = previousServer ? 0 : 35;
const marginTop = previousServer ? 32 : 84;

return (
<FormContainer testID='new-server-view' keyboardShouldPersistTaps='never'>
Expand All @@ -337,38 +322,17 @@ class NewServerView extends React.Component<INewServerViewProps, INewServerViewS
style={[
styles.onboardingImage,
{
marginBottom: verticalScale({ size: 10, height }),
marginBottom: verticalScale({ size: 32, height }),
marginTop: isTablet ? 0 : verticalScale({ size: marginTop, height }),
width: verticalScale({ size: 100, height }),
height: verticalScale({ size: 100, height })
width: verticalScale({ size: 375, height }),
height: verticalScale({ size: 43, height })
}
]}
source={require('../../static/images/logo.png')}
source={require('../../static/images/logo_with_name.png')}
fadeDuration={0}
/>
<Text
style={[
styles.title,
{
color: themes[theme].fontTitlesLabels,
fontSize: moderateScale({ size: 22, width }),
marginBottom: verticalScale({ size: 8, height })
}
]}
>
Rocket.Chat
</Text>
<Text
style={[
styles.subtitle,
{
color: themes[theme].fontHint,
fontSize: moderateScale({ size: 16, width }),
marginBottom: verticalScale({ size: 30, height })
}
]}
>
{I18n.t('Onboarding_subtitle')}
<Text style={{ fontSize: moderateScale({ size: 24, width }), marginBottom: verticalScale({ size: 24, height }), ...sharedStyles.textBold }}>
{I18n.t('Add_server')}
</Text>
<ServerInput
text={text}
Expand All @@ -388,7 +352,8 @@ class NewServerView extends React.Component<INewServerViewProps, INewServerViewS
style={[styles.connectButton, { marginTop: verticalScale({ size: 16, height }) }]}
testID='new-server-view-button'
/>
{isIOS ? (
{this.renderCertificatePicker()}
{isIOS && !previousServer ? (
<>
<OrSeparator theme={theme} />
<Text
Expand All @@ -414,7 +379,6 @@ class NewServerView extends React.Component<INewServerViewProps, INewServerViewS
</>
) : null}
</FormContainerInner>
{this.renderCertificatePicker()}
</FormContainer>
);
}
Expand Down
5 changes: 3 additions & 2 deletions app/views/WorkspaceView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Text, View } from 'react-native';
import { useNavigation } from '@react-navigation/native';
import { StackNavigationProp } from '@react-navigation/stack';
import { CompositeNavigationProp } from '@react-navigation/core';
import parse from 'url-parse';

import { OutsideModalParamList, OutsideParamList } from '../../stacks/types';
import I18n from '../../i18n';
Expand Down Expand Up @@ -51,9 +52,9 @@ const WorkspaceView = () => {

useLayoutEffect(() => {
navigation.setOptions({
title: I18n.t('Your_workspace')
title: new parse(Site_Url).hostname
});
}, [navigation]);
}, [navigation, Site_Url]);

const showRegistrationButton = !!(
!Accounts_iframe_enabled &&
Expand Down

0 comments on commit cc14c02

Please sign in to comment.