-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Add FullPageNotFoundView #9649
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
Merged
Merged
Add FullPageNotFoundView #9649
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a944abd
added shared BlockingView
arosiclair a065334
use shared BlockingView
arosiclair fb38457
fix icon proptype
arosiclair 46d86a3
added FullPageNotFoundView
arosiclair fc9c43f
added default props
arosiclair a29148f
added new not found text and spanish translation
arosiclair b0054eb
removed empty unused NotFound file
arosiclair bbc40d5
use offline color as default icon color
arosiclair 81fbbe8
better prop naming
arosiclair File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| import React from 'react'; | ||
| import {View} from 'react-native'; | ||
| import PropTypes from 'prop-types'; | ||
| import styles from '../../styles/styles'; | ||
| import variables from '../../styles/variables'; | ||
| import Icon from '../Icon'; | ||
| import Text from '../Text'; | ||
| import themeColors from '../../styles/themes/default'; | ||
|
|
||
| const propTypes = { | ||
| /** Expensicon for the page */ | ||
| icon: PropTypes.func.isRequired, | ||
|
|
||
| /** Color for the icon (should be from theme) */ | ||
| iconColor: PropTypes.string, | ||
|
|
||
| /** Title message below the icon */ | ||
| title: PropTypes.string.isRequired, | ||
|
|
||
| /** Subtitle message below the title */ | ||
| subtitle: PropTypes.string.isRequired, | ||
| }; | ||
|
|
||
| const defaultProps = { | ||
| iconColor: themeColors.offline, | ||
| }; | ||
|
|
||
| const BlockingView = props => ( | ||
| <View | ||
| style={[styles.flex1, styles.alignItemsCenter, styles.justifyContentCenter]} | ||
| > | ||
| <Icon | ||
| src={props.icon} | ||
| fill={props.iconColor} | ||
| width={variables.iconSizeSuperLarge} | ||
| height={variables.iconSizeSuperLarge} | ||
| /> | ||
| <Text style={[styles.headerText, styles.textLarge, styles.mt5]}>{props.title}</Text> | ||
| <Text style={[styles.w70, styles.textAlignCenter]}>{props.subtitle}</Text> | ||
| </View> | ||
| ); | ||
|
|
||
| BlockingView.propTypes = propTypes; | ||
| BlockingView.defaultProps = defaultProps; | ||
| BlockingView.displayName = 'BlockingView'; | ||
|
|
||
| export default BlockingView; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
|
|
||
| import React from 'react'; | ||
| import PropTypes from 'prop-types'; | ||
| import BlockingView from './BlockingView'; | ||
| import * as Expensicons from '../Icon/Expensicons'; | ||
| import withLocalize, {withLocalizePropTypes} from '../withLocalize'; | ||
|
|
||
| const propTypes = { | ||
| /** Props to fetch translation features */ | ||
| ...withLocalizePropTypes, | ||
|
|
||
| /** Child elements */ | ||
| children: PropTypes.node.isRequired, | ||
|
|
||
| /** If true, child components are replaced with a blocking "not found" view */ | ||
| shouldShow: PropTypes.bool, | ||
| }; | ||
|
|
||
| const defaultProps = { | ||
| shouldShow: false, | ||
| }; | ||
|
|
||
| // eslint-disable-next-line rulesdir/no-negated-variables | ||
| const FullPageNotFoundView = (props) => { | ||
| if (props.shouldShow) { | ||
| return ( | ||
| <BlockingView | ||
| icon={Expensicons.QuestionMark} | ||
| title={props.translate('notFound.notHere')} | ||
| subtitle={props.translate('notFound.pageNotFound')} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| return props.children; | ||
| }; | ||
|
|
||
| FullPageNotFoundView.propTypes = propTypes; | ||
| FullPageNotFoundView.defaultProps = defaultProps; | ||
| FullPageNotFoundView.displayName = 'FullPageNotFoundView'; | ||
|
|
||
| export default withLocalize(FullPageNotFoundView); |
41 changes: 41 additions & 0 deletions
41
src/components/BlockingViews/FullPageOfflineBlockingView.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import React from 'react'; | ||
| import PropTypes from 'prop-types'; | ||
| import networkPropTypes from '../networkPropTypes'; | ||
| import {withNetwork} from '../OnyxProvider'; | ||
| import withLocalize, {withLocalizePropTypes} from '../withLocalize'; | ||
| import * as Expensicons from '../Icon/Expensicons'; | ||
| import compose from '../../libs/compose'; | ||
| import BlockingView from './BlockingView'; | ||
|
|
||
| const propTypes = { | ||
| /** Child elements */ | ||
| children: PropTypes.node.isRequired, | ||
|
|
||
| /** Props to fetch translation features */ | ||
| ...withLocalizePropTypes, | ||
|
|
||
| /** Props to detect online status */ | ||
| network: networkPropTypes.isRequired, | ||
| }; | ||
|
|
||
| const FullPageOfflineBlockingView = (props) => { | ||
| if (props.network.isOffline) { | ||
| return ( | ||
| <BlockingView | ||
| icon={Expensicons.OfflineCloud} | ||
| title={props.translate('common.youAppearToBeOffline')} | ||
| subtitle={props.translate('common.thisFeatureRequiresInternet')} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| return props.children; | ||
| }; | ||
|
|
||
| FullPageOfflineBlockingView.propTypes = propTypes; | ||
| FullPageOfflineBlockingView.displayName = 'FullPageOfflineBlockingView'; | ||
|
|
||
| export default compose( | ||
| withLocalize, | ||
| withNetwork(), | ||
| )(FullPageOfflineBlockingView); |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.