-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
fix: Standardize the hover menu options to always include the same options #39894
Merged
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1d40295
fix: Standardize the hover menu options to always include the same op…
nkdengineer d6735f2
fix move mark as read
nkdengineer 8702354
fix move download option down
nkdengineer 8c9eb6e
fix merge main
nkdengineer 32c87ec
fix move delete option to bottom
nkdengineer c1c6c94
resolve conflict
nkdengineer af867f2
fix merge main
nkdengineer d7b0e1c
fix merge main
nkdengineer 2d88758
fix remove duplicate download option
nkdengineer 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
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 |
---|---|---|
|
@@ -216,6 +216,37 @@ const ContextMenuActions: ContextMenuAction[] = [ | |
}, | ||
getDescription: () => {}, | ||
}, | ||
{ | ||
isAnonymousAction: false, | ||
textTranslateKey: 'reportActionContextMenu.markAsUnread', | ||
icon: Expensicons.ChatBubbleUnread, | ||
successIcon: Expensicons.Checkmark, | ||
shouldShow: (type, reportAction, isArchivedRoom, betas, menuTarget, isChronosReport, reportID, isPinnedChat, isUnreadChat) => | ||
type === CONST.CONTEXT_MENU_TYPES.REPORT_ACTION || (type === CONST.CONTEXT_MENU_TYPES.REPORT && !isUnreadChat), | ||
onPress: (closePopover, {reportAction, reportID}) => { | ||
const originalReportID = ReportUtils.getOriginalReportID(reportID, reportAction) ?? ''; | ||
Report.markCommentAsUnread(originalReportID, reportAction?.created); | ||
if (closePopover) { | ||
hideContextMenu(true, ReportActionComposeFocusManager.focus); | ||
} | ||
}, | ||
getDescription: () => {}, | ||
}, | ||
{ | ||
isAnonymousAction: false, | ||
textTranslateKey: 'reportActionContextMenu.markAsRead', | ||
icon: Expensicons.Mail, | ||
successIcon: Expensicons.Checkmark, | ||
shouldShow: (type, reportAction, isArchivedRoom, betas, menuTarget, isChronosReport, reportID, isPinnedChat, isUnreadChat) => | ||
type === CONST.CONTEXT_MENU_TYPES.REPORT && isUnreadChat, | ||
onPress: (closePopover, {reportID}) => { | ||
Report.readNewestAction(reportID); | ||
if (closePopover) { | ||
hideContextMenu(true, ReportActionComposeFocusManager.focus); | ||
} | ||
}, | ||
getDescription: () => {}, | ||
}, | ||
{ | ||
isAnonymousAction: false, | ||
textTranslateKey: 'reportActionContextMenu.editAction', | ||
|
@@ -250,37 +281,6 @@ const ContextMenuActions: ContextMenuAction[] = [ | |
}, | ||
getDescription: () => {}, | ||
}, | ||
{ | ||
isAnonymousAction: false, | ||
textTranslateKey: 'reportActionContextMenu.markAsUnread', | ||
icon: Expensicons.ChatBubbleUnread, | ||
successIcon: Expensicons.Checkmark, | ||
shouldShow: (type, reportAction, isArchivedRoom, betas, menuTarget, isChronosReport, reportID, isPinnedChat, isUnreadChat) => | ||
type === CONST.CONTEXT_MENU_TYPES.REPORT_ACTION || (type === CONST.CONTEXT_MENU_TYPES.REPORT && !isUnreadChat), | ||
onPress: (closePopover, {reportAction, reportID}) => { | ||
const originalReportID = ReportUtils.getOriginalReportID(reportID, reportAction) ?? ''; | ||
Report.markCommentAsUnread(originalReportID, reportAction?.created); | ||
if (closePopover) { | ||
hideContextMenu(true, ReportActionComposeFocusManager.focus); | ||
} | ||
}, | ||
getDescription: () => {}, | ||
}, | ||
{ | ||
isAnonymousAction: false, | ||
textTranslateKey: 'reportActionContextMenu.markAsRead', | ||
icon: Expensicons.Mail, | ||
successIcon: Expensicons.Checkmark, | ||
shouldShow: (type, reportAction, isArchivedRoom, betas, menuTarget, isChronosReport, reportID, isPinnedChat, isUnreadChat) => | ||
type === CONST.CONTEXT_MENU_TYPES.REPORT && isUnreadChat, | ||
onPress: (closePopover, {reportID}) => { | ||
Report.readNewestAction(reportID); | ||
if (closePopover) { | ||
hideContextMenu(true, ReportActionComposeFocusManager.focus); | ||
} | ||
}, | ||
getDescription: () => {}, | ||
}, | ||
{ | ||
isAnonymousAction: false, | ||
textTranslateKey: 'reportActionContextMenu.joinThread', | ||
|
@@ -430,29 +430,6 @@ const ContextMenuActions: ContextMenuAction[] = [ | |
}, | ||
getDescription: () => {}, | ||
}, | ||
{ | ||
isAnonymousAction: false, | ||
textTranslateKey: 'reportActionContextMenu.deleteAction', | ||
icon: Expensicons.Trashcan, | ||
shouldShow: (type, reportAction, isArchivedRoom, betas, menuTarget, isChronosReport, reportID) => | ||
// Until deleting parent threads is supported in FE, we will prevent the user from deleting a thread parent | ||
type === CONST.CONTEXT_MENU_TYPES.REPORT_ACTION && | ||
ReportUtils.canDeleteReportAction(reportAction, reportID) && | ||
!isArchivedRoom && | ||
!isChronosReport && | ||
!ReportActionsUtils.isMessageDeleted(reportAction), | ||
onPress: (closePopover, {reportID, reportAction}) => { | ||
if (closePopover) { | ||
// Hide popover, then call showDeleteConfirmModal | ||
hideContextMenu(false, () => showDeleteModal(reportID, reportAction)); | ||
return; | ||
} | ||
|
||
// No popover to hide, call showDeleteConfirmModal immediately | ||
showDeleteModal(reportID, reportAction); | ||
}, | ||
getDescription: () => {}, | ||
}, | ||
{ | ||
isAnonymousAction: false, | ||
textTranslateKey: 'common.pin', | ||
|
@@ -499,6 +476,55 @@ const ContextMenuActions: ContextMenuAction[] = [ | |
}, | ||
getDescription: () => {}, | ||
}, | ||
{ | ||
isAnonymousAction: true, | ||
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. @nkdengineer You forgot to remove this option from above. Now it got duplicated. |
||
textTranslateKey: 'common.download', | ||
icon: Expensicons.Download, | ||
successTextTranslateKey: 'common.download', | ||
successIcon: Expensicons.Download, | ||
shouldShow: (type, reportAction, isArchivedRoom, betas, menuTarget, isChronosReport, reportID, isPinnedChat, isUnreadChat, isOffline): reportAction is ReportAction => { | ||
const isAttachment = ReportActionsUtils.isReportActionAttachment(reportAction); | ||
const messageHtml = reportAction?.message?.at(0)?.html; | ||
return ( | ||
isAttachment && messageHtml !== CONST.ATTACHMENT_UPLOADING_MESSAGE_HTML && !!reportAction?.reportActionID && !ReportActionsUtils.isMessageDeleted(reportAction) && !isOffline | ||
); | ||
}, | ||
onPress: (closePopover, {reportAction}) => { | ||
const html = getActionHtml(reportAction); | ||
const {originalFileName, sourceURL} = getAttachmentDetails(html); | ||
const sourceURLWithAuth = addEncryptedAuthTokenToURL(sourceURL ?? ''); | ||
const sourceID = (sourceURL?.match(CONST.REGEX.ATTACHMENT_ID) ?? [])[1]; | ||
Download.setDownload(sourceID, true); | ||
fileDownload(sourceURLWithAuth, originalFileName ?? '').then(() => Download.setDownload(sourceID, false)); | ||
if (closePopover) { | ||
hideContextMenu(true, ReportActionComposeFocusManager.focus); | ||
} | ||
}, | ||
getDescription: () => {}, | ||
}, | ||
{ | ||
isAnonymousAction: false, | ||
textTranslateKey: 'reportActionContextMenu.deleteAction', | ||
icon: Expensicons.Trashcan, | ||
shouldShow: (type, reportAction, isArchivedRoom, betas, menuTarget, isChronosReport, reportID) => | ||
// Until deleting parent threads is supported in FE, we will prevent the user from deleting a thread parent | ||
type === CONST.CONTEXT_MENU_TYPES.REPORT_ACTION && | ||
ReportUtils.canDeleteReportAction(reportAction, reportID) && | ||
!isArchivedRoom && | ||
!isChronosReport && | ||
!ReportActionsUtils.isMessageDeleted(reportAction), | ||
onPress: (closePopover, {reportID, reportAction}) => { | ||
if (closePopover) { | ||
// Hide popover, then call showDeleteConfirmModal | ||
hideContextMenu(false, () => showDeleteModal(reportID, reportAction)); | ||
return; | ||
} | ||
|
||
// No popover to hide, call showDeleteConfirmModal immediately | ||
showDeleteModal(reportID, reportAction); | ||
}, | ||
getDescription: () => {}, | ||
}, | ||
{ | ||
isAnonymousAction: true, | ||
textTranslateKey: 'reportActionContextMenu.menu', | ||
|
Oops, something went wrong.
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.
Please move this up too.
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.
Sorry, what do you mean?
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.
Move
mark as read
up before edit action.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.
I updated