Skip to content

Commit

Permalink
Merge pull request Expensify#9165 from Expensify/luke-full-page-offli…
Browse files Browse the repository at this point in the history
…ne-view
  • Loading branch information
roryabraham authored May 27, 2022
2 parents 1d58296 + f1b80b9 commit 06d38b5
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 2 deletions.
5 changes: 5 additions & 0 deletions assets/images/offline-cloud.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 52 additions & 0 deletions src/components/FullPageOfflineBlockingView.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import React from 'react';
import PropTypes from 'prop-types';
import {View} from 'react-native';
import Icon from './Icon';
import networkPropTypes from './networkPropTypes';
import {withNetwork} from './OnyxProvider';
import Text from './Text';
import withLocalize, {withLocalizePropTypes} from './withLocalize';
import * as Expensicons from './Icon/Expensicons';
import themeColors from '../styles/themes/default';
import styles from '../styles/styles';
import compose from '../libs/compose';

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 (
<View
style={[styles.flex1, styles.alignItemsCenter, styles.justifyContentCenter]}
>
<Icon
src={Expensicons.OfflineCloud}
fill={themeColors.offline}
width={50}
height={50}
/>
<Text style={[styles.h1]}>{props.translate('common.youAppearToBeOffline')}</Text>
<Text style={[styles.w70, styles.textAlignCenter]}>{props.translate('common.thisFeatureRequiresInternet')}</Text>
</View>
);
}

return props.children;
};

FullPageOfflineBlockingView.propTypes = propTypes;
FullPageOfflineBlockingView.displayName = 'FullPageOfflineBlockingView';

export default compose(
withLocalize,
withNetwork(),
)(FullPageOfflineBlockingView);
2 changes: 2 additions & 0 deletions src/components/Icon/Expensicons.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import Monitor from '../../../assets/images/monitor.svg';
import NewWindow from '../../../assets/images/new-window.svg';
import NewWorkspace from '../../../assets/images/new-workspace.svg';
import Offline from '../../../assets/images/offline.svg';
import OfflineCloud from '../../../assets/images/offline-cloud.svg';
import Paperclip from '../../../assets/images/paperclip.svg';
import Paycheck from '../../../assets/images/paycheck.svg';
import PayPal from '../../../assets/images/paypal.svg';
Expand Down Expand Up @@ -135,6 +136,7 @@ export {
NewWindow,
NewWorkspace,
Offline,
OfflineCloud,
Paperclip,
Paycheck,
PayPal,
Expand Down
3 changes: 2 additions & 1 deletion src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ export default {
leaveRoom: 'Leave room',
your: 'your',
conciergeHelp: 'Please reach out to Concierge for help.',
youAppearToBeOffline: 'You appear to be offline.',
thisFeatureRequiresInternet: 'This feature requires an active internet connection to be used.',
},
attachmentPicker: {
cameraPermissionRequired: 'Camera permission required',
Expand Down Expand Up @@ -158,7 +160,6 @@ export default {
writeSomething: 'Write something...',
sayHello: 'Say hello!',
blockedFromConcierge: 'Communication is barred',
youAppearToBeOffline: 'You appear to be offline.',
fileUploadFailed: 'Upload failed. File is not supported.',
localTime: ({user, time}) => `It's ${time} for ${user}`,
edited: '(edited)',
Expand Down
3 changes: 2 additions & 1 deletion src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ export default {
leaveRoom: 'Salir de la sala de chat',
your: 'tu',
conciergeHelp: 'Por favor contacta con Concierge para obtener ayuda.',
youAppearToBeOffline: 'Parece que estás desconectado.',
thisFeatureRequiresInternet: 'Esta función requiere una conexión a Internet activa para ser utilizada.',
},
attachmentPicker: {
cameraPermissionRequired: 'Se necesita permiso para usar la cámara',
Expand Down Expand Up @@ -158,7 +160,6 @@ export default {
writeSomething: 'Escribe algo...',
sayHello: 'Di hola!',
blockedFromConcierge: 'Comunicación no permitida',
youAppearToBeOffline: 'Parece que estás desconectado.',
fileUploadFailed: 'Subida fallida. El archivo no es compatible.',
localTime: ({user, time}) => `Son las ${time} para ${user}`,
edited: '(editado)',
Expand Down

0 comments on commit 06d38b5

Please sign in to comment.