Skip to content
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

Simplify global create menu #24357

Closed
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
32380b4
Install react-navigation-bottom-tabs
MaciejSWM Jul 28, 2023
aa28ffa
Tab navigator for New Chat screens
MaciejSWM Jul 28, 2023
1105c34
Change keyboard shortcut to open New Chat instead of New Group
MaciejSWM Jul 28, 2023
8f11527
Translations for New Chat
MaciejSWM Jul 28, 2023
6ae6b66
Multiple option selector as button
MaciejSWM Jul 28, 2023
81c515d
Button toggle component for New Chat modal
MaciejSWM Jul 28, 2023
b0936bf
Styling of button
MaciejSWM Jul 28, 2023
00a1f06
Simplify FAB
MaciejSWM Jul 28, 2023
1ab0037
Add Button Toggle
MaciejSWM Jul 28, 2023
c98f9d0
Change keyboard shortcut key
MaciejSWM Jul 28, 2023
370403a
Merge branch 'andrew-scan' into simplify-global-create-menu-material-…
MaciejSWM Jul 31, 2023
63e8c3b
WIP navigation
MaciejSWM Jul 31, 2023
b03db84
Switch case for all route types
MaciejSWM Jul 31, 2023
78a21be
WIP Material Top Tab navigation
MaciejSWM Jul 31, 2023
d959c6a
Hide Tab Navigator behind beta flag
MaciejSWM Aug 1, 2023
005ff32
Merge remote-tracking branch 'upstream/andrew-scan' into simplify-glo…
MaciejSWM Aug 1, 2023
fead367
Delete split bill option
MaciejSWM Aug 1, 2023
78faa12
Merge branch 'andrew-scan' into simplify-global-create-menu-material-…
MaciejSWM Aug 1, 2023
0c0d703
Merge fix - adjust Tab names
MaciejSWM Aug 1, 2023
cde4008
WIP Translations
MaciejSWM Aug 2, 2023
29a27b5
Fix logic for showing selectedState
MaciejSWM Aug 2, 2023
a02791d
Split works
MaciejSWM Aug 2, 2023
f6191db
WIP Money request
MaciejSWM Aug 2, 2023
19526e3
Merge branch 'main' into simplify-global-create-menu-material-top-tab
MaciejSWM Aug 2, 2023
528f203
Drop code responsible for obserwing cross-tab changes
MaciejSWM Aug 2, 2023
8aabbfc
Accessibility label
MaciejSWM Aug 2, 2023
e32e019
Ignore .gitconfig
MaciejSWM Aug 2, 2023
575b980
Ignore .gitconfig
MaciejSWM Aug 2, 2023
3b06bab
Drop Request page
MaciejSWM Aug 2, 2023
c1fb994
Drop splitBill option
MaciejSWM Aug 2, 2023
8256934
Drop SPLIT_BILL references
MaciejSWM Aug 2, 2023
a80a2d6
Drop references to old Request page
MaciejSWM Aug 2, 2023
cdce229
Rename SplitSelector -> Selector
MaciejSWM Aug 2, 2023
8239560
Tab header names
MaciejSWM Aug 2, 2023
60c31ce
Merge branch 'main' of https://github.com/Expensify/App
MaciejSWM Aug 9, 2023
4cdac43
Merge branch 'main' into simplify-global-create-menu-material-top-tab
MaciejSWM Aug 9, 2023
e2ca9f7
Drop excessive nesting
MaciejSWM Aug 9, 2023
305190e
Drop padding top on native
MaciejSWM Aug 9, 2023
cfd204c
Hide whole tab navigation behind feature flag
MaciejSWM Aug 9, 2023
e9f7dc3
Use OnyxTabNavigator
MaciejSWM Aug 9, 2023
836a3d0
Back button should dismiss modal
MaciejSWM Aug 9, 2023
edefa80
Adjust navigation for default chat tab
MaciejSWM Aug 9, 2023
551b404
Just throw an error when no icon is matched
MaciejSWM Aug 10, 2023
6cfc0f2
Drop deprecated props
MaciejSWM Aug 10, 2023
ba82618
Merge branch 'main' of https://github.com/Expensify/App
MaciejSWM Aug 10, 2023
41a5902
Merge branch 'main' into simplify-global-create-menu-material-top-tab
MaciejSWM Aug 10, 2023
201508b
Rename variable
MaciejSWM Aug 10, 2023
77ea4fc
Drop unused styles
MaciejSWM Aug 10, 2023
5141a5f
Fix typo in spanish translation; drop unused translations
MaciejSWM Aug 11, 2023
65b87b0
Root path should be NEW, not NEW_CHAT
MaciejSWM Aug 11, 2023
2476bc6
Different route based on beta features available
MaciejSWM Aug 11, 2023
b7de94d
Set Money Request header dynamically
MaciejSWM Aug 11, 2023
9242a0d
Merge branch 'main' of https://github.com/Expensify/App
MaciejSWM Aug 17, 2023
757249c
Merge branch 'main' into simplify-global-create-menu-material-top-tab
MaciejSWM Aug 17, 2023
f19162d
Missing translation
MaciejSWM Aug 17, 2023
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ storybook-static

# GitHub GPG Keys
.github/workflows/OSBotify-private-key.asc
.gitconfig
*.asc

# Jest coverage report
Expand Down
7 changes: 5 additions & 2 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ const CONST = {
},
type: KEYBOARD_SHORTCUT_NAVIGATION_TYPE,
},
NEW_GROUP: {
descriptionKey: 'newGroup',
NEW_CHAT: {
descriptionKey: 'newChat',
shortcutKey: 'K',
modifiers: ['CTRL', 'SHIFT'],
trigger: {
Expand Down Expand Up @@ -2530,6 +2530,9 @@ const CONST = {
RECEIPT_TAB_ID: 'ReceiptTab',
MANUAL: 'manual',
SCAN: 'scan',
NEW_CHAT_TAB_ID: 'NewChatTab',
NEW_CHAT: 'chat',
NEW_ROOM: 'room',
DISTANCE: 'distance',
},
};
Expand Down
6 changes: 2 additions & 4 deletions src/ROUTES.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import * as Url from './libs/Url';

const REPORT = 'r';
const IOU_REQUEST = 'request/new';
const IOU_BILL = 'split/new';
const IOU_SEND = 'send/new';
const NEW_TASK = 'new/task';
const SETTINGS_PERSONAL_DETAILS = 'settings/profile/personal-details';
Expand Down Expand Up @@ -62,8 +61,9 @@ export default {
SETTINGS_2FA_SUCCESS: 'settings/security/two-factor-auth/success',
SETTINGS_STATUS,
SETTINGS_STATUS_SET,
NEW_GROUP: 'new/group',
NEW: 'new',
NEW_CHAT: 'new/chat',
NEW_ROOM: 'new/room',
NEW_TASK,
REPORT,
REPORT_WITH_ID: 'r/:reportID?',
Expand All @@ -79,7 +79,6 @@ export default {
CONCIERGE: 'concierge',

IOU_REQUEST,
IOU_BILL,
IOU_SEND,

// To see the available iouType, please refer to CONST.IOU.MONEY_REQUEST_TYPE
Expand Down Expand Up @@ -160,7 +159,6 @@ export default {
WORKSPACE_INVOICES: 'workspace/:policyID/invoices',
WORKSPACE_TRAVEL: 'workspace/:policyID/travel',
WORKSPACE_MEMBERS: 'workspace/:policyID/members',
WORKSPACE_NEW_ROOM: 'workspace/new-room',
getWorkspaceInitialRoute: (policyID) => `workspace/${policyID}`,
getWorkspaceInviteRoute: (policyID) => `workspace/${policyID}/invite`,
getWorkspaceInviteMessageRoute: (policyID) => `workspace/${policyID}/invite-message`,
Expand Down
29 changes: 28 additions & 1 deletion src/components/OptionRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {View, StyleSheet, InteractionManager} from 'react-native';
import styles from '../styles/styles';
import * as StyleUtils from '../styles/StyleUtils';
import optionPropTypes from './optionPropTypes';
import Button from './Button';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
import MultipleAvatars from './MultipleAvatars';
Expand Down Expand Up @@ -39,6 +40,15 @@ const propTypes = {
/** Whether we should show the selected state */
showSelectedState: PropTypes.bool,

/** Whether to show a button pill instead of a tickbox */
shouldShowSelectedStateAsButton: PropTypes.bool,

/** Text for button pill */
selectedStateButtonText: PropTypes.string,

/** Callback to fire when the multiple selector (tickbox or button) is clicked */
onSelectedStatePressed: PropTypes.func,

/** Whether this item is selected */
isSelected: PropTypes.bool,

Expand All @@ -65,6 +75,9 @@ const propTypes = {
const defaultProps = {
hoverStyle: styles.sidebarLinkHover,
showSelectedState: false,
shouldShowSelectedStateAsButton: false,
selectedStateButtonText: 'Select',
onSelectedStatePressed: undefined,
isSelected: false,
boldStyle: false,
showTitleTooltip: false,
Expand Down Expand Up @@ -248,7 +261,21 @@ class OptionRow extends Component {
/>
</View>
)}
{this.props.showSelectedState && <SelectCircle isChecked={this.props.isSelected} />}
{this.props.showSelectedState && (
<>
{this.props.shouldShowSelectedStateAsButton && !this.props.isSelected ? (
<Button text={this.props.selectedStateButtonText} onPress={() => this.props.onSelectedStatePressed(this.props.option)} small />
) : (
<PressableWithFeedback
onPress={() => this.props.onSelectedStatePressed(this.props.option)}
accessibilityRole={CONST.ACCESSIBILITY_ROLE.CHECKBOX}
accessibilityLabel={CONST.ACCESSIBILITY_ROLE.CHECKBOX}
>
<SelectCircle isChecked={this.props.isSelected} />
</PressableWithFeedback>
)}
</>
)}
</View>
</View>
{Boolean(this.props.option.customIcon) && (
Expand Down
3 changes: 3 additions & 0 deletions src/components/OptionsList/BaseOptionsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ class BaseOptionsList extends Component {
onSelectRow={this.props.onSelectRow}
isSelected={Boolean(_.find(this.props.selectedOptions, (option) => option.accountID === item.accountID))}
showSelectedState={this.props.canSelectMultipleOptions}
shouldShowSelectedStateAsButton={this.props.shouldShowMultipleOptionSelectorAsButton}
selectedStateButtonText={this.props.multipleOptionSelectorButtonText}
onSelectedStatePressed={this.props.onAddToSelection}
boldStyle={this.props.boldStyle}
isDisabled={isDisabled}
shouldHaveOptionSeparator={index > 0 && this.props.shouldHaveOptionSeparator}
Expand Down
3 changes: 3 additions & 0 deletions src/components/OptionsSelector/BaseOptionsSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,9 @@ class BaseOptionsSelector extends Component {
focusedIndex={this.state.focusedIndex}
selectedOptions={this.props.selectedOptions}
canSelectMultipleOptions={this.props.canSelectMultipleOptions}
shouldShowMultipleOptionSelectorAsButton={this.props.shouldShowMultipleOptionSelectorAsButton}
multipleOptionSelectorButtonText={this.props.multipleOptionSelectorButtonText}
onAddToSelection={this.props.onAddToSelection}
hideSectionHeaders={this.props.hideSectionHeaders}
headerMessage={this.props.headerMessage}
boldStyle={this.props.boldStyle}
Expand Down
9 changes: 9 additions & 0 deletions src/components/OptionsSelector/optionsSelectorPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ const propTypes = {
/** Whether we can select multiple options */
canSelectMultipleOptions: PropTypes.bool,

/** Whether to show a button pill instead of a standard tickbox */
shouldShowMultipleOptionSelectorAsButton: PropTypes.bool,

/** Text for button pill */
multipleOptionSelectorButtonText: PropTypes.string,

/** Callback to fire when the multiple selector (tickbox or button) is clicked */
onAddToSelection: PropTypes.func,

/** Whether any section headers should be visible */
hideSectionHeaders: PropTypes.bool,

Expand Down
10 changes: 8 additions & 2 deletions src/components/TabSelector/TabSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,20 @@ const defaultProps = {

const getIcon = (route) => {
switch (route) {
case CONST.TAB.MANUAL:
return Expensicons.Pencil;
case CONST.TAB.SCAN:
return Expensicons.Receipt;
case CONST.TAB.NEW_CHAT:
return Expensicons.User;
case CONST.TAB.NEW_ROOM:
return Expensicons.Hashtag;
case CONST.TAB.DISTANCE:
return Expensicons.Car;
default:
return Expensicons.Pencil;
throw new Error(`Route ${route} has no icon set.`);
}
};
}

function TabSelector({state, navigation, onTabPress}) {
const {translate} = useLocalize();
Expand Down
2 changes: 1 addition & 1 deletion src/components/WalletStatementModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class WalletStatementModal extends React.Component {
}

if (e.data.type === 'STATEMENT_NAVIGATE' && e.data.url) {
const iouRoutes = [ROUTES.IOU_REQUEST, ROUTES.IOU_SEND, ROUTES.IOU_BILL];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

IOU_BILL route was deleted so no need to include it here

const iouRoutes = [ROUTES.IOU_REQUEST, ROUTES.IOU_SEND];
const navigateToIOURoute = _.find(iouRoutes, (iouRoute) => e.data.url.includes(iouRoute));
if (navigateToIOURoute) {
Navigation.navigate(navigateToIOURoute);
Expand Down
2 changes: 1 addition & 1 deletion src/components/WalletStatementModal/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class WalletStatementModal extends React.Component {
}

if (type === 'STATEMENT_NAVIGATE' && url) {
const iouRoutes = [ROUTES.IOU_REQUEST, ROUTES.IOU_SEND, ROUTES.IOU_BILL];
const iouRoutes = [ROUTES.IOU_REQUEST, ROUTES.IOU_SEND];
const navigateToIOURoute = _.find(iouRoutes, (iouRoute) => url.includes(iouRoute));
if (navigateToIOURoute) {
this.webview.stopLoading();
Expand Down
13 changes: 10 additions & 3 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,15 @@ export default {
},
},
sidebarScreen: {
fabAction: 'New chat',
chat: 'Chat',
room: 'Room',
newChat: 'New chat',
newGroup: 'New group',
newRoom: 'New room',
fabNewChat: 'Send message',
fabNewChatExplained: 'Send message (Floating action)',
buttonSearch: 'Search',
buttonMySettings: 'My settings',
fabNewChat: 'New chat (Floating action)',
chatPinned: 'Chat pinned',
draftedMessage: 'Drafted message',
listOfChatMessages: 'List of chat messages',
Expand All @@ -349,6 +351,8 @@ export default {
tabSelector: {
manual: 'Manual',
scan: 'Scan',
chat: 'Chat',
room: 'Room',
distance: 'Distance',
},
receipt: {
Expand Down Expand Up @@ -389,6 +393,7 @@ export default {
payElsewhere: 'Pay elsewhere',
settlePaypalMe: ({formattedAmount}) => `Pay ${formattedAmount} with PayPal.me`,
requestAmount: ({amount}) => `request ${amount}`,
addToSplit: 'Add to split',
splitAmount: ({amount}) => `split ${amount}`,
amountEach: ({amount}) => `${amount} each`,
payerOwesAmount: ({payer, amount}) => `${payer} owes ${amount}`,
Expand Down Expand Up @@ -842,6 +847,8 @@ export default {
localTime: 'Local time',
},
newChatPage: {
addToGroup: 'Add to group',
createChat: 'Create chat',
createGroup: 'Create group',
},
yearPickerPage: {
Expand Down Expand Up @@ -1388,7 +1395,7 @@ export default {
openShortcutDialog: 'Opens the keyboard shortcuts dialog',
escape: 'Escape dialogs',
search: 'Open search dialog',
newGroup: 'New group screen',
newChat: 'New chat screen',
copy: 'Copy comment',
},
},
Expand Down
16 changes: 12 additions & 4 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,13 +333,16 @@ export default {
},
},
sidebarScreen: {
fabAction: 'Nuevo chat',
newChat: 'Nuevo chat',
chat: 'Chat',
room: 'Sala',
fabAction: 'Enviar mensaje',
newChat: 'Enviar mensaje',
newGroup: 'Nuevo grupo',
newRoom: 'Nueva sala de chat',
fabNewChat: 'Enviar mensaje',
fabNewChatExplained: 'Enviar mensaje',
buttonSearch: 'Buscar',
buttonMySettings: 'Mi configuración',
fabNewChat: 'Nuevo chat',
chatPinned: 'Chat fijado',
draftedMessage: 'Mensaje borrador',
listOfChatMessages: 'Lista de mensajes del chat',
Expand All @@ -348,6 +351,8 @@ export default {
tabSelector: {
manual: 'Manual',
scan: 'Escanear',
chat: 'Chat',
room: 'Sala',
distance: 'Distancia',
},
receipt: {
Expand Down Expand Up @@ -388,6 +393,7 @@ export default {
payElsewhere: 'Pagar de otra forma',
settlePaypalMe: ({formattedAmount}) => `Pagar ${formattedAmount} con PayPal.me`,
requestAmount: ({amount}) => `solicitar ${amount}`,
addToSplit: 'TODO: TRANSLATION NEEDED',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Translation needed

splitAmount: ({amount}) => `dividir ${amount}`,
amountEach: ({amount}) => `${amount} cada uno`,
payerOwesAmount: ({payer, amount}) => `${payer} debe ${amount}`,
Expand Down Expand Up @@ -846,6 +852,8 @@ export default {
localTime: 'Hora local',
},
newChatPage: {
addToGroup: 'Añadir al grupo',
createChat: 'Creat chat',
createGroup: 'Crear grupo',
},
yearPickerPage: {
Expand Down Expand Up @@ -1400,7 +1408,7 @@ export default {
openShortcutDialog: 'Abre el cuadro de diálogo de métodos abreviados de teclado',
escape: 'Diálogos de escape',
search: 'Abrir diálogo de búsqueda',
newGroup: 'Nueva pantalla de grupo',
newGroup: 'Nueva pantalla de chat',
copy: 'Copiar comentario',
},
},
Expand Down
12 changes: 6 additions & 6 deletions src/libs/Navigation/AppNavigator/AuthScreens.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class AuthScreens extends React.Component {
Timing.end(CONST.TIMING.HOMEPAGE_INITIAL_RENDER);

const searchShortcutConfig = CONST.KEYBOARD_SHORTCUTS.SEARCH;
const groupShortcutConfig = CONST.KEYBOARD_SHORTCUTS.NEW_GROUP;
const chatShortcutConfig = CONST.KEYBOARD_SHORTCUTS.NEW_CHAT;

// Listen for the key K being pressed so that focus can be given to
// the chat switcher, or new group chat
Expand All @@ -173,17 +173,17 @@ class AuthScreens extends React.Component {
true,
);
this.unsubscribeGroupShortcut = KeyboardShortcut.subscribe(
groupShortcutConfig.shortcutKey,
chatShortcutConfig.shortcutKey,
() => {
Modal.close(() => {
if (Navigation.isActiveRoute(ROUTES.NEW_GROUP)) {
if (Navigation.isActiveRoute(ROUTES.NEW_CHAT)) {
return;
}
Navigation.navigate(ROUTES.NEW_GROUP);
Navigation.navigate(ROUTES.NEW_CHAT);
});
},
groupShortcutConfig.descriptionKey,
groupShortcutConfig.modifiers,
chatShortcutConfig.descriptionKey,
chatShortcutConfig.modifiers,
true,
);
}
Expand Down
22 changes: 2 additions & 20 deletions src/libs/Navigation/AppNavigator/ModalStackNavigators.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,21 +231,11 @@ const SearchModalStackNavigator = createModalStackNavigator([
},
]);

const NewGroupModalStackNavigator = createModalStackNavigator([
{
getComponent: () => {
const NewGroupPage = require('../../../pages/NewGroupPage').default;
return NewGroupPage;
},
name: 'NewGroup_Root',
},
]);

const NewChatModalStackNavigator = createModalStackNavigator([
{
getComponent: () => {
const NewChatPage = require('../../../pages/NewChatPage').default;
return NewChatPage;
const NewChatSelectorPage = require('../../../pages/NewChatSelectorPage').default;
return NewChatSelectorPage;
},
name: 'NewChat_Root',
},
Expand Down Expand Up @@ -606,13 +596,6 @@ const SettingsModalStackNavigator = createModalStackNavigator([
},
name: 'Workspace_Invite_Message',
},
{
getComponent: () => {
const WorkspaceNewRoomPage = require('../../../pages/workspace/WorkspaceNewRoomPage').default;
return WorkspaceNewRoomPage;
},
name: 'Workspace_NewRoom',
},
{
getComponent: () => {
const ReimbursementAccountPage = require('../../../pages/ReimbursementAccount/ReimbursementAccountPage').default;
Expand Down Expand Up @@ -736,7 +719,6 @@ export {
ReportWelcomeMessageModalStackNavigator,
ReportParticipantsModalStackNavigator,
SearchModalStackNavigator,
NewGroupModalStackNavigator,
NewChatModalStackNavigator,
NewTaskModalStackNavigator,
SettingsModalStackNavigator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ function RightModalNavigator() {
name="NewChat"
component={ModalStackNavigators.NewChatModalStackNavigator}
/>
<Stack.Screen
name="NewGroup"
component={ModalStackNavigators.NewGroupModalStackNavigator}
options={{
// Disable animation for this screen because it causes an animation glitch when using shortcuts
animationEnabled: false,
}}
/>
<Stack.Screen
name="Search"
component={ModalStackNavigators.SearchModalStackNavigator}
Expand Down
Loading