-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Move all header buttons to overflow menu #27748
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
b1e7f33
move call buttons and pin button to overflow menu
srikarparsi 239d847
add and leave thread buttons
srikarparsi 0f942c5
join and leave functionality for threads
srikarparsi d38dd07
icon fill and new zoom/google meet icons
srikarparsi f50eb7c
wrong color for unpin icon
srikarparsi 5efd054
refactor to use same method for notification preference
srikarparsi 4b4fb23
revert accidental letter change
srikarparsi f997180
Merge branch 'main' into srikar-moveAllHeaderItemsToOverflow
srikarparsi a3dffb3
add chat bubbles
srikarparsi 0f5d502
set default notification preference of new child report to hidden
srikarparsi e67845c
hide join/leave when thread has no comments
srikarparsi 9142121
remove uneeded if check
srikarparsi f494967
change text
srikarparsi f74f0c8
Merge branch 'main' into srikar-moveAllHeaderItemsToOverflow
srikarparsi 51a4a32
fix merge conflicts
srikarparsi 289411f
Merge branch 'main' into srikar-moveAllHeaderItemsToOverflow
srikarparsi 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 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 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 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 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 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 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 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 |
---|---|---|
@@ -1,35 +1,38 @@ | ||
import _ from 'underscore'; | ||
import lodashGet from 'lodash/get'; | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import PropTypes from 'prop-types'; | ||
import lodashGet from 'lodash/get'; | ||
import {withOnyx} from 'react-native-onyx'; | ||
import styles from '../../styles/styles'; | ||
import _ from 'underscore'; | ||
import GoogleMeetIcon from '../../../assets/images/google-meet.svg'; | ||
import ZoomIcon from '../../../assets/images/zoom-icon.svg'; | ||
import CONST from '../../CONST'; | ||
import ONYXKEYS from '../../ONYXKEYS'; | ||
import DisplayNames from '../../components/DisplayNames'; | ||
import Icon from '../../components/Icon'; | ||
import * as Expensicons from '../../components/Icon/Expensicons'; | ||
import compose from '../../libs/compose'; | ||
import withWindowDimensions, {windowDimensionsPropTypes} from '../../components/withWindowDimensions'; | ||
import MultipleAvatars from '../../components/MultipleAvatars'; | ||
import ParentNavigationSubtitle from '../../components/ParentNavigationSubtitle'; | ||
import PressableWithoutFeedback from '../../components/Pressable/PressableWithoutFeedback'; | ||
import SubscriptAvatar from '../../components/SubscriptAvatar'; | ||
import DisplayNames from '../../components/DisplayNames'; | ||
import * as OptionsListUtils from '../../libs/OptionsListUtils'; | ||
import TaskHeaderActionButton from '../../components/TaskHeaderActionButton'; | ||
import Text from '../../components/Text'; | ||
import ThreeDotsMenu from '../../components/ThreeDotsMenu'; | ||
import Tooltip from '../../components/Tooltip'; | ||
import participantPropTypes from '../../components/participantPropTypes'; | ||
import VideoChatButtonAndMenu from '../../components/VideoChatButtonAndMenu'; | ||
import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; | ||
import CONST from '../../CONST'; | ||
import withWindowDimensions, {windowDimensionsPropTypes} from '../../components/withWindowDimensions'; | ||
import * as OptionsListUtils from '../../libs/OptionsListUtils'; | ||
import * as ReportActionsUtils from '../../libs/ReportActionsUtils'; | ||
import * as ReportUtils from '../../libs/ReportUtils'; | ||
import Text from '../../components/Text'; | ||
import Tooltip from '../../components/Tooltip'; | ||
import * as Link from '../../libs/actions/Link'; | ||
import * as Report from '../../libs/actions/Report'; | ||
import * as Session from '../../libs/actions/Session'; | ||
import * as Task from '../../libs/actions/Task'; | ||
import compose from '../../libs/compose'; | ||
import styles from '../../styles/styles'; | ||
import themeColors from '../../styles/themes/default'; | ||
import reportPropTypes from '../reportPropTypes'; | ||
import ONYXKEYS from '../../ONYXKEYS'; | ||
import ThreeDotsMenu from '../../components/ThreeDotsMenu'; | ||
import * as Task from '../../libs/actions/Task'; | ||
import PressableWithoutFeedback from '../../components/Pressable/PressableWithoutFeedback'; | ||
import PinButton from '../../components/PinButton'; | ||
import TaskHeaderActionButton from '../../components/TaskHeaderActionButton'; | ||
import * as ReportActionsUtils from '../../libs/ReportActionsUtils'; | ||
import ParentNavigationSubtitle from '../../components/ParentNavigationSubtitle'; | ||
|
||
const propTypes = { | ||
/** Toggles the navigationMenu open and closed */ | ||
|
@@ -83,16 +86,18 @@ function HeaderView(props) { | |
const isAutomatedExpensifyAccount = ReportUtils.hasSingleParticipant(props.report) && ReportUtils.hasAutomatedExpensifyAccountIDs(participants); | ||
const parentReportAction = ReportActionsUtils.getParentReportAction(props.report); | ||
const isCanceledTaskReport = ReportUtils.isCanceledTaskReport(props.report, parentReportAction); | ||
const lastVisibleMessage = ReportActionsUtils.getLastVisibleMessage(props.report.reportID); | ||
const isEmptyChat = !props.report.lastMessageText && !props.report.lastMessageTranslationKey && !lastVisibleMessage.lastMessageText && !lastVisibleMessage.lastMessageTranslationKey; | ||
|
||
// We hide the button when we are chatting with an automated Expensify account since it's not possible to contact | ||
// these users via alternative means. It is possible to request a call with Concierge so we leave the option for them. | ||
const shouldShowCallButton = (isConcierge && props.guideCalendarLink) || (!isAutomatedExpensifyAccount && !isTaskReport); | ||
const threeDotMenuItems = []; | ||
if (isTaskReport && !isCanceledTaskReport) { | ||
const canModifyTask = Task.canModifyTask(props.report, props.session.accountID); | ||
if (ReportUtils.isOpenTaskReport(props.report) && canModifyTask) { | ||
threeDotMenuItems.push({ | ||
icon: Expensicons.Checkmark, | ||
iconFill: themeColors.icon, | ||
text: props.translate('task.markAsComplete'), | ||
onSelected: () => Task.completeTask(props.report), | ||
}); | ||
|
@@ -102,6 +107,7 @@ function HeaderView(props) { | |
if (ReportUtils.isCompletedTaskReport(props.report) && canModifyTask) { | ||
threeDotMenuItems.push({ | ||
icon: Expensicons.Checkmark, | ||
iconFill: themeColors.icon, | ||
text: props.translate('task.markAsIncomplete'), | ||
onSelected: () => Task.reopenTask(props.report), | ||
}); | ||
|
@@ -111,11 +117,75 @@ function HeaderView(props) { | |
if (props.report.stateNum !== CONST.REPORT.STATE_NUM.SUBMITTED && props.report.statusNum !== CONST.REPORT.STATUS.CLOSED && canModifyTask) { | ||
threeDotMenuItems.push({ | ||
icon: Expensicons.Trashcan, | ||
iconFill: themeColors.icon, | ||
text: props.translate('common.cancel'), | ||
onSelected: () => Task.cancelTask(props.report.reportID, props.report.reportName, props.report.stateNum, props.report.statusNum), | ||
}); | ||
} | ||
} | ||
|
||
if (isChatThread && !isEmptyChat) { | ||
if (props.report.notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN) { | ||
threeDotMenuItems.push({ | ||
icon: Expensicons.ChatBubbles, | ||
iconFill: themeColors.icon, | ||
text: props.translate('common.joinThread'), | ||
onSelected: () => Report.updateNotificationPreference(props.report.reportID, props.report.notificationPreference, CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, false), | ||
}); | ||
} else if (props.report.notificationPreference.length) { | ||
threeDotMenuItems.push({ | ||
icon: Expensicons.ChatBubbles, | ||
iconFill: themeColors.icon, | ||
text: props.translate('common.leaveThread'), | ||
onSelected: () => Report.leaveRoom(props.report.reportID), | ||
}); | ||
} | ||
} | ||
|
||
if (!props.report.isPinned) { | ||
threeDotMenuItems.push({ | ||
icon: Expensicons.Pin, | ||
iconFill: themeColors.icon, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👋 Coming from #28535 |
||
text: props.translate('common.pin'), | ||
onSelected: Session.checkIfActionIsAllowed(() => Report.togglePinnedState(props.report.reportID, props.report.isPinned)), | ||
}); | ||
} else { | ||
threeDotMenuItems.push({ | ||
icon: Expensicons.Pin, | ||
iconFill: themeColors.icon, | ||
text: props.translate('common.unPin'), | ||
onSelected: Session.checkIfActionIsAllowed(() => Report.togglePinnedState(props.report.reportID, props.report.isPinned)), | ||
}); | ||
} | ||
|
||
if (isConcierge && props.guideCalendarLink) { | ||
threeDotMenuItems.push({ | ||
icon: Expensicons.Phone, | ||
iconFill: themeColors.icon, | ||
text: props.translate('videoChatButtonAndMenu.tooltip'), | ||
onSelected: () => { | ||
Link.openExternalLink(props.guideCalendarLink); | ||
}, | ||
}); | ||
} else if (!isAutomatedExpensifyAccount && !isTaskReport) { | ||
threeDotMenuItems.push({ | ||
icon: ZoomIcon, | ||
iconFill: themeColors.icon, | ||
text: props.translate('videoChatButtonAndMenu.zoom'), | ||
onSelected: () => { | ||
Link.openExternalLink(CONST.NEW_ZOOM_MEETING_URL); | ||
}, | ||
}); | ||
threeDotMenuItems.push({ | ||
icon: GoogleMeetIcon, | ||
iconFill: themeColors.icon, | ||
text: props.translate('videoChatButtonAndMenu.googleMeet'), | ||
onSelected: () => { | ||
Link.openExternalLink(CONST.NEW_GOOGLE_MEET_MEETING_URL); | ||
}, | ||
}); | ||
} | ||
|
||
const shouldShowThreeDotsButton = !!threeDotMenuItems.length; | ||
|
||
const shouldShowSubscript = ReportUtils.shouldReportShowSubscript(props.report); | ||
|
@@ -206,13 +276,6 @@ function HeaderView(props) { | |
</PressableWithoutFeedback> | ||
<View style={[styles.reportOptions, styles.flexRow, styles.alignItemsCenter]}> | ||
{isTaskReport && !props.isSmallScreenWidth && ReportUtils.isOpenTaskReport(props.report) && <TaskHeaderActionButton report={props.report} />} | ||
{shouldShowCallButton && ( | ||
<VideoChatButtonAndMenu | ||
isConcierge={isConcierge} | ||
guideCalendarLink={props.guideCalendarLink} | ||
/> | ||
)} | ||
<PinButton report={props.report} /> | ||
{shouldShowThreeDotsButton && ( | ||
<ThreeDotsMenu | ||
anchorPosition={styles.threeDotsPopoverOffset(props.windowWidth)} | ||
|
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This created an issue #29851