|
1 | | -// Side Panel is disabled on native platforms |
2 | | -function SidePanelButton() { |
3 | | - return null; |
| 1 | +import {hasSeenTourSelector} from '@selectors/Onboarding'; |
| 2 | +import React from 'react'; |
| 3 | +import Icon from '@components/Icon'; |
| 4 | +import {PressableWithoutFeedback} from '@components/Pressable'; |
| 5 | +import Tooltip from '@components/Tooltip'; |
| 6 | +import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; |
| 7 | +import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; |
| 8 | +import useLocalize from '@hooks/useLocalize'; |
| 9 | +import useOnyx from '@hooks/useOnyx'; |
| 10 | +import useSidePanelState from '@hooks/useSidePanelState'; |
| 11 | +import useThemeStyles from '@hooks/useThemeStyles'; |
| 12 | +import {navigateToConciergeChat} from '@userActions/Report'; |
| 13 | +import CONST from '@src/CONST'; |
| 14 | +import ONYXKEYS from '@src/ONYXKEYS'; |
| 15 | +import type SidePanelButtonProps from './types'; |
| 16 | + |
| 17 | +function SidePanelButton({style}: SidePanelButtonProps) { |
| 18 | + const styles = useThemeStyles(); |
| 19 | + const {translate} = useLocalize(); |
| 20 | + const {shouldHideHelpButton} = useSidePanelState(); |
| 21 | + const {accountID: currentUserAccountID = CONST.DEFAULT_NUMBER_ID} = useCurrentUserPersonalDetails(); |
| 22 | + const {ConciergeAvatar} = useMemoizedLazyExpensifyIcons(['ConciergeAvatar']); |
| 23 | + const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID); |
| 24 | + const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED); |
| 25 | + const [isSelfTourViewed] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {selector: hasSeenTourSelector}); |
| 26 | + const [betas] = useOnyx(ONYXKEYS.BETAS); |
| 27 | + |
| 28 | + if (shouldHideHelpButton) { |
| 29 | + return null; |
| 30 | + } |
| 31 | + |
| 32 | + return ( |
| 33 | + <Tooltip text={translate('common.help')}> |
| 34 | + <PressableWithoutFeedback |
| 35 | + sentryLabel={CONST.SENTRY_LABEL.SIDE_PANEL.HELP} |
| 36 | + accessibilityLabel={translate('common.help')} |
| 37 | + style={[styles.flexRow, styles.touchableButtonImage, style]} |
| 38 | + onPress={() => navigateToConciergeChat(conciergeReportID, introSelected, currentUserAccountID, isSelfTourViewed, betas)} |
| 39 | + > |
| 40 | + <Icon |
| 41 | + src={ConciergeAvatar} |
| 42 | + width={28} |
| 43 | + height={28} |
| 44 | + /> |
| 45 | + </PressableWithoutFeedback> |
| 46 | + </Tooltip> |
| 47 | + ); |
4 | 48 | } |
5 | 49 |
|
6 | 50 | export default SidePanelButton; |
0 commit comments