diff --git a/src/CONST.js b/src/CONST.js index 7f41055984f6..6bcac4aad78e 100755 --- a/src/CONST.js +++ b/src/CONST.js @@ -123,6 +123,8 @@ const CONST = { PLATFORM: { IOS: 'ios', ANDROID: 'android', + WEB: 'web', + DESKTOP: 'desktop', }, KEYBOARD_SHORTCUT_MODIFIERS: { CTRL: { diff --git a/src/libs/getPlatform/index.desktop.js b/src/libs/getPlatform/index.desktop.js index 30ac3e4128ee..c00ea00fd645 100644 --- a/src/libs/getPlatform/index.desktop.js +++ b/src/libs/getPlatform/index.desktop.js @@ -1,3 +1,5 @@ +import CONST from '../../CONST'; + export default function getPlatform() { - return 'desktop'; + return CONST.PLATFORM.DESKTOP; } diff --git a/src/libs/getPlatform/index.website.js b/src/libs/getPlatform/index.website.js index 7e6c88e6c07f..8b7e99c13c10 100644 --- a/src/libs/getPlatform/index.website.js +++ b/src/libs/getPlatform/index.website.js @@ -1,3 +1,5 @@ +import CONST from '../../CONST'; + export default function getPlatform() { - return 'web'; + return CONST.PLATFORM.WEB; } diff --git a/src/pages/settings/AboutPage/getPlatformSpecificMenuItems/index.js b/src/pages/settings/AboutPage/getPlatformSpecificMenuItems/index.js new file mode 100644 index 000000000000..52f8ffa2250f --- /dev/null +++ b/src/pages/settings/AboutPage/getPlatformSpecificMenuItems/index.js @@ -0,0 +1,15 @@ +import * as KeyboardShortcuts from '../../../../libs/actions/KeyboardShortcuts'; +import * as Expensicons from '../../../../components/Icon/Expensicons'; + +export default (isSmallScreenWidth) => { + if (isSmallScreenWidth) { + return []; + } + return [ + { + translationKey: 'initialSettingsPage.aboutPage.viewKeyboardShortcuts', + icon: Expensicons.Keyboard, + action: KeyboardShortcuts.showKeyboardShortcutModal, + }, + ]; +}; diff --git a/src/pages/settings/AboutPage/getPlatformSpecificMenuItems/index.native.js b/src/pages/settings/AboutPage/getPlatformSpecificMenuItems/index.native.js new file mode 100644 index 000000000000..4ba9480748fc --- /dev/null +++ b/src/pages/settings/AboutPage/getPlatformSpecificMenuItems/index.native.js @@ -0,0 +1 @@ +export default () => []; diff --git a/src/pages/settings/AboutPage.js b/src/pages/settings/AboutPage/index.js similarity index 79% rename from src/pages/settings/AboutPage.js rename to src/pages/settings/AboutPage/index.js index 8ac081eb5480..d99b98ebe9bd 100644 --- a/src/pages/settings/AboutPage.js +++ b/src/pages/settings/AboutPage/index.js @@ -1,27 +1,32 @@ import _ from 'underscore'; import React from 'react'; import {View, ScrollView} from 'react-native'; -import HeaderWithCloseButton from '../../components/HeaderWithCloseButton'; -import Navigation from '../../libs/Navigation/Navigation'; -import * as KeyboardShortcuts from '../../libs/actions/KeyboardShortcuts'; -import ROUTES from '../../ROUTES'; -import styles from '../../styles/styles'; -import ExpensifyText from '../../components/ExpensifyText'; -import CONST from '../../CONST'; -import * as Expensicons from '../../components/Icon/Expensicons'; -import ScreenWrapper from '../../components/ScreenWrapper'; -import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; -import MenuItem from '../../components/MenuItem'; -import Logo from '../../../assets/images/new-expensify.svg'; -import {version} from '../../../package.json'; -import * as Report from '../../libs/actions/Report'; -import * as Link from '../../libs/actions/Link'; +import HeaderWithCloseButton from '../../../components/HeaderWithCloseButton'; +import Navigation from '../../../libs/Navigation/Navigation'; +import ROUTES from '../../../ROUTES'; +import styles from '../../../styles/styles'; +import ExpensifyText from '../../../components/ExpensifyText'; +import CONST from '../../../CONST'; +import * as Expensicons from '../../../components/Icon/Expensicons'; +import ScreenWrapper from '../../../components/ScreenWrapper'; +import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize'; +import withWindowDimensions, {windowDimensionsPropTypes} from '../../../components/withWindowDimensions'; +import MenuItem from '../../../components/MenuItem'; +import Logo from '../../../../assets/images/new-expensify.svg'; +import {version} from '../../../../package.json'; +import * as Report from '../../../libs/actions/Report'; +import * as Link from '../../../libs/actions/Link'; +import getPlatformSpecificMenuItems from './getPlatformSpecificMenuItems'; +import compose from '../../../libs/compose'; const propTypes = { ...withLocalizePropTypes, + ...windowDimensionsPropTypes, }; const AboutPage = (props) => { + const platformSpecificMenuItems = getPlatformSpecificMenuItems(props.isSmallScreenWidth); + const menuItems = [ { translationKey: 'initialSettingsPage.aboutPage.appDownloadLinks', @@ -30,11 +35,7 @@ const AboutPage = (props) => { Navigation.navigate(ROUTES.SETTINGS_APP_DOWNLOAD_LINKS); }, }, - { - translationKey: 'initialSettingsPage.aboutPage.viewKeyboardShortcuts', - icon: Expensicons.Keyboard, - action: KeyboardShortcuts.showKeyboardShortcutModal, - }, + ...platformSpecificMenuItems, { translationKey: 'initialSettingsPage.aboutPage.viewTheCode', icon: Expensicons.Eye, @@ -146,4 +147,7 @@ const AboutPage = (props) => { AboutPage.propTypes = propTypes; AboutPage.displayName = 'AboutPage'; -export default withLocalize(AboutPage); +export default compose( + withLocalize, + withWindowDimensions, +)(AboutPage);