Skip to content
92 changes: 92 additions & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7528,6 +7528,98 @@ const CONST = {
WORKSPACES: 'NavigationTabBar-Workspaces',
ACCOUNT: 'NavigationTabBar-Account',
},
HEADER_VIEW: {
BACK_BUTTON: 'HeaderView-BackButton',
DETAILS_BUTTON: 'HeaderView-DetailsButton',
TASK_ACTION_BUTTON: 'HeaderView-TaskActionButton',
},
SEARCH: {
SEARCH_BUTTON: 'Search-SearchButton',
},
REPORT: {
FLOATING_MESSAGE_COUNTER: 'Report-FloatingMessageCounter',
LIST_BOUNDARY_LOADER_RETRY: 'Report-ListBoundaryLoaderRetry',
SEND_BUTTON: 'Report-SendButton',
ATTACHMENT_PICKER_CREATE_BUTTON: 'Report-AttachmentPickerCreateButton',
ATTACHMENT_PICKER_EXPAND_BUTTON: 'Report-AttachmentPickerExpandButton',
ATTACHMENT_PICKER_COLLAPSE_BUTTON: 'Report-AttachmentPickerCollapseButton',
ATTACHMENT_PICKER_MENU_CREATE_EXPENSE: 'Report-AttachmentPickerMenuCreateExpense',
ATTACHMENT_PICKER_MENU_TRACK_DISTANCE: 'Report-AttachmentPickerMenuTrackDistance',
ATTACHMENT_PICKER_MENU_SPLIT_EXPENSE: 'Report-AttachmentPickerMenuSplitExpense',
ATTACHMENT_PICKER_MENU_PAY_SOMEONE: 'Report-AttachmentPickerMenuPaySomeone',
ATTACHMENT_PICKER_MENU_SEND_INVOICE: 'Report-AttachmentPickerMenuSendInvoice',
ATTACHMENT_PICKER_MENU_CREATE_REPORT: 'Report-AttachmentPickerMenuCreateReport',
ATTACHMENT_PICKER_MENU_ASSIGN_TASK: 'Report-AttachmentPickerMenuAssignTask',
ATTACHMENT_PICKER_MENU_ADD_ATTACHMENT: 'Report-AttachmentPickerMenuAddAttachment',
EMOJI_PICKER_BUTTON: 'Report-EmojiPickerButton',
REPORT_ACTION_ITEM_CREATED: 'Report-ReportActionItemCreated',
REPORT_ACTION_ITEM_MESSAGE_ENTER_SIGNER_INFO: 'Report-ReportActionItemMessageEnterSignerInfo',
REPORT_ACTION_ITEM_MESSAGE_ADD_BANK_ACCOUNT: 'Report-ReportActionItemMessageAddBankAccount',
REPORT_ACTION_ITEM_MESSAGE_EDIT_CANCEL_BUTTON: 'Report-ReportActionItemMessageEditCancelButton',
REPORT_ACTION_ITEM_MESSAGE_EDIT_SAVE_BUTTON: 'Report-ReportActionItemMessageEditSaveButton',
REPORT_ACTION_ITEM_SINGLE_AVATAR_BUTTON: 'Report-ReportActionItemSingleAvatarButton',
REPORT_ACTION_ITEM_SINGLE_ACTOR_BUTTON: 'Report-ReportActionItemSingleActorButton',
REPORT_ACTION_ITEM_THREAD: 'Report-ReportActionItemThread',
THREAD_DIVIDER: 'Report-ThreadDivider',
PURE_REPORT_ACTION_ITEM: 'Report-PureReportActionItem',
MODERATION_BUTTON: 'Report-ModerationButton',
},
SIDEBAR: {
SIGN_IN_BUTTON: 'Sidebar-SignInButton',
},
LHN: {
OPTION_ROW: 'LHN-OptionRow',
},
CONTEXT_MENU: {
REPLY_IN_THREAD: 'ContextMenu-ReplyInThread',
MARK_AS_UNREAD: 'ContextMenu-MarkAsUnread',
MARK_AS_READ: 'ContextMenu-MarkAsRead',
EDIT_COMMENT: 'ContextMenu-EditComment',
UNHOLD: 'ContextMenu-Unhold',
HOLD: 'ContextMenu-Hold',
JOIN_THREAD: 'ContextMenu-JoinThread',
LEAVE_THREAD: 'ContextMenu-LeaveThread',
COPY_URL: 'ContextMenu-CopyUrl',
COPY_TO_CLIPBOARD: 'ContextMenu-CopyToClipboard',
COPY_EMAIL: 'ContextMenu-CopyEmail',
COPY_MESSAGE: 'ContextMenu-CopyMessage',
COPY_LINK: 'ContextMenu-CopyLink',
PIN: 'ContextMenu-Pin',
UNPIN: 'ContextMenu-Unpin',
FLAG_AS_OFFENSIVE: 'ContextMenu-FlagAsOffensive',
DOWNLOAD: 'ContextMenu-Download',
COPY_ONYX_DATA: 'ContextMenu-CopyOnyxData',
DEBUG: 'ContextMenu-Debug',
DELETE: 'ContextMenu-Delete',
MENU: 'ContextMenu-Menu',
},
MORE_MENU: {
MORE_BUTTON: 'MoreMenu-MoreButton',
VIEW_DETAILS: 'MoreMenu-ViewDetails',
EXPORT: 'MoreMenu-Export',
EXPORT_FILE: 'MoreMenu-ExportFile',
DOWNLOAD_PDF: 'MoreMenu-DownloadPDF',
SUBMIT: 'MoreMenu-Submit',
APPROVE: 'MoreMenu-Approve',
UNAPPROVE: 'MoreMenu-Unapprove',
CANCEL_PAYMENT: 'MoreMenu-CancelPayment',
HOLD: 'MoreMenu-Hold',
REMOVE_HOLD: 'MoreMenu-RemoveHold',
SPLIT: 'MoreMenu-Split',
MERGE: 'MoreMenu-Merge',
CHANGE_WORKSPACE: 'MoreMenu-ChangeWorkspace',
CHANGE_APPROVER: 'MoreMenu-ChangeApprover',
REPORT_LAYOUT: 'MoreMenu-ReportLayout',
DELETE: 'MoreMenu-Delete',
RETRACT: 'MoreMenu-Retract',
REOPEN: 'MoreMenu-Reopen',
REJECT: 'MoreMenu-Reject',
ADD_EXPENSE: 'MoreMenu-AddExpense',
ADD_EXPENSE_CREATE: 'MoreMenu-AddExpenseCreate',
ADD_EXPENSE_TRACK_DISTANCE: 'MoreMenu-AddExpenseTrackDistance',
ADD_EXPENSE_UNREPORTED: 'MoreMenu-AddExpenseUnreported',
PAY: 'MoreMenu-Pay',
},
},
} as const;

Expand Down
16 changes: 15 additions & 1 deletion src/components/BaseMiniContextMenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,26 @@ type BaseMiniContextMenuItemProps = {
* Reference to the outer element
*/
ref?: PressableRef;

/**
* Label for Sentry tracking
*/
sentryLabel?: string;
};

/**
* Component that renders a mini context menu item with a
* pressable. Also renders a tooltip when hovering the item.
*/
function BaseMiniContextMenuItem({tooltipText, onPress, children, isDelayButtonStateComplete = true, shouldPreventDefaultFocusOnPress = true, ref}: BaseMiniContextMenuItemProps) {
function BaseMiniContextMenuItem({
tooltipText,
onPress,
children,
isDelayButtonStateComplete = true,
shouldPreventDefaultFocusOnPress = true,
ref,
sentryLabel,
}: BaseMiniContextMenuItemProps) {
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
return (
Expand Down Expand Up @@ -79,6 +92,7 @@ function BaseMiniContextMenuItem({tooltipText, onPress, children, isDelayButtonS
}}
accessibilityLabel={tooltipText}
role={CONST.ROLE.BUTTON}
sentryLabel={sentryLabel}
style={({hovered, pressed}) => [
styles.reportActionContextMenuMiniButton,
StyleUtils.getButtonBackgroundColorStyle(getButtonState(hovered, pressed, isDelayButtonStateComplete), true),
Expand Down
4 changes: 4 additions & 0 deletions src/components/ButtonWithDropdownMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import type {GestureResponderEvent} from 'react-native';
import Button from '@components/Button';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';

Check warning on line 7 in src/components/ButtonWithDropdownMenu/index.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'@components/Icon/Expensicons' import is restricted from being used by a pattern. Direct imports from Icon/Expensicons are deprecated. Please use lazy loading hooks instead. Use `useMemoizedLazyExpensifyIcons` from @hooks/useLazyAsset. See docs/LAZY_ICONS_AND_ILLUSTRATIONS.md for details

Check warning on line 7 in src/components/ButtonWithDropdownMenu/index.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'@components/Icon/Expensicons' import is restricted from being used. Direct imports from @components/Icon/Expensicons are deprecated. Please use lazy loading hooks instead. Use `useMemoizedLazyExpensifyIcons` from @hooks/useLazyAsset. See docs/LAZY_ICONS_AND_ILLUSTRATIONS.md for details
import PopoverMenu from '@components/PopoverMenu';
import useKeyboardShortcut from '@hooks/useKeyboardShortcut';
import usePopoverPosition from '@hooks/usePopoverPosition';
Expand Down Expand Up @@ -60,6 +60,7 @@
shouldUseShortForm = false,
shouldUseOptionIcon = false,
shouldStayNormalOnDisable = false,
sentryLabel,
} = props;

const theme = useTheme();
Expand Down Expand Up @@ -187,6 +188,7 @@
textStyles={[isTextTooLong && shouldUseShortForm ? {...styles.textExtraSmall, ...styles.textBold} : {}]}
secondLineText={secondLineText}
icon={icon}
sentryLabel={sentryLabel}
/>

{isSplitButton && (
Expand All @@ -204,6 +206,7 @@
small={buttonSize === CONST.DROPDOWN_BUTTON_SIZE.SMALL}
innerStyles={[styles.dropDownButtonCartIconContainerPadding, innerStyleDropButton, isButtonSizeSmall && styles.dropDownButtonCartIcon]}
enterKeyEventListenerPriority={enterKeyEventListenerPriority}
sentryLabel={sentryLabel}
>
<View style={[styles.dropDownButtonCartIconView, innerStyleDropButton]}>
<View style={[success ? styles.buttonSuccessDivider : styles.buttonDivider]} />
Expand Down Expand Up @@ -253,6 +256,7 @@
iconRight={shouldShowButtonRightIcon ? options.at(0)?.icon : undefined}
shouldShowRightIcon={shouldShowButtonRightIcon}
testID={testID}
sentryLabel={sentryLabel}
/>
)}
{(shouldAlwaysShowDropdownMenu || options.length > 1) && !!popoverAnchorPosition && (
Expand Down
5 changes: 5 additions & 0 deletions src/components/ButtonWithDropdownMenu/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ type DropdownOption<TValueType> = {
shouldShow?: boolean;
/** Whether to show a loading spinner for this option */
shouldShowLoadingSpinnerIcon?: boolean;
/** Label for sentry to identify the dropdown option */
sentryLabel?: string;
};

type ButtonWithDropdownMenuProps<TValueType> = {
Expand Down Expand Up @@ -157,6 +159,9 @@ type ButtonWithDropdownMenuProps<TValueType> = {

/** Reference to the outer element */
ref?: React.Ref<ButtonWithDropdownMenuRef>;

/** Label for the sentry to identify the button */
sentryLabel?: string;
};

type ButtonWithDropdownMenuRef = {
Expand Down
6 changes: 6 additions & 0 deletions src/components/ContextMenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ type ContextMenuItemProps = {

/** Reference to the outer element */
ref?: ForwardedRef<ContextMenuItemHandle>;

/** Label for Sentry tracking */
sentryLabel?: string;
};

type ContextMenuItemHandle = {
Expand All @@ -89,6 +92,7 @@ function ContextMenuItem({
disabled = false,
shouldShowLoadingSpinnerIcon = false,
ref,
sentryLabel,
}: ContextMenuItemProps) {
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
Expand Down Expand Up @@ -120,6 +124,7 @@ function ContextMenuItem({
onPress={triggerPressAndUpdateSuccess}
isDelayButtonStateComplete={!isThrottledButtonActive}
shouldPreventDefaultFocusOnPress={shouldPreventDefaultFocusOnPress}
sentryLabel={sentryLabel}
>
{({hovered, pressed}) => (
<Icon
Expand All @@ -146,6 +151,7 @@ function ContextMenuItem({
onBlur={onBlur}
disabled={disabled}
shouldShowLoadingSpinnerIcon={shouldShowLoadingSpinnerIcon}
sentryLabel={sentryLabel}
/>
);
}
Expand Down
1 change: 1 addition & 0 deletions src/components/EmojiPicker/EmojiPickerButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import React, {memo, useContext, useEffect, useRef} from 'react';
import * as ActionSheetAwareScrollView from '@components/ActionSheetAwareScrollView';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';

Check warning on line 5 in src/components/EmojiPicker/EmojiPickerButton.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'@components/Icon/Expensicons' import is restricted from being used by a pattern. Direct imports from Icon/Expensicons are deprecated. Please use lazy loading hooks instead. Use `useMemoizedLazyExpensifyIcons` from @hooks/useLazyAsset. See docs/LAZY_ICONS_AND_ILLUSTRATIONS.md for details

Check warning on line 5 in src/components/EmojiPicker/EmojiPickerButton.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'@components/Icon/Expensicons' import is restricted from being used. Direct imports from @components/Icon/Expensicons are deprecated. Please use lazy loading hooks instead. Use `useMemoizedLazyExpensifyIcons` from @hooks/useLazyAsset. See docs/LAZY_ICONS_AND_ILLUSTRATIONS.md for details
import type PressableProps from '@components/Pressable/GenericPressable/types';
import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback';
import Tooltip from '@components/Tooltip/PopoverAnchorTooltip';
Expand Down Expand Up @@ -78,6 +78,7 @@
onPress={openEmojiPicker}
id={CONST.EMOJI_PICKER_BUTTON_NATIVE_ID}
accessibilityLabel={translate('reportActionCompose.emoji')}
sentryLabel={CONST.SENTRY_LABEL.REPORT.EMOJI_PICKER_BUTTON}
>
{({hovered, pressed}) => (
<Icon
Expand Down
1 change: 1 addition & 0 deletions src/components/LHNOptionsList/OptionRowLHN.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import DisplayNames from '@components/DisplayNames';
import Hoverable from '@components/Hoverable';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';

Check warning on line 7 in src/components/LHNOptionsList/OptionRowLHN.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'@components/Icon/Expensicons' import is restricted from being used by a pattern. Direct imports from Icon/Expensicons are deprecated. Please use lazy loading hooks instead. Use `useMemoizedLazyExpensifyIcons` from @hooks/useLazyAsset. See docs/LAZY_ICONS_AND_ILLUSTRATIONS.md for details

Check warning on line 7 in src/components/LHNOptionsList/OptionRowLHN.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'@components/Icon/Expensicons' import is restricted from being used. Direct imports from @components/Icon/Expensicons are deprecated. Please use lazy loading hooks instead. Use `useMemoizedLazyExpensifyIcons` from @hooks/useLazyAsset. See docs/LAZY_ICONS_AND_ILLUSTRATIONS.md for details
import OfflineWithFeedback from '@components/OfflineWithFeedback';
import {useSession} from '@components/OnyxListItemProvider';
import PressableWithSecondaryInteraction from '@components/PressableWithSecondaryInteraction';
Expand Down Expand Up @@ -251,6 +251,7 @@
}`}
onLayout={onLayout}
needsOffscreenAlphaCompositing={(optionItem?.icons?.length ?? 0) >= 2}
sentryLabel={CONST.SENTRY_LABEL.LHN.OPTION_ROW}
>
<View style={sidebarInnerRowStyle}>
<View style={[styles.flexRow, styles.alignItemsCenter]}>
Expand Down
5 changes: 5 additions & 0 deletions src/components/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import FormHelpMessage from './FormHelpMessage';
import Hoverable from './Hoverable';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';

Check warning on line 37 in src/components/MenuItem.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'./Icon/Expensicons' import is restricted from being used by a pattern. Direct imports from Icon/Expensicons are deprecated. Please use lazy loading hooks instead. Use `useMemoizedLazyExpensifyIcons` from @hooks/useLazyAsset. See docs/LAZY_ICONS_AND_ILLUSTRATIONS.md for details
import {MenuItemGroupContext} from './MenuItemGroup';
import PlaidCardFeedIcon from './PlaidCardFeedIcon';
import type {PressableRef} from './Pressable/GenericPressable/types';
Expand Down Expand Up @@ -394,6 +394,9 @@

/** Whether the screen containing the item is focused */
isFocused?: boolean;

/** Label for Sentry tracking */
sentryLabel?: string;
};

type MenuItemProps = (IconProps | AvatarProps | NoIcon) & MenuItemBaseProps;
Expand Down Expand Up @@ -522,6 +525,7 @@
forwardedFSClass,
ref,
isFocused,
sentryLabel,
}: MenuItemProps) {
const theme = useTheme();
const styles = useThemeStyles();
Expand Down Expand Up @@ -722,6 +726,7 @@
accessibilityLabel={title ? title.toString() : ''}
accessible
onFocus={onFocus}
sentryLabel={sentryLabel}
>
{({pressed}) => (
<View style={[styles.flex1]}>
Expand Down
Loading
Loading