Skip to content

Commit 31a5b2e

Browse files
authored
Merge pull request Expensify#87395 from ryntgh/issue-80956-2nd
feat: Add Concierge help button on mobile native app
2 parents bccda33 + 30d89cd commit 31a5b2e

3 files changed

Lines changed: 54 additions & 11 deletions

File tree

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,50 @@
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+
);
448
}
549

650
export default SidePanelButton;

src/pages/inbox/HeaderView.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ function HeaderView({onNavigationMenuButtonClicked, reportID}: HeaderViewProps)
126126
const styles = useThemeStyles();
127127
const isSelfDM = isSelfDMReportUtils(report);
128128
const isGroupChat = isGroupChatReportUtils(report) || isDeprecatedGroupDM(report, isReportArchived);
129+
const isConciergeChat = isConciergeChatReport(report, conciergeReportID);
129130
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
130131
const [onboarding] = useOnyx(ONYXKEYS.NVP_ONBOARDING);
131132
const allParticipants = getParticipantsAccountIDsForDisplay(report, false, true, undefined, reportMetadata);
@@ -416,7 +417,7 @@ function HeaderView({onNavigationMenuButtonClicked, reportID}: HeaderViewProps)
416417
</Tooltip>
417418
)}
418419
{shouldDisplaySearchRouter && <SearchButton style={styles.ml2} />}
419-
{!isInSidePanel && <SidePanelButton />}
420+
{!isInSidePanel && !isConciergeChat && <SidePanelButton />}
420421
</View>
421422
</View>
422423
)}

src/pages/settings/InitialSettingsPage.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -522,13 +522,11 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr
522522
bottomContent={tabBarContent}
523523
bottomContentStyle={styles.overflowVisible}
524524
>
525-
{shouldUseNarrowLayout && (
526-
<TopBarWithLoadingBar
527-
breadcrumbLabel={translate('initialSettingsPage.account')}
528-
shouldDisplaySearch
529-
shouldDisplayHelpButton
530-
/>
531-
)}
525+
<TopBarWithLoadingBar
526+
breadcrumbLabel={translate('initialSettingsPage.account')}
527+
shouldDisplaySearch={shouldUseNarrowLayout}
528+
shouldDisplayHelpButton={shouldUseNarrowLayout}
529+
/>
532530
<ScrollView
533531
ref={scrollViewRef}
534532
onScroll={onScroll}

0 commit comments

Comments
 (0)