Skip to content

Commit

Permalink
Merge pull request #6881 from akshayasalvi/hide-keyboard-shortcuts-menu
Browse files Browse the repository at this point in the history
(cherry picked from commit c218d61)
  • Loading branch information
roryabraham authored and OSBotify committed Dec 22, 2021
1 parent ddf2a69 commit ae2b2aa
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 23 deletions.
2 changes: 2 additions & 0 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ const CONST = {
PLATFORM: {
IOS: 'ios',
ANDROID: 'android',
WEB: 'web',
DESKTOP: 'desktop',
},
KEYBOARD_SHORTCUT_MODIFIERS: {
CTRL: {
Expand Down
4 changes: 3 additions & 1 deletion src/libs/getPlatform/index.desktop.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import CONST from '../../CONST';

export default function getPlatform() {
return 'desktop';
return CONST.PLATFORM.DESKTOP;
}
4 changes: 3 additions & 1 deletion src/libs/getPlatform/index.website.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import CONST from '../../CONST';

export default function getPlatform() {
return 'web';
return CONST.PLATFORM.WEB;
}
15 changes: 15 additions & 0 deletions src/pages/settings/AboutPage/getPlatformSpecificMenuItems/index.js
Original file line number Diff line number Diff line change
@@ -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,
},
];
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default () => [];
Original file line number Diff line number Diff line change
@@ -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',
Expand All @@ -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,
Expand Down Expand Up @@ -146,4 +147,7 @@ const AboutPage = (props) => {
AboutPage.propTypes = propTypes;
AboutPage.displayName = 'AboutPage';

export default withLocalize(AboutPage);
export default compose(
withLocalize,
withWindowDimensions,
)(AboutPage);

0 comments on commit ae2b2aa

Please sign in to comment.