Skip to content

Commit 4ce1ba1

Browse files
Fix mobile Home section order for Getting started
1 parent 9dde663 commit 4ce1ba1

2 files changed

Lines changed: 12 additions & 45 deletions

File tree

src/pages/home/HomePage.tsx

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ import ScrollView from '@components/ScrollView';
1010
import useConfirmReadyToOpenApp from '@hooks/useConfirmReadyToOpenApp';
1111
import useDocumentTitle from '@hooks/useDocumentTitle';
1212
import useLocalize from '@hooks/useLocalize';
13-
import useOnboardingIntent from '@hooks/useOnboardingIntent';
1413
import useOnyx from '@hooks/useOnyx';
1514
import useResponsiveLayout from '@hooks/useResponsiveLayout';
1615
import useThemeStyles from '@hooks/useThemeStyles';
1716
import variables from '@styles/variables';
18-
import CONST from '@src/CONST';
1917
import ONYXKEYS from '@src/ONYXKEYS';
2018
import AnnouncementSection from './AnnouncementSection';
2119
import AssignedCardsSection from './AssignedCardsSection';
@@ -34,8 +32,6 @@ function HomePage() {
3432
useDocumentTitle(translate('common.home'));
3533
const [isLoadingApp = true] = useOnyx(ONYXKEYS.IS_LOADING_APP);
3634
const [isLoadingReportData = false] = useOnyx(ONYXKEYS.IS_LOADING_REPORT_DATA);
37-
const intent = useOnboardingIntent();
38-
const shouldSwapForYouAndGettingStarted = intent === CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE;
3935
const isForYouLoading = !!(isLoadingApp || isLoadingReportData);
4036
const receiptDropTargetRef = useRef<View>(null);
4137

@@ -73,17 +69,8 @@ function HomePage() {
7369
<>
7470
<FreeTrialSection />
7571
<TimeSensitiveSection />
76-
{shouldSwapForYouAndGettingStarted ? (
77-
<>
78-
<ForYouSection />
79-
<GettingStartedSection />
80-
</>
81-
) : (
82-
<>
83-
<GettingStartedSection />
84-
<ForYouSection />
85-
</>
86-
)}
72+
<GettingStartedSection />
73+
<ForYouSection />
8774
<UpcomingTravelSection />
8875
<AssignedCardsSection />
8976
<SpendOverTimeSection />

tests/unit/pages/HomePage.test.tsx

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ function getSectionOrder() {
141141
};
142142
}
143143

144+
// Locks in the canonical mobile ordering from https://github.com/Expensify/App/issues/85075:
145+
// Getting started must always sit above For you on narrow layouts, regardless of the onboarding intent.
144146
describe('HomePage mobile ordering', () => {
145147
beforeAll(() => {
146148
Onyx.init({keys: ONYXKEYS});
@@ -152,36 +154,14 @@ describe('HomePage mobile ordering', () => {
152154
await waitForBatchedUpdates();
153155
});
154156

155-
it('renders ForYouSection before GettingStartedSection when introSelected.choice is TRACK_WORKSPACE on narrow layout', async () => {
156-
await Onyx.set(ONYXKEYS.NVP_INTRO_SELECTED, {
157-
choice: CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE,
158-
});
159-
await waitForBatchedUpdates();
160-
161-
renderHomePage();
162-
163-
const {forYouIndex, gettingStartedIndex} = getSectionOrder();
164-
expect(forYouIndex).toBeGreaterThanOrEqual(0);
165-
expect(gettingStartedIndex).toBeGreaterThanOrEqual(0);
166-
expect(forYouIndex).toBeLessThan(gettingStartedIndex);
167-
});
168-
169-
it('renders ForYouSection before GettingStartedSection when introSelected.choice is undefined but onboardingPurpose is TRACK_WORKSPACE on narrow layout', async () => {
170-
await Onyx.set(ONYXKEYS.ONBOARDING_PURPOSE_SELECTED, CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE as never);
171-
await waitForBatchedUpdates();
172-
173-
renderHomePage();
174-
175-
const {forYouIndex, gettingStartedIndex} = getSectionOrder();
176-
expect(forYouIndex).toBeGreaterThanOrEqual(0);
177-
expect(gettingStartedIndex).toBeGreaterThanOrEqual(0);
178-
expect(forYouIndex).toBeLessThan(gettingStartedIndex);
179-
});
180-
181-
it('keeps GettingStartedSection before ForYouSection when intent is MANAGE_TEAM on narrow layout', async () => {
182-
await Onyx.set(ONYXKEYS.NVP_INTRO_SELECTED, {
183-
choice: CONST.ONBOARDING_CHOICES.MANAGE_TEAM,
184-
});
157+
it.each([
158+
['no onboarding intent set', undefined],
159+
['MANAGE_TEAM intent', CONST.ONBOARDING_CHOICES.MANAGE_TEAM],
160+
['TRACK_WORKSPACE intent', CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE],
161+
])('renders GettingStartedSection before ForYouSection on narrow layout with %s', async (_label, choice) => {
162+
if (choice) {
163+
await Onyx.set(ONYXKEYS.NVP_INTRO_SELECTED, {choice});
164+
}
185165
await waitForBatchedUpdates();
186166

187167
renderHomePage();

0 commit comments

Comments
 (0)