Skip to content
Merged
34 changes: 0 additions & 34 deletions src/components/HeaderWithBackButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ function HeaderWithBackButton({
shouldNavigateToTopMostReport = false,
shouldDisplayHelpButton = false,
shouldDisplaySearchRouter = false,
progressBarPercentage,
style,
subTitleLink = '',
shouldMinimizeMenuButton = false,
Expand All @@ -103,31 +102,6 @@ function HeaderWithBackButton({

const middleContent = useMemo(() => {
const stepCounterTranslation = stepCounter ? translate('stepCounter', stepCounter.step, stepCounter.total, stepCounter.text) : undefined;
if (progressBarPercentage) {
const progressBarLabel = stepCounter ? `${translate('common.progressBarLabel')}, ${stepCounterTranslation}` : undefined;
return (
<>
{/* Reserves as much space for the middleContent as possible */}
<View style={styles.flexGrow1} />
{/* Uses absolute positioning so that it's always centered instead of being affected by the
presence or absence of back/close buttons to the left/right of it */}
<View style={styles.headerProgressBarContainer}>
<View
style={styles.headerProgressBar}
accessible={!!progressBarLabel}
accessibilityLabel={progressBarLabel}
role={CONST.ROLE.PROGRESSBAR}
aria-valuetext={progressBarLabel}
>
<View
aria-hidden
style={[{width: `${progressBarPercentage}%`}, styles.headerProgressBarFill]}
/>
</View>
</View>
</>
);
}
if (shouldShowReportAvatarWithDisplay) {
return (
<AvatarWithDisplayName
Expand All @@ -154,15 +128,10 @@ function HeaderWithBackButton({
StyleUtils,
subTitleLink,
shouldUseHeadlineHeader,
progressBarPercentage,
report,
shouldEnableDetailPageNavigation,
shouldShowReportAvatarWithDisplay,
stepCounter,
styles.flexGrow1,
styles.headerProgressBar,
styles.headerProgressBarContainer,
styles.headerProgressBarFill,
styles.textHeadlineH2,
subtitle,
title,
Expand Down Expand Up @@ -226,9 +195,6 @@ function HeaderWithBackButton({
styles.headerBar,
shouldUseHeadlineHeader && styles.headerBarHeight,
shouldShowBorderBottom && styles.borderBottom,
// progressBarPercentage can be 0 which would
// be falsy, hence using !== undefined explicitly
progressBarPercentage !== undefined && styles.pl0,
shouldShowBackButton && [styles.pl2],
shouldOverlay && StyleSheet.absoluteFill,
style,
Expand Down
3 changes: 0 additions & 3 deletions src/components/HeaderWithBackButton/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,6 @@ type HeaderWithBackButtonProps = Partial<ChildrenProps> & {
/** Whether we should display the button that opens new SearchRouter */
shouldDisplaySearchRouter?: boolean;

/** 0 - 100 number indicating current progress of the progress bar */
progressBarPercentage?: number;

/** Policy avatar to display in the header */
policyAvatar?: Icon;

Expand Down
56 changes: 56 additions & 0 deletions src/components/OnboardingHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';

import variables from '@styles/variables';

import CONST from '@src/CONST';

import React from 'react';
import {View} from 'react-native';

import Icon from './Icon';
import {PressableWithoutFeedback} from './Pressable';
import Text from './Text';

type OnboardingHeaderProps = {
onBackButtonPress?: () => void;

shouldShowBackButton?: boolean;
};

/**
* Popover-style back link: caret + "Back" label.
* Matches the submenu back row used by PopoverMenu.
*/
function OnboardingHeader({onBackButtonPress, shouldShowBackButton = true}: OnboardingHeaderProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
const theme = useTheme();
const icons = useMemoizedLazyExpensifyIcons(['BackArrow']);

return (
<View style={[styles.onboardingHeaderContainer]}>
{shouldShowBackButton ? (
<PressableWithoutFeedback
onPress={onBackButtonPress}
style={[styles.flexRow, styles.alignItemsCenter, styles.gap3]}
role={CONST.ROLE.BUTTON}
accessibilityLabel={translate('common.back')}
sentryLabel="OnboardingHeader-Back"
>
<Icon
src={icons.BackArrow}
fill={theme.icon}
width={variables.iconSizeNormal}
height={variables.iconSizeNormal}
/>
<Text style={styles.createMenuHeaderText}>{translate('common.back')}</Text>
</PressableWithoutFeedback>
) : null}
</View>
);
}

export default OnboardingHeader;
1 change: 0 additions & 1 deletion src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ const translations: TranslationDeepObject<typeof en> = {
conjunctionTo: 'bis',
genericErrorMessage: 'Ups ... etwas ist schiefgelaufen und Ihre Anfrage konnte nicht abgeschlossen werden. Bitte versuchen Sie es später noch einmal.',
percentage: 'Prozentsatz',
progressBarLabel: 'Onboarding-Fortschritt',
converted: 'Umgewandelt',
error: {
invalidAmount: 'Ungültiger Betrag',
Expand Down
1 change: 0 additions & 1 deletion src/languages/el.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ const translations: TranslationDeepObject<typeof en> = {
conjunctionTo: 'σε',
genericErrorMessage: 'Ουπς... κάτι πήγε στραβά και το αίτημά σας δεν μπόρεσε να ολοκληρωθεί. Παρακαλούμε δοκιμάστε ξανά αργότερα.',
percentage: 'Ποσοστό',
progressBarLabel: 'Πρόοδος αρχικής ρύθμισης',
converted: 'Μετατράπηκε',
off: 'Ανενεργό',
error: {
Expand Down
1 change: 0 additions & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ const translations = {
conjunctionTo: 'to',
genericErrorMessage: 'Oops... something went wrong and your request could not be completed. Please try again later.',
percentage: 'Percentage',
progressBarLabel: 'Onboarding progress',
converted: 'Converted',
off: 'Off',
error: {
Expand Down
1 change: 0 additions & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ const translations: TranslationDeepObject<typeof en> = {
conjunctionTo: 'a',
genericErrorMessage: 'Ups... algo no ha ido bien y la acción no se ha podido completar. Por favor, inténtalo más tarde.',
percentage: 'Porcentaje',
progressBarLabel: 'Progreso de incorporación',
converted: 'Convertido',
error: {
invalidAmount: 'Importe no válido',
Expand Down
1 change: 0 additions & 1 deletion src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ const translations: TranslationDeepObject<typeof en> = {
conjunctionTo: 'à',
genericErrorMessage: 'Oups... une erreur s’est produite et votre requête n’a pas pu être effectuée. Veuillez réessayer plus tard.',
percentage: 'Pourcentage',
progressBarLabel: "Progression de l'intégration",
converted: 'Converti',
error: {
invalidAmount: 'Montant invalide',
Expand Down
1 change: 0 additions & 1 deletion src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ const translations: TranslationDeepObject<typeof en> = {
conjunctionTo: 'a',
genericErrorMessage: 'Ops... qualcosa è andato storto e la tua richiesta non può essere completata. Riprova più tardi.',
percentage: 'Percentuale',
progressBarLabel: 'Progresso onboarding',
converted: 'Convertito',
error: {
invalidAmount: 'Importo non valido',
Expand Down
1 change: 0 additions & 1 deletion src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ const translations: TranslationDeepObject<typeof en> = {
conjunctionTo: '宛先',
genericErrorMessage: 'おっと…問題が発生したため、リクエストを完了できませんでした。時間をおいてもう一度お試しください。',
percentage: 'パーセンテージ',
progressBarLabel: 'オンボーディング進捗',
converted: '変換済み',
error: {
invalidAmount: '金額が無効です',
Expand Down
1 change: 0 additions & 1 deletion src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ const translations: TranslationDeepObject<typeof en> = {
conjunctionTo: 'naar',
genericErrorMessage: 'Oeps... er is iets misgegaan en je verzoek kon niet worden voltooid. Probeer het later opnieuw.',
percentage: 'Percentage',
progressBarLabel: 'Voortgang onboarding',
converted: 'Geconverteerd',
error: {
invalidAmount: 'Ongeldig bedrag',
Expand Down
1 change: 0 additions & 1 deletion src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ const translations: TranslationDeepObject<typeof en> = {
conjunctionTo: 'do',
genericErrorMessage: 'Ups... coś poszło nie tak i Twoje żądanie nie mogło zostać zrealizowane. Spróbuj ponownie później.',
percentage: 'Procent',
progressBarLabel: 'Postęp wdrożenia',
converted: 'Przekonwertowano',
error: {
invalidAmount: 'Nieprawidłowa kwota',
Expand Down
1 change: 0 additions & 1 deletion src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ const translations: TranslationDeepObject<typeof en> = {
conjunctionTo: 'para',
genericErrorMessage: 'Ops... algo deu errado e sua solicitação não pôde ser concluída. Tente novamente mais tarde.',
percentage: 'Porcentagem',
progressBarLabel: 'Progresso da integração',
converted: 'Convertido',
error: {
invalidAmount: 'Valor inválido',
Expand Down
1 change: 0 additions & 1 deletion src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ const translations: TranslationDeepObject<typeof en> = {
conjunctionTo: '至',
genericErrorMessage: '哎呀……出现问题,无法完成您的请求。请稍后重试。',
percentage: '百分比',
progressBarLabel: '入门进度',
converted: '已转换',
error: {
invalidAmount: '金额无效',
Expand Down
8 changes: 0 additions & 8 deletions src/libs/getOnboardingStepCounter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ type OnboardingFlowContext = {

type OnboardingStepResult = {
stepCounter: StepCounterParams;
progressBarPercentage: number;
};

const {ONBOARDING} = SCREENS;
Expand Down Expand Up @@ -64,9 +63,6 @@ const qualifierSuffixes = {
[ONBOARDING_SIGNUP_QUALIFIERS.INDIVIDUAL]: null,
} satisfies Record<ValueOf<typeof ONBOARDING_SIGNUP_QUALIFIERS>, OnboardingScreen[] | null>;

const maxSuffixLength = Math.max(...Object.values(purposeSuffixes).map((s) => s.length));
const maxPrivateSuffixLength = Math.max(...Object.values(purposeSuffixes).map((s) => s.filter((p) => p !== ONBOARDING.PERSONAL_DETAILS).length));

function getAdjustedSuffix(suffix: OnboardingScreen[], context: OnboardingFlowContext): OnboardingScreen[] {
if (context.isAccountingEnabled === false) {
return suffix.filter((screen) => screen !== ONBOARDING.ACCOUNTING);
Expand Down Expand Up @@ -137,11 +133,8 @@ function getOnboardingStepCounter(page: OnboardingScreen, context: OnboardingFlo
if (index === -1) {
return undefined;
}
const isPrivateDomain = !context.isFromPublicDomain && !!context.hasAccessibleDomainPolicies;
const maxFlowLength = prefix.length + 1 + (isPrivateDomain ? maxPrivateSuffixLength : maxSuffixLength);
return {
stepCounter: {step: index + 1},
progressBarPercentage: Math.round(((index + 1) / maxFlowLength) * 100),
};
}

Expand All @@ -151,7 +144,6 @@ function getOnboardingStepCounter(page: OnboardingScreen, context: OnboardingFlo
}
return {
stepCounter: {step: index + 1, total: flow.length},
progressBarPercentage: Math.round(((index + 1) / flow.length) * 100),
};
}

Expand Down
13 changes: 2 additions & 11 deletions src/pages/OnboardingAccounting/BaseOnboardingAccounting.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Button from '@components/ButtonComposed';
import FixedFooter from '@components/FixedFooter';
import FormHelpMessage from '@components/FormHelpMessage';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import Icon from '@components/Icon';
import OnboardingHeader from '@components/OnboardingHeader';
import {PressableWithoutFeedback} from '@components/Pressable';
import RadioButtonWithLabel from '@components/RadioButtonWithLabel';
import ScreenWrapper from '@components/ScreenWrapper';
Expand All @@ -14,7 +14,6 @@ import useCompleteOnboarding from '@hooks/useCompleteOnboarding';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
import useOnboardingStepCounter from '@hooks/useOnboardingStepCounter';
import useOnyx from '@hooks/useOnyx';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useStyleUtils from '@hooks/useStyleUtils';
Expand All @@ -33,7 +32,6 @@ import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import SCREENS from '@src/SCREENS';
import type IconAsset from '@src/types/utils/IconAsset';

import React, {useEffect, useState} from 'react';
Expand Down Expand Up @@ -124,7 +122,6 @@ function BaseOnboardingAccounting({shouldUseNativeStyles}: BaseOnboardingAccount
const [session] = useOnyx(ONYXKEYS.SESSION);
const [onboardingUserReportedIntegration] = useOnyx(ONYXKEYS.ONBOARDING_USER_REPORTED_INTEGRATION);
const [onboardingFeaturesMap] = useOnyx(ONYXKEYS.ONBOARDING_INTERESTED_FEATURES_MAP);
const onboardingStep = useOnboardingStepCounter(SCREENS.ONBOARDING.ACCOUNTING, {isAccountingEnabled: true});

const isKnownIntegration = isIntegrationKey(onboardingUserReportedIntegration);
let initialSelectedIntegration: AccountingOptionKey | undefined;
Expand Down Expand Up @@ -235,13 +232,7 @@ function BaseOnboardingAccounting({shouldUseNativeStyles}: BaseOnboardingAccount
style={[styles.defaultModalContainer, shouldUseNativeStyles && styles.pt8]}
shouldEnableMaxHeight
>
<HeaderWithBackButton
shouldShowBackButton
stepCounter={onboardingStep?.stepCounter}
progressBarPercentage={onboardingStep?.progressBarPercentage}
onBackButtonPress={() => Navigation.goBack(ROUTES.ONBOARDING_INTERESTED_FEATURES.getRoute())}
shouldDisplayHelpButton={false}
/>
<OnboardingHeader onBackButtonPress={() => Navigation.goBack(ROUTES.ONBOARDING_INTERESTED_FEATURES.getRoute())} />
<View style={[onboardingIsMediumOrLargerScreenWidth && styles.mt5, onboardingIsMediumOrLargerScreenWidth ? styles.mh8 : styles.mh5]}>
<Text
style={[styles.textHeadlineH1, styles.mb5]}
Expand Down
7 changes: 2 additions & 5 deletions src/pages/OnboardingEmployees/BaseOnboardingEmployees.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Button from '@components/ButtonComposed';
import FormHelpMessage from '@components/FormHelpMessage';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import OnboardingHeader from '@components/OnboardingHeader';
import ScreenWrapper from '@components/ScreenWrapper';
import SelectionList from '@components/SelectionList';
import SingleSelectListItem from '@components/SelectionList/ListItem/SingleSelectListItem';
Expand Down Expand Up @@ -151,12 +151,9 @@ function BaseOnboardingEmployees({shouldUseNativeStyles, route}: BaseOnboardingE
testID="BaseOnboardingEmployees"
style={[styles.defaultModalContainer, shouldUseNativeStyles && styles.pt8]}
>
<HeaderWithBackButton
<OnboardingHeader
shouldShowBackButton={!isEmployeesFirstStep}
stepCounter={onboardingStep?.stepCounter}
progressBarPercentage={onboardingStep?.progressBarPercentage}
onBackButtonPress={handleBackButtonPress}
shouldDisplayHelpButton={false}
/>
<Text
style={[styles.textHeadlineH1, styles.mb5, onboardingIsMediumOrLargerScreenWidth && styles.mt5, onboardingIsMediumOrLargerScreenWidth ? styles.mh8 : styles.mh5]}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Button from '@components/ButtonComposed';
import Checkbox from '@components/Checkbox';
import FixedFooter from '@components/FixedFooter';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import Icon from '@components/Icon';
import OnboardingHeader from '@components/OnboardingHeader';
import {PressableWithoutFeedback} from '@components/Pressable';
import ScreenWrapper from '@components/ScreenWrapper';
import ScrollView from '@components/ScrollView';
Expand All @@ -13,7 +13,6 @@ import useCompleteOnboarding from '@hooks/useCompleteOnboarding';
import {useMemoizedLazyIllustrations} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
import useOnboardingStepCounter from '@hooks/useOnboardingStepCounter';
import useOnyx from '@hooks/useOnyx';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useThemeStyles from '@hooks/useThemeStyles';
Expand All @@ -34,7 +33,6 @@ import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import SCREENS from '@src/SCREENS';

import React, {useCallback, useEffect, useMemo, useState} from 'react';
import {View} from 'react-native';
Expand Down Expand Up @@ -110,7 +108,6 @@ function BaseOnboardingInterestedFeatures({shouldUseNativeStyles}: BaseOnboardin
return Array.from(selectedFeatureIDs ?? new Set(persistedSelectedFeatures ?? defaultSelectedFeatures));
}, [defaultSelectedFeatures, persistedSelectedFeatures, selectedFeatureIDs]);
const isAccountingEnabled = selectedFeatures.includes(CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED);
const onboardingStep = useOnboardingStepCounter(SCREENS.ONBOARDING.INTERESTED_FEATURES, {isAccountingEnabled});

// Set onboardingPolicyID and onboardingAdminsChatReportID if a workspace is created by the backend for OD signup
useEffect(() => {
Expand Down Expand Up @@ -244,12 +241,7 @@ function BaseOnboardingInterestedFeatures({shouldUseNativeStyles}: BaseOnboardin
style={[styles.defaultModalContainer, shouldUseNativeStyles && styles.pt8]}
shouldEnableMaxHeight
>
<HeaderWithBackButton
stepCounter={onboardingStep?.stepCounter}
progressBarPercentage={onboardingStep?.progressBarPercentage}
onBackButtonPress={() => Navigation.goBack(ROUTES.ONBOARDING_EMPLOYEES.getRoute())}
shouldDisplayHelpButton={false}
/>
<OnboardingHeader onBackButtonPress={() => Navigation.goBack(ROUTES.ONBOARDING_EMPLOYEES.getRoute())} />
<View style={[onboardingIsMediumOrLargerScreenWidth && styles.mt5, onboardingIsMediumOrLargerScreenWidth ? styles.mh8 : styles.mh5]}>
<Text
style={[styles.textHeadlineH1, styles.mb5]}
Expand Down
Loading
Loading