Skip to content

Migrate HeaderWithBackButton to composed Header: batch 8 - #102036

Open
Guccio163 wants to merge 21 commits into
Expensify:mainfrom
software-mansion-labs:Guccio163/header/batch8
Open

Guccio163 wants to merge 21 commits into
Expensify:mainfrom
software-mansion-labs:Guccio163/header/batch8

Conversation

@Guccio163

@Guccio163 Guccio163 commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Batch 8 of the HeaderWithBackButton → composed Header migration. Migrates the 21 call-sites under the loose workspace/*.tsx files, workspace/receiptPartners/ and workspace/workflows/ (incl. approvals/).

20 call-sites use the HeaderWithBackButtonAndTitle preset; three of them pass subtitle. WorkspaceInitialPage.tsx composes Header directly: Header.BackButton, the workspace (or user) avatar, Header.Title with the headline style, the help button on narrow layouts and AccountAvatarButton. The only visual difference is intentional: the title ends 12px (instead of 16px) before the next item or the right edge of the header.

Fixed Issues

$ #101537

Tests

Setup (once): sign in with a brand-new account and finish onboarding. Open the Workspaces tab > New workspace > Confirm. A new workspace is on the Collect plan; turn on the workspace features a step needs in Workspaces > your workspace > More features. Everything below is on web in a wide window unless a step says otherwise. "Narrow" means a window narrower than 800px (or a phone). The left menu of a workspace lists: Overview, Members, Agents, Rooms, Reports, Connections, Categories, Tags, Taxes, Workflows, Rules, Distance rates, Travel, Expensify Card, Company cards, Per diem, Time, Invoices, More features (only the features that are turned on).

Header types in this PR (what they must look like):

  • Back + title (the migrated preset): back button on the left, the title next to it, nothing on the right (no help, search or action buttons). It looks the same as on main. The one intentional difference: when the title is long enough to be truncated (use a long name or narrow the window), the end of the title is 12px from the right edge of the header instead of 16px on main.
  • Back + title + subtitle (invite members): back, the title with the workspace name as subtitle under it, nothing on the right. The title box ends 12px before the header's right edge (main: 16px) - intentional.
  • Workspace home on narrow: back, the workspace avatar, the workspace name in headline style, the help icon and the account avatar button (no search button). The name box ends 12px before the help icon (main: 16px) - intentional. On a wide window this screen does not exist (the workspace left menu is shown instead).

1. Back + title: workspace Overview, Workflows, Rooms

  1. Workspaces tab > your workspace > Overview > Workspace name, Description, Default currency, Plan type, and the Overview More > Share. Check each header.
  2. Workspaces tab > your workspace > Workflows > Add approval workflow. Check the header.
  3. Workspaces tab > your workspace > Rooms > Create. Check the header.
    Expected: back button + title only, nothing on the right. Same as main, except that a truncated title ends 12px from the header's right edge (main: 16px) - intentional. The back button returns to the previous screen.

2. Invite members: back + title + subtitle

  1. Workspaces tab > your workspace > Members > Invite member: the header has the back button, the title Invite new members and the workspace name as subtitle.
    Expected: back + title + subtitle, nothing on the right. Same as main, except that a truncated title ends 12px from the header's right edge (main: 16px) - intentional.

3. Workspace home on narrow layout

  1. Make the window narrower than 800px (or use a phone) and open Workspaces tab > your workspace.
  2. Check the header: back button, workspace avatar, workspace name, help button, account avatar button. Tap each: back returns to the workspaces list, help opens the help panel, the account avatar opens the account menu.
    Expected: back + avatar + name on the left, help + account avatar on the right, no search button. The name box ends 12px before the help icon (main: 16px) - intentional.
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

Same as tests

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
android-morefeatures-headline-help-header.mp4
android-overview-pagewithsections-header.mp4
android-workspace-initial-avatar-header.mp4
Android: mWeb Chrome
iOS: Native
ios-morefeatures-headline-help-header.mp4
ios-overview-pagewithsections-header.mp4
ios-workspace-initial-avatar-header.mp4
iOS: mWeb Safari
MacOS: Chrome / Safari
b8-web.mp4

@Guccio163 Guccio163 changed the title Migrate HeaderWithBackButton to composed Header: workspace/receiptPartners, workflows, root workspace pages Migrate HeaderWithBackButton to composed Header: batch 8 Sep 23, 2026
Guccio163 and others added 10 commits September 29, 2026 12:42
Restored to part2's current (legacy HeaderWithBackButton) state - these
files are Central Pane root screens now migrated via HeaderCentralPane
directly on Guccio163/header/centralPane, so keeping them migrated here
too would duplicate and conflict with that work. Rest of this batch is
untouched.
…labs/expensify-app-fork into Guccio163/header/batch8
…WithBackButtonAndTitle

Pulls the part2 changes into this batch branch. WorkspaceInitialPage
used isHeadline directly on Header.Title; switched it to fold
textHeadlineH2 into its existing titleStyles array since the
primitive no longer carries the isHeadline prop.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
WorkspaceInitialPage now renders a manual Header composition with
WorkspaceAvatar/UserAvatar/AccountAvatarButton instead of passing an
avatar through the old HeaderWithBackButton, so the test's blanket
mock of that component no longer swallows them; they rendered for
real and crashed on the missing OnyxListItemProvider. Mock the three
avatar components directly instead.

WorkspaceOverviewCurrencyPage now renders HeaderWithBackButtonAndTitle
from the composed Header API, so the mock needed to move to the new
module path; the real Header then pulled in a navigation-context hook
chain the test's mocks don't support.
@codecov

codecov Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

@Guccio163
Guccio163 marked this pull request as ready for review October 1, 2026 17:48
@Guccio163
Guccio163 requested review from a team as code owners October 1, 2026 17:48
@melvin-bot
melvin-bot Bot requested review from gijoe0295 and trjExpensify and removed request for a team October 1, 2026 17:48
@melvin-bot

melvin-bot Bot commented Oct 1, 2026

Copy link
Copy Markdown

@gijoe0295 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@trjExpensify

Copy link
Copy Markdown
Contributor

PR doesn’t need product input as a refactor PR. Unassigning and unsubscribing myself.

@trjExpensify
trjExpensify removed their request for review October 2, 2026 20:10
# Conflicts:
#	src/pages/workspace/DynamicWorkspaceInvitePage.tsx
#	src/pages/workspace/WorkspaceConfirmationOwnerSelectorPage.tsx
#	src/pages/workspace/WorkspaceConfirmationSuccessPage.tsx
#	src/pages/workspace/WorkspaceInitialPage.tsx
#	src/pages/workspace/WorkspaceNewRoomPage.tsx
#	src/pages/workspace/WorkspaceOverviewCurrencyPage.tsx
#	src/pages/workspace/receiptPartners/DynamicInviteReceiptPartnerPolicyPage.tsx
#	src/pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage.tsx
#	src/pages/workspace/workflows/WorkspaceAutoReportingMonthlyOffsetPage.tsx
…-fork into Guccio163/header/batch8

# Conflicts:
#	src/pages/workspace/WorkspaceOverviewCurrencyPage.tsx
#	src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsApprovalLimitPage.tsx
# Conflicts:
#	src/components/CategoryPicker/index.tsx
#	src/hooks/useSearchBulkActions.ts

@gijoe0295 gijoe0295 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update PR description regarding the new padding. Some test steps also seem outdated. Use an AI agent to help.

@gijoe0295

gijoe0295 commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Android: mWeb Chrome
iOS: HybridApp
Screen.Recording.2026-12-02.at.15.02.04.mov
iOS: mWeb Safari
Screen.Recording.2026-12-02.at.15.00.05.mov
MacOS: Chrome / Safari
Screen.Recording.2026-12-02.at.14.57.15.mov

@gijoe0295 gijoe0295 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@melvin-bot
melvin-bot Bot requested a review from mountiny December 2, 2026 08:04
<Header.BackButton onPress={() => Navigation.goBack(route.params?.backTo ?? ROUTES.WORKSPACES_LIST.route)} />
{policy ? (
<WorkspaceAvatar
containerStyles={[StyleUtils.getWidthAndHeightStyle(StyleUtils.getAvatarSize(CONST.AVATAR_SIZE.SMALL)), styles.mr3]}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ CONSISTENCY-3 (docs)

The avatar container styles [StyleUtils.getWidthAndHeightStyle(StyleUtils.getAvatarSize(CONST.AVATAR_SIZE.SMALL)), styles.mr3] (and the size={CONST.AVATAR_SIZE.SMALL} prop) are duplicated verbatim across the WorkspaceAvatar and UserAvatar branches of the ternary. Duplicating the same style expression in both branches means a future tweak has to be made in two places and the copies can drift.

Hoist the shared values into a single local and reuse them in both branches:

const avatarContainerStyles = [StyleUtils.getWidthAndHeightStyle(StyleUtils.getAvatarSize(CONST.AVATAR_SIZE.SMALL)), styles.mr3];
// ...
{policy ? (
    <WorkspaceAvatar
        containerStyles={avatarContainerStyles}
        size={CONST.AVATAR_SIZE.SMALL}
        source={policy.avatarURL ?? ''}
        name={policy.name ?? ''}
        avatarID={policy.id ?? CONST.DEFAULT_NUMBER_ID}
    />
) : (
    <UserAvatar
        containerStyles={avatarContainerStyles}
        size={CONST.AVATAR_SIZE.SMALL}
        source={expensifyIcons.ExpensifyAppIcon}
        accountID={CONST.DEFAULT_NUMBER_ID}
    />
)}

Reviewed at: dcf0f6a | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants