Skip to content

Comments

Emails: Fix mailbox list background and position#101687

Merged
m1r0 merged 2 commits intotrunkfrom
fix/mailbox-list-background-and-position
Mar 27, 2025
Merged

Emails: Fix mailbox list background and position#101687
m1r0 merged 2 commits intotrunkfrom
fix/mailbox-list-background-and-position

Conversation

@m1r0
Copy link
Member

@m1r0 m1r0 commented Mar 20, 2025

Resolves #101651

Proposed Changes

  • Fixes the missing background color on the mailbox list and adds a bit of spacing between the sections.

Why are these changes being made?

  • This fixes a UI bug.

Testing Instructions

  • Have a domain with an email subscription.
  • Navigate to /email/:domain/manage/:site.
  • Make sure the "Mailboxes" section looks similar to the design: ePfz53j71KKDLWtuSm567A-fi-4962_13952
  • Navigate to /overview/site-domain/email/:site/:domain and /domains/manage/all/email/:site/:domain and make sure the "Mailboxes" section looks good.
  • Check on mobile.

Screenshots

/email/:domain/manage/:site:
image

/overview/site-domain/email/:site/:domain:
image

/domains/manage/all/email/:site/:domain:
image

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
    • For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@m1r0 m1r0 self-assigned this Mar 20, 2025
@github-actions
Copy link

github-actions bot commented Mar 20, 2025

@m1r0 m1r0 marked this pull request as ready for review March 20, 2025 17:07
@m1r0 m1r0 requested a review from a team as a code owner March 20, 2025 17:07
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Mar 20, 2025
@matticbot
Copy link
Contributor

matticbot commented Mar 20, 2025

This PR does not affect the size of JS and CSS bundles shipped to the user's browser.

Generated by performance advisor bot at iscalypsofastyet.com.

@m1r0 m1r0 requested a review from a team March 20, 2025 17:11
@m1r0 m1r0 force-pushed the fix/mailbox-list-background-and-position branch from b593a8c to 8af0782 Compare March 20, 2025 17:32
Copy link
Contributor

@fredrikekelund fredrikekelund left a comment

Choose a reason for hiding this comment

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

Thanks for the quick turnaround, @m1r0 👍

This PR fixes the changes, but I would argue we should apply the styling to the existing component structure instead of adding a VerticalNav component here (given that the children aren't VerticalNavItems)

Comment on lines 54 to 79
<div className="vertical-nav">
<SectionHeader
isPlaceholder={ isPlaceholder }
label={
<>
{ !! showIcon && domain && <HeaderIcon /> }
{ getListHeaderTextForAccountType() }
</>
}
>
{ addMailboxPath && (
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
<Button href={ addMailboxPath } variant="link" disabled={ !! disableActions }>
{ translate( 'Add mailbox' ) }
</Button>
) }
{ showContextMenu && (
<ContextMenu
domain={ domain }
className="email-plan-mailboxes-list__mailbox-context-menu"
/>
) }
</SectionHeader>
{ children }
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<div className="vertical-nav">
<SectionHeader
isPlaceholder={ isPlaceholder }
label={
<>
{ !! showIcon && domain && <HeaderIcon /> }
{ getListHeaderTextForAccountType() }
</>
}
>
{ addMailboxPath && (
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
<Button href={ addMailboxPath } variant="link" disabled={ !! disableActions }>
{ translate( 'Add mailbox' ) }
</Button>
) }
{ showContextMenu && (
<ContextMenu
domain={ domain }
className="email-plan-mailboxes-list__mailbox-context-menu"
/>
) }
</SectionHeader>
{ children }
</div>
<SectionHeader
isPlaceholder={ isPlaceholder }
label={
<>
{ !! showIcon && domain && <HeaderIcon /> }
{ getListHeaderTextForAccountType() }
</>
}
>
{ addMailboxPath && (
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
<Button href={ addMailboxPath } variant="link" disabled={ !! disableActions }>
{ translate( 'Add mailbox' ) }
</Button>
) }
{ showContextMenu && (
<ContextMenu
domain={ domain }
className="email-plan-mailboxes-list__mailbox-context-menu"
/>
) }
</SectionHeader>
{ children }

It looks like the only purpose vertical-nav is to add a margin-top: 15px rule in the single-site context. Applying that style to email-plan-mailboxes-list__mailbox-list directly seems sensible, since we're not using VerticalNavItem here.

Side note: the // @ts-expect-error looks to be superfluous unless I'm missing something.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the quick review, Fredrik. All makes sense! I've moved the styling to the component and cleaned up the vertical-nav (not sure why I went with the div instead of the component). Can you give it another quick look? There should be no visual changes.

Regarding the @ts-expect-error, I've tried removing it but that unveiled a strange TypeScript error related to the href. 🤷 I wasn't able to find a reasonable explanation, so I'm leaving it for now.

Copy link
Contributor

@fredrikekelund fredrikekelund left a comment

Choose a reason for hiding this comment

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

Looking good and tests well 👍 Thanks for the update and sorry for my delayed second review, @m1r0

@m1r0 m1r0 merged commit 9c7c53a into trunk Mar 27, 2025
13 checks passed
@m1r0 m1r0 deleted the fix/mailbox-list-background-and-position branch March 27, 2025 11:23
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Mar 27, 2025
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.

Incorrect background color and position of mailboxes list

3 participants