Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 20 additions & 0 deletions src/components/BlockingViews/BlockingView.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import variables from '../../styles/variables';
import Icon from '../Icon';
import Text from '../Text';
import themeColors from '../../styles/themes/default';
import TextLink from '../TextLink';
import Navigation from '../../libs/Navigation/Navigation';
import ROUTES from '../../ROUTES';

const propTypes = {
/** Expensicon for the page */
Expand All @@ -19,10 +22,18 @@ const propTypes = {

/** Subtitle message below the title */
subtitle: PropTypes.string.isRequired,

/** Link message below the subtitle */
link: PropTypes.string,

/** Whether we should show a go back home link */
shouldShowBackHomeLink: PropTypes.bool,
};

const defaultProps = {
iconColor: themeColors.offline,
shouldShowBackHomeLink: false,
link: 'notFound.goBackHome',
};

const BlockingView = props => (
Expand All @@ -37,6 +48,15 @@ const BlockingView = props => (
/>
<Text style={[styles.notFoundTextHeader]}>{props.title}</Text>
<Text style={[styles.textAlignCenter]}>{props.subtitle}</Text>
{props.shouldShowBackHomeLink
? (
<TextLink
onPress={() => Navigation.navigate(ROUTES.REPORT)}
style={[styles.link, styles.mt2]}
>
{props.link}
</TextLink>
) : null}
</View>
);

Expand Down
10 changes: 10 additions & 0 deletions src/components/BlockingViews/FullPageNotFoundView.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ const propTypes = {
/** Whether we should show a close button */
shouldShowCloseButton: PropTypes.bool,

/** Whether we should show a go back home link */
shouldShowBackHomeLink: PropTypes.bool,

/** The key in the translations file to use for the go back link */
linkKey: PropTypes.string,

/** Method to trigger when pressing the back button of the header */
onBackButtonPress: PropTypes.func,
};
Expand All @@ -40,7 +46,9 @@ const defaultProps = {
shouldShow: false,
titleKey: 'notFound.notHere',
subtitleKey: 'notFound.pageNotFound',
linkKey: 'notFound.goBackHome',
shouldShowBackButton: true,
shouldShowBackHomeLink: false,
shouldShowCloseButton: true,
onBackButtonPress: () => Navigation.dismissModal(),
};
Expand All @@ -61,6 +69,8 @@ const FullPageNotFoundView = (props) => {
icon={Expensicons.QuestionMark}
title={props.translate(props.titleKey)}
subtitle={props.translate(props.subtitleKey)}
link={props.translate(props.linkKey)}
shouldShowBackHomeLink={props.shouldShowBackHomeLink}
/>
</View>
</>
Expand Down
1 change: 1 addition & 0 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ export default {
notHere: "Hmm... it's not here",
pageNotFound: 'That page is nowhere to be found.',
noAccess: 'You don\'t have access to this chat',
goBackHome: 'Go back to Home page',
},
setPasswordPage: {
enterPassword: 'Enter a password',
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,7 @@ export default {
notHere: 'Hmm… no está aquí',
pageNotFound: 'La página que buscas no existe.',
noAccess: 'No tienes acceso a este chat',
goBackHome: 'Volver a la página principal',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

asked internally to confirm this

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
goBackHome: 'Volver a la página principal',
goBackHome: 'Regresar a la página principal',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok scrap this, they changed their minds

},
setPasswordPage: {
enterPassword: 'Escribe una contraseña',
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ErrorPage/NotFoundPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import FullPageNotFoundView from '../../components/BlockingViews/FullPageNotFoun
// eslint-disable-next-line rulesdir/no-negated-variables
const NotFoundPage = () => (
<ScreenWrapper>
<FullPageNotFoundView shouldShow />
<FullPageNotFoundView shouldShow shouldShowBackHomeLink />
</ScreenWrapper>
);

Expand Down