Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sign in page/set password page styles, refactoring #1910

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
1ed958a
added flex: 1 to set password page
jasperhuangg Mar 19, 2021
91580d5
Make set password page UI more similar to sign in page UI
jasperhuangg Mar 22, 2021
c2d8015
fix eslint
jasperhuangg Mar 22, 2021
f6b1ef6
dry up and reduce the number of components
jasperhuangg Mar 23, 2021
12b3938
fix styles
jasperhuangg Mar 23, 2021
fc2808e
fix jsx style
jasperhuangg Mar 23, 2021
de2ab03
remove accidentally committed files
jasperhuangg Mar 24, 2021
09678ef
Revert "remove accidentally committed files"
jasperhuangg Mar 24, 2021
451bb16
revert to master versions
jasperhuangg Mar 24, 2021
47cf198
refactor based on PR comments
jasperhuangg Mar 24, 2021
61a0a2f
Update WelcomeText.js
jasperhuangg Mar 24, 2021
436cfd1
remove unused eslint-disable
jasperhuangg Mar 24, 2021
42ca8e8
revert SetPasswordPage.js
jasperhuangg Mar 24, 2021
8ebaf84
Merge branch 'jasper-fixSetPasswordPageFlex' of github.com:Expensify/…
jasperhuangg Mar 24, 2021
6d56db5
move SetPasswordPage.js to new folder
jasperhuangg Mar 24, 2021
f9e1fe6
modify SetPasswordPage.js with new refactor
jasperhuangg Mar 24, 2021
9491840
fix exporting component
jasperhuangg Mar 24, 2021
9a362da
remove unused onyx
jasperhuangg Mar 24, 2021
8db75cc
put with onyx back
jasperhuangg Mar 24, 2021
6b6c43f
Refactor everything into a single component
jasperhuangg Mar 25, 2021
88733cd
Merge branch 'master' into jasper-fixSetPasswordPageFlex
jasperhuangg Mar 25, 2021
ea5b973
Eslint fix
jasperhuangg Mar 25, 2021
3330380
Merge remote-tracking branch 'origin/jasper-fixSetPasswordPageFlex' i…
jasperhuangg Mar 25, 2021
461aef6
Fix import
jasperhuangg Mar 25, 2021
8dc41d2
Use compose
jasperhuangg Mar 26, 2021
5bef9a1
Add displayName
jasperhuangg Mar 26, 2021
f534f06
Use ...windowDimensionsPropTypes
jasperhuangg Mar 26, 2021
ade55fb
Revert stuff changed by --fix
jasperhuangg Mar 26, 2021
c7382e1
Revert stuff changed by --fix
jasperhuangg Mar 26, 2021
a658b53
Revert back into multiple components to fix layout on wide native dev…
jasperhuangg Mar 31, 2021
cc0ebcd
Fix ESLint
jasperhuangg Mar 31, 2021
e6a3604
Revert "Fix ESLint"
jasperhuangg Apr 1, 2021
951f4fb
Revert "Revert back into multiple components to fix layout on wide na…
jasperhuangg Apr 1, 2021
5b48bd0
Refactored back into single components, change SigninPageLayout so it…
jasperhuangg Apr 1, 2021
19684a4
Fix indent
jasperhuangg Apr 1, 2021
c265e20
Remove duplicate text
jasperhuangg Apr 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/components/WelcomeText.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import {Text, View} from 'react-native';
import styles from '../styles/styles';
import withWindowDimensions, {windowDimensionsPropTypes} from './withWindowDimensions';

const propTypes = {
...windowDimensionsPropTypes,
};

const WelcomeText = props => (
<View style={props.isSmallScreenWidth ? [] : [styles.mb6, styles.mt6]}>
<Text style={[props.isSmallScreenWidth ? styles.textLabel : styles.textP, styles.textStrong, styles.mb1]}>
With Expensify.cash, chat and payments are the same thing.
</Text>
<Text style={[props.isSmallScreenWidth ? styles.textLabel : styles.textP]}>
Money talks. And now that chat and payments are in one place, it&apos;s also easy.
{' '}
Your payments get to you as fast as you can get your point across.
</Text>
</View>
);

WelcomeText.propTypes = propTypes;
jasperhuangg marked this conversation as resolved.
Show resolved Hide resolved
WelcomeText.displayName = 'WelcomeText';

export default withWindowDimensions(WelcomeText);
54 changes: 33 additions & 21 deletions src/pages/SetPasswordPage.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
import React, {Component} from 'react';
jasperhuangg marked this conversation as resolved.
Show resolved Hide resolved
import {
Image,
SafeAreaView,
Text,
TextInput,
View,
} from 'react-native';
import PropTypes from 'prop-types';
import lodashGet from 'lodash/get';
import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
import lodashGet from 'lodash/get';
import styles from '../styles/styles';
import ExpensifyCashLogo from '../../assets/images/expensify-cash.svg';
import {setPassword} from '../libs/actions/Session';
import SignInPageLayout from './signin/SignInPageLayout';
import welcomeScreenshot from '../../assets/images/welcome-screenshot.png';
import withWindowDimensions, {windowDimensionsPropTypes} from '../components/withWindowDimensions';
import WelcomeText from '../components/WelcomeText';
import ONYXKEYS from '../ONYXKEYS';
import variables from '../styles/variables';
import {setPassword} from '../libs/actions/Session';
import ButtonWithLoader from '../components/ButtonWithLoader';
import compose from '../libs/compose';

const propTypes = {
/* Onyx Props */
Expand Down Expand Up @@ -42,8 +46,8 @@ const propTypes = {
validateCode: PropTypes.string,
}),
}),
...windowDimensionsPropTypes,
};

const defaultProps = {
account: {},
credentials: {},
Expand Down Expand Up @@ -83,17 +87,11 @@ class SetPasswordPage extends Component {

render() {
return (
<>
<SafeAreaView style={[styles.signInPage]}>
<View style={[styles.signInPageInner]}>
<View style={[styles.signInPageLogo]}>
<ExpensifyCashLogo
width={variables.componentSizeLarge}
height={variables.componentSizeLarge}
/>
</View>
<SafeAreaView style={[styles.signInPage]}>
<SignInPageLayout>
<View style={[styles.loginFormContainer]}>
<View style={[styles.mb4]}>
<Text style={[styles.formLabel]}>Enter a password</Text>
<Text style={[styles.formLabel]}>Enter a password:</Text>
<TextInput
style={[styles.textInput]}
secureTextEntry
Expand All @@ -102,6 +100,7 @@ class SetPasswordPage extends Component {
value={this.state.password}
onChangeText={text => this.setState({password: text})}
onSubmitEditing={this.submitForm}
autoFocus
/>
</View>
<ButtonWithLoader
Expand All @@ -119,17 +118,30 @@ class SetPasswordPage extends Component {
{this.props.account.error}
</Text>
)}
{this.props.isSmallScreenWidth && (
<View style={[styles.mt5, styles.mb5]}>
<Image
resizeMode="contain"
style={[styles.signinWelcomeScreenshot]}
source={welcomeScreenshot}
/>
</View>
)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is the effect you are going for, but I noticed that if we are viewing this on an iPad this "welcome screenshot" is no longer present.

We are using the "narrow" view on all iOS devices so this ends up looking like this...

iPad
Screen Shot 2021-03-26 at 8 36 24 AM

iPhone
Screen Shot 2021-03-26 at 8 38 38 AM

Copy link
Contributor Author

@jasperhuangg jasperhuangg Mar 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh that is strange and definitely not what I was going for. So the width used for isSmallScreenWidth also includes iPad widths.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcaaron I noticed that this issue appears when you try to run it natively on iOS; I was wondering how you were able to access the set password page on iOS in this branch? Normally for web I access it via the URL.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, isSmallScreenWidth is just based on the screen width on any platform

this issue appears when you try to run it natively on iOS

I'm using deep links to open this screen directly like this

npx uri-scheme open expensify-cash://setpassword/123456 --ios

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcaaron Hmm tried it on my end with this branch and I wasn't able to reproduce the bug:

Simulator Screen Shot - iPad Pro (9 7-inch) - 2021-03-29 at 10 28 07

Is the main issue you're concerned about the image not showing up for you? Or did you want to change it so that we use the "wide" view for iPad?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The screenshot you are showing is the web version of the app shown in Safari app. The issue I am describing occurs in the native version of the app. Maybe try merging the main branch back into this branch and try again.

Copy link
Contributor Author

@jasperhuangg jasperhuangg Mar 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcaaron

Ah duh; I uploaded the wrong screenshot (I've got like 50 screenshots on my desktop, my bad!)

Screen Shot 2021-03-30 at 1 30 27 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcaaron

So the issue is that we're defaulting to the narrow view on all iOS devices, but this iOS device in particular has a width greater than the cut off for mobile devices.

Since we put everything into a single component, I have to display the welcome screenshot conditionally based on the screen width.

I tried modifying index.native.js to use the screenWidth conditionally to display the narrow/wide views, but the wide view doesn't display correctly on iOS.

Screen Shot 2021-03-31 at 12 22 11 PM

A solution is to refactor everything to use the same pattern as the log in page, or to figure out why the styles aren't showing up correctly for the wide view on iOS (which could potentially be a deep rabbit hole).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've refactored everything back into multiple components seeing that the sign in page follows this same pattern, and it makes more sense to have two pages that look nearly identical to have the same structure. This is necessary for everything to display properly seeing that we default to the narrow view for ios.

Screen Shot 2021-03-31 at 1 11 01 PM

</View>
</SafeAreaView>
</>
<WelcomeText />
</SignInPageLayout>
</SafeAreaView>
);
}
}

SetPasswordPage.propTypes = propTypes;
SetPasswordPage.defaultProps = defaultProps;

export default withOnyx({
credentials: {key: ONYXKEYS.CREDENTIALS},
account: {key: ONYXKEYS.ACCOUNT},
})(SetPasswordPage);
export default compose(
withOnyx({
credentials: {key: ONYXKEYS.CREDENTIALS},
account: {key: ONYXKEYS.ACCOUNT},
}),
withWindowDimensions,
)(SetPasswordPage);
12 changes: 2 additions & 10 deletions src/pages/signin/LoginForm/LoginFormNarrow.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import ButtonWithLoader from '../../../components/ButtonWithLoader';
import {fetchAccountDetails} from '../../../libs/actions/Session';
import welcomeScreenshot from '../../../../assets/images/welcome-screenshot.png';
import ONYXKEYS from '../../../ONYXKEYS';
import WelcomeText from '../../../components/WelcomeText';

const propTypes = {
/* Onyx Props */
Expand Down Expand Up @@ -103,16 +104,7 @@ class LoginFormNarrow extends React.Component {
/>
</View>

<View>
<Text style={[styles.textLabel, styles.textStrong, styles.mb1]}>
With Expensify.cash, chat and payments are the same thing.
</Text>
<Text style={[styles.textLabel]}>
Money talks. And now that chat and payments are in one place, it&apos;s also easy.
{' '}
Your payments get to you as fast as you can get your point across.
</Text>
</View>
<WelcomeText />
</View>
);
}
Expand Down
15 changes: 2 additions & 13 deletions src/pages/signin/LoginForm/LoginFormWide.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {fetchAccountDetails} from '../../../libs/actions/Session';
import styles from '../../../styles/styles';
import ButtonWithLoader from '../../../components/ButtonWithLoader';
import ONYXKEYS from '../../../ONYXKEYS';
import WelcomeText from '../../../components/WelcomeText';

const propTypes = {
/* Onyx Props */
Expand Down Expand Up @@ -92,19 +93,7 @@ class LoginFormWide extends React.Component {
</Text>
)}
</View>

<View style={[styles.mt6]}>
<View style={[styles.mb6]}>
<Text style={[styles.textP, styles.textStrong, styles.mb1]}>
With Expensify.cash, chat and payments are the same thing.
</Text>
<Text style={[styles.textP]}>
Money talks. And now that chat and payments are in one place, it&apos;s also easy.
{' '}
Your payments get to you as fast as you can get your point across.
</Text>
</View>
</View>
<WelcomeText />
</>
);
}
Expand Down
1 change: 1 addition & 0 deletions src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ const styles = {
backgroundColor: themeColors.sidebar,
padding: 20,
minHeight: '100%',
flex: 1,
},

signInPageLogo: {
Expand Down