diff --git a/src/CONST/index.ts b/src/CONST/index.ts index 21102c4e1fc6..1973b0ffc7f3 100644 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -991,6 +991,7 @@ const CONST = { BULK_EDIT: 'bulkEdit', BULK_EDIT_WORKSPACES: 'bulkEditWorkspaces', SUBMIT_2026: 'submit2026', + WALLET_CONNECTION_STATUS: 'walletConnectionStatus', BULK_SUBMIT_APPROVE_PAY: 'bulkSubmitApprovePay', WORKSPACE_ROOMS_PAGE: 'workspaceRoomsPage', VENDOR_MATCHING: 'vendorMatching', diff --git a/src/components/ConnectionStatusBadge.tsx b/src/components/ConnectionStatusBadge.tsx new file mode 100644 index 000000000000..60991a362ad0 --- /dev/null +++ b/src/components/ConnectionStatusBadge.tsx @@ -0,0 +1,39 @@ +import useThemeStyles from '@hooks/useThemeStyles'; + +import React from 'react'; +import {View} from 'react-native'; + +import Badge from './Badge'; +import Tooltip from './Tooltip'; + +type ConnectionStatusBadgeProps = { + text: string; + tone?: 'default' | 'success' | 'danger'; + tooltipText?: string; +}; + +function ConnectionStatusBadge({text, tone = 'default', tooltipText}: ConnectionStatusBadgeProps) { + const styles = useThemeStyles(); + + const badge = ( + + ); + + if (!tooltipText) { + return badge; + } + + return ( + + {badge} + + ); +} + +export default ConnectionStatusBadge; diff --git a/src/components/ConnectionStatusMessage.tsx b/src/components/ConnectionStatusMessage.tsx new file mode 100644 index 000000000000..acd4d1e82e2e --- /dev/null +++ b/src/components/ConnectionStatusMessage.tsx @@ -0,0 +1,89 @@ +import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; +import useResponsiveLayout from '@hooks/useResponsiveLayout'; +import useTheme from '@hooks/useTheme'; +import useThemeStyles from '@hooks/useThemeStyles'; + +import type {ComponentProps} from 'react'; + +import React from 'react'; +import {View} from 'react-native'; + +import Button from './Button'; +import Icon from './Icon'; +import RenderHTML from './RenderHTML'; + +type ConnectionStatusMessageProps = { + message?: string; + actionText?: string; + onActionPress?: () => void; + isActionDisabled?: boolean; + statusTone?: 'default' | 'success' | 'danger'; + onLinkPress?: ComponentProps['onLinkPress']; + shouldIncludeHorizontalPadding?: boolean; +}; + +function ConnectionStatusMessage({ + message, + actionText, + onActionPress, + isActionDisabled = false, + statusTone = 'default', + onLinkPress, + shouldIncludeHorizontalPadding = true, +}: ConnectionStatusMessageProps) { + const icons = useMemoizedLazyExpensifyIcons(['DotIndicator']); + const theme = useTheme(); + const styles = useThemeStyles(); + const {shouldUseNarrowLayout} = useResponsiveLayout(); + + if (!message && !actionText) { + return null; + } + + let statusMessageRowPadding; + if (shouldIncludeHorizontalPadding) { + statusMessageRowPadding = shouldUseNarrowLayout ? styles.ph5 : styles.ph8; + } + const shouldShowActionButton = !!actionText && !!onActionPress; + const isDangerStatus = statusTone === 'danger'; + const messageTag = isDangerStatus ? 'rbr' : 'muted-text-label'; + const messageHTML = `<${messageTag}>${message ?? ''}`; + const messageContent = ( + + {isDangerStatus && ( + + + + )} + + + + + ); + + const actionButton = shouldShowActionButton ? ( +