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

Added an Error Page #6856

Merged
merged 32 commits into from
Jan 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8d800fe
feat(error-page): First draft of the page with the content
mananjadhav Dec 21, 2021
a9df026
feat(error-page): Additional styling and alignment
mananjadhav Dec 21, 2021
bacc606
feat(error-page): Added link styling and design adjustment
mananjadhav Dec 21, 2021
83fc0e2
feat(error-page): Fixed button size for small screen devices
mananjadhav Dec 21, 2021
5bf449b
feat(error-page): Added alignment for mobile devices and fixed functi…
mananjadhav Dec 21, 2021
c123dd1
feat(error-page): Code cleanup
mananjadhav Dec 21, 2021
132adef
Merge branch 'main' of https://github.com/mananjadhav/App into feat/e…
mananjadhav Dec 22, 2021
719d3c2
feat(error-page): Link fixes and removed unused code
mananjadhav Dec 23, 2021
68a0a3b
feat(error-page): Added reload for web and desktop
mananjadhav Dec 23, 2021
748719d
feat(error-page): Added app reload functionality
mananjadhav Dec 23, 2021
a025797
feat(error-page): Added comments
mananjadhav Dec 23, 2021
eb5e43c
fix: Removed unwanted package
mananjadhav Dec 30, 2021
ad552c6
Moved the component to pages
mananjadhav Dec 30, 2021
37699b7
fix: Fixed imports and props
mananjadhav Dec 30, 2021
e9064d5
fix: Added signOut and redirect
mananjadhav Dec 30, 2021
07e08e5
fix: Corrected translation keys
mananjadhav Dec 30, 2021
b47b6ee
fix: Styling for button alignment in mobile devices
mananjadhav Dec 30, 2021
ba3e32b
Merge branch 'main' of https://github.com/mananjadhav/App into feat/e…
mananjadhav Dec 30, 2021
88984eb
Merge branch 'main' of https://github.com/mananjadhav/App into feat/e…
mananjadhav Dec 30, 2021
fa1205c
fix: Update refs to Text component
mananjadhav Dec 30, 2021
6559976
fix: Corrected component name and moved Signout to props
mananjadhav Jan 1, 2022
5d0ef59
fix: Made buttons left aligned
mananjadhav Jan 1, 2022
f3ea35d
fix: Removed unwated props
mananjadhav Jan 1, 2022
c839bcd
fix: Added medium button style
mananjadhav Jan 3, 2022
d4fa9ff
fix: Changed button style to medium
mananjadhav Jan 3, 2022
ea9178c
fix: Removed windowDimensions
mananjadhav Jan 3, 2022
0e924d4
fix: Reduced the margin between buttons
mananjadhav Jan 3, 2022
fa78f55
Merge branch 'main' of https://github.com/mananjadhav/App into feat/e…
mananjadhav Jan 12, 2022
5101d2e
fix: Code cleanup
mananjadhav Jan 12, 2022
9209388
Merge branch 'feat/error-page' of https://github.com/mananjadhav/App …
mananjadhav Jan 12, 2022
964ee33
fix: Renamed func ref
mananjadhav Jan 12, 2022
ae0f10d
Merge branch 'main' of https://github.com/mananjadhav/App into feat/e…
mananjadhav Jan 13, 2022
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
6 changes: 6 additions & 0 deletions src/components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ const propTypes = {
/** Large sized button */
large: PropTypes.bool,

/** medium sized button */
medium: PropTypes.bool,

/** Indicates whether the button should be disabled and in the loading state */
isLoading: PropTypes.bool,

Expand Down Expand Up @@ -79,6 +82,7 @@ const defaultProps = {
isDisabled: false,
small: false,
roryabraham marked this conversation as resolved.
Show resolved Hide resolved
large: false,
medium: false,
onPress: () => {},
onLongPress: () => {},
onPressIn: () => {},
Expand Down Expand Up @@ -142,6 +146,7 @@ class Button extends Component {
style={[
styles.buttonText,
this.props.small && styles.buttonSmallText,
this.props.medium && styles.buttonMediumText,
this.props.large && styles.buttonLargeText,
this.props.success && styles.buttonSuccessText,
this.props.danger && styles.buttonDangerText,
Expand Down Expand Up @@ -189,6 +194,7 @@ class Button extends Component {
style={[
styles.button,
this.props.small ? styles.buttonSmall : undefined,
this.props.medium ? styles.buttonMedium : undefined,
this.props.large ? styles.buttonLarge : undefined,
this.props.success ? styles.buttonSuccess : undefined,
this.props.danger ? styles.buttonDanger : undefined,
Expand Down
9 changes: 7 additions & 2 deletions src/components/ErrorBoundary/BaseErrorBoundary.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import BootSplash from '../../libs/BootSplash';
import GenericErrorPage from '../../pages/GenericErrorPage';

const propTypes = {
/* A message posted to `logError` (along with error data) when this component intercepts an error */
Expand All @@ -26,6 +27,7 @@ class BaseErrorBoundary extends React.Component {
constructor(props) {
super(props);
this.state = {hasError: false};
this.clearError = this.clearError.bind(this);
}

static getDerivedStateFromError() {
Expand All @@ -40,10 +42,13 @@ class BaseErrorBoundary extends React.Component {
BootSplash.hide({fade: true});
}

clearError() {
this.setState({hasError: false});
}

render() {
if (this.state.hasError) {
// For the moment we've decided not to render any fallback UI
return null;
return <GenericErrorPage onRefresh={this.clearError} />;
}

return this.props.children;
Expand Down
9 changes: 9 additions & 0 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -895,4 +895,13 @@ export default {
screenShare: 'Screen share',
screenShareRequest: 'Expensify is inviting you to a screen share',
},
genericErrorPage: {
title: 'Uh-oh, something went wrong!',
body: {
helpTextMobile: 'Please try closing and reopening the app or switching to',
helpTextWeb: 'web.',
roryabraham marked this conversation as resolved.
Show resolved Hide resolved
helpTextConcierge: 'If the problem persists, reach out to',
},
refresh: 'Refresh',
},
};
9 changes: 9 additions & 0 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -897,4 +897,13 @@ export default {
screenShare: 'Compartir pantalla',
screenShareRequest: 'Expensify te está invitando a compartir la pantalla',
},
genericErrorPage: {
title: '¡Uh-oh, algo salió mal!',
body: {
helpTextMobile: 'Intente cerrar y volver a abrir la aplicación o cambiar a la',
helpTextWeb: 'web.',
roryabraham marked this conversation as resolved.
Show resolved Hide resolved
helpTextConcierge: 'Si el problema persiste, comuníquese con',
},
refresh: 'Refresh',
},
};
1 change: 1 addition & 0 deletions src/pages/GenericErrorPage/ErrorBodyText/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default () => null;
23 changes: 23 additions & 0 deletions src/pages/GenericErrorPage/ErrorBodyText/index.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import Text from '../../../components/Text';
import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize';
import TextLink from '../../../components/TextLink';
import CONST from '../../../CONST';
import styles from '../../../styles/styles';

const propTypes = {
...withLocalizePropTypes,
};

const ErrorBodyText = props => (
<Text>
{`${props.translate('genericErrorPage.body.helpTextMobile')} `}
<TextLink href={CONST.NEW_EXPENSIFY_URL} style={[styles.link]}>
{props.translate('genericErrorPage.body.helpTextWeb')}
</TextLink>
</Text>
);

ErrorBodyText.displayName = 'ErrorBodyText';
ErrorBodyText.propTypes = propTypes;
mananjadhav marked this conversation as resolved.
Show resolved Hide resolved
export default withLocalize(ErrorBodyText);
83 changes: 83 additions & 0 deletions src/pages/GenericErrorPage/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import React from 'react';
import PropTypes from 'prop-types';
import {View} from 'react-native';
import Icon from '../../components/Icon';
import defaultTheme from '../../styles/themes/default';
import * as Expensicons from '../../components/Icon/Expensicons';
import Text from '../../components/Text';
import Button from '../../components/Button';
import LogoWordmark from '../../../assets/images/expensify-wordmark.svg';
import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize';
import * as Session from '../../libs/actions/Session';
import variables from '../../styles/variables';
import styles from '../../styles/styles';
import ErrorBodyText from './ErrorBodyText';
import TextLink from '../../components/TextLink';
import CONST from '../../CONST';

const propTypes = {
...withLocalizePropTypes,

/** Callback to call on refresh button click */
onRefresh: PropTypes.func.isRequired,
};

const GenericErrorPage = props => (
<View style={[styles.flex1, styles.pv10, styles.ph5, styles.errorPageContainer]}>
<View style={[styles.flex1, styles.alignItemsCenter, styles.justifyContentCenter]}>
<View style={styles.alignItemsStart}>
<View style={styles.mb5}>
<Icon
src={Expensicons.Bug}
height={variables.componentSizeNormal}
width={variables.componentSizeNormal}
fill={defaultTheme.iconSuccessFill}
/>
</View>
<View style={styles.mb5}>
<Text style={[styles.headerText, styles.textXXLarge]}>
{props.translate('genericErrorPage.title')}
</Text>
</View>
<View style={styles.mb5}>
<ErrorBodyText />
<Text>
{`${props.translate('genericErrorPage.body.helpTextConcierge')} `}
<TextLink href={`mailto:${CONST.EMAIL.CONCIERGE}`} style={[styles.link]}>
{CONST.EMAIL.CONCIERGE}
</TextLink>
</Text>
</View>
<View style={[styles.dFlex, styles.flexRow, styles.w100]}>
<View style={[styles.flex1, styles.flexRow]}>
<Button
success
medium
onPress={props.onRefresh}
text={props.translate('genericErrorPage.refresh')}
style={styles.mr3}
/>
<Button
medium
onPress={() => {
Session.signOut();
props.onRefresh();
}}
text={props.translate('initialSettingsPage.signOut')}
/>
</View>
</View>
</View>
</View>
<View styles={styles.alignSelfEnd}>
<View style={[styles.flex1, styles.flexRow, styles.justifyContentCenter]}>
<LogoWordmark height={30} width={80} />
</View>
</View>
</View>
);

GenericErrorPage.propTypes = propTypes;
GenericErrorPage.displayName = 'GenericErrorPage';

mananjadhav marked this conversation as resolved.
Show resolved Hide resolved
export default withLocalize(GenericErrorPage);
25 changes: 25 additions & 0 deletions src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ const styles = {
fontSize: variables.fontSizeLarge,
},

textXXLarge: {
fontSize: variables.fontSizeXXLarge,
},

textXXXLarge: {
color: themeColors.heading,
fontFamily: fontFamily.GTA_BOLD,
Expand Down Expand Up @@ -324,13 +328,24 @@ const styles = {
backgroundColor: themeColors.buttonDefaultBG,
},

buttonMedium: {
borderRadius: variables.componentBorderRadiusNormal,
height: variables.componentSizeNormal,
paddingTop: 6,
paddingRight: 12,
paddingBottom: 6,
paddingLeft: 12,
backgroundColor: themeColors.buttonDefaultBG,
mananjadhav marked this conversation as resolved.
Show resolved Hide resolved
},

buttonLarge: {
borderRadius: variables.componentBorderRadius,
height: variables.componentSizeLarge,
paddingTop: 8,
paddingRight: 12,
paddingBottom: 8,
paddingLeft: 12,
backgroundColor: themeColors.buttonDefaultBG,
},

buttonSmallText: {
Expand All @@ -340,6 +355,13 @@ const styles = {
textAlign: 'center',
},

buttonMediumText: {
fontSize: variables.fontSizeLabel,
fontFamily: fontFamily.GTA_BOLD,
fontWeight: fontWeightBold,
textAlign: 'center',
},

buttonLargeText: {
fontSize: variables.fontSizeNormal,
fontFamily: fontFamily.GTA_BOLD,
Expand Down Expand Up @@ -2367,6 +2389,9 @@ const styles = {
flex: 1,
},

errorPageContainer: {
backgroundColor: themeColors.componentBG,
},
mananjadhav marked this conversation as resolved.
Show resolved Hide resolved
transferBalancePayment: {
borderWidth: 2,
borderRadius: variables.componentBorderRadiusNormal,
Expand Down
4 changes: 4 additions & 0 deletions src/styles/utilities/spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ export default {
paddingVertical: 20,
},

pv10: {
paddingVertical: 40,
},

ph0: {
paddingHorizontal: 0,
},
Expand Down
1 change: 1 addition & 0 deletions src/styles/variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default {
fontSizeLarge: 17,
fontSizeHero: 36,
fontSizeh1: 19,
fontSizeXXLarge: 28,
fontSizeXXXLarge: 32,
fontSizeNormalHeight: 20,
lineHeightHero: 40,
Expand Down