Skip to content

UI: New side nav styles, abstractions - #30568

Merged
jacobshandling merged 7 commits into
mainfrom
16846-new-settings-side-styles
Jul 7, 2025
Merged

UI: New side nav styles, abstractions#30568
jacobshandling merged 7 commits into
mainfrom
16846-new-settings-side-styles

Conversation

@jacobshandling

@jacobshandling jacobshandling commented Jul 4, 2025

Copy link
Copy Markdown
Contributor

#16846

Demo

  • Changes file added for user-visible changes in changes/
  • Manual QA for all new/changed functionality

Summary by CodeRabbit

  • New Features

    • Added tooltips to navigation and category menu items for improved accessibility and clarity.
    • Introduced a new optional tooltip position setting, allowing tooltips to appear on any side of the element.
    • Expanded the color palette with a new light shade option.
  • Style

    • Refactored navigation and category menu styles to use centralized, reusable mixins for a more consistent appearance.
    • Updated navigation and category menu layouts for better structure and maintainability.
  • Chores

    • Added new SCSS mixins for navigation styling, improving code maintainability and consistency.

@coderabbitai

coderabbitai Bot commented Jul 4, 2025

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

Walkthrough

This update introduces two new SCSS mixins, side-nav-list and side-nav-item, centralizing and standardizing navigation styles. Components using side navigation and category menus are refactored to use these mixins. Tooltips are added for truncated text in navigation items and category menus, with customizable tooltip positions. A new color variable is added for UI consistency. Test assertions for integration page labels and tooltips are also updated.

Changes

File(s) Change Summary
frontend/styles/var/mixins.scss Added side-nav-list and side-nav-item SCSS mixins for reusable navigation styles.
frontend/pages/admin/components/SideNav/_styles.scss
frontend/pages/admin/components/SideNavItem/_styles.scss
frontend/pages/hosts/details/cards/Software/SelfService/CategoriesMenu/_styles.scss
Replaced explicit style rules with mixin includes for navigation and category menu components.
frontend/pages/hosts/details/cards/Software/SelfService/_styles.scss Adjusted responsive styles for .categories-menu, removing some properties at the medium breakpoint.
frontend/styles/var/colors.scss
frontend/styles/var/colors.ts
Added new color variable and color entry for ui-fleet-black-5 (#f4f4f6).
frontend/components/TooltipTruncatedText/TooltipTruncatedText.tsx Added optional tooltipPosition prop to allow tooltip placement customization.
frontend/pages/admin/components/SideNavItem/SideNavItem.tsx Updated to use tooltip for titles and refactored active class application.
frontend/pages/hosts/details/cards/Software/SelfService/CategoriesMenu/CategoriesMenu.tsx Changed structure to use <ul>/<li>, added tooltips for category labels, and updated active styling.
changes/16846-update-side-nav-styles Added a comment noting the update to side navigation styles.
frontend/pages/admin/IntegrationsPage/IntegrationPage.tests.tsx Updated test assertions to expect multiple occurrences of sidenav labels and tooltips.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SideNavItem
    participant TooltipTruncatedText

    User->>SideNavItem: Render navigation item
    SideNavItem->>TooltipTruncatedText: Render title with tooltip (position: right)
    TooltipTruncatedText-->>User: Displays title with tooltip on hover
Loading
sequenceDiagram
    participant User
    participant CategoriesMenu
    participant TooltipTruncatedText

    User->>CategoriesMenu: Render categories menu
    CategoriesMenu->>TooltipTruncatedText: Render category label with tooltip (position: right)
    TooltipTruncatedText-->>User: Displays label with tooltip on hover
Loading

Poem

In the warren of code, a nav hops anew,
With mixins for style—so clean, so true!
Tooltips now flutter on titles and tags,
And a softer black shade in the palette now brags.
From lists to links, all tidy and bright—
This rabbit approves: the side-nav feels right!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7eeccba and dc24ac9.

📒 Files selected for processing (1)
  • frontend/pages/admin/IntegrationsPage/IntegrationPage.tests.tsx (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai

coderabbitai Bot commented Jul 4, 2025

Copy link
Copy Markdown
Contributor

Caution

No docstrings were generated.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (2)
frontend/styles/var/mixins.scss (1)

408-411: Consider making sticky positioning configurable.

The hard-coded top: 217px value could become a maintenance burden. Consider implementing this as a mixin parameter or calculating it dynamically when feasible.

@mixin side-nav-list($sticky-top: 217px) {
  // ...
  top: $sticky-top;
  // ...
}
changes/16846-update-side-nav-styles (1)

1-1: Fix typo in changelog entry.

There's a typo in "side nave" - it should be "side nav".

-* Update side nave styles across the app
+* Update side nav styles across the app
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2d5d69f and e2a5d64.

📒 Files selected for processing (11)
  • changes/16846-update-side-nav-styles (1 hunks)
  • frontend/components/TooltipTruncatedText/TooltipTruncatedText.tsx (3 hunks)
  • frontend/pages/admin/components/SideNav/_styles.scss (1 hunks)
  • frontend/pages/admin/components/SideNavItem/SideNavItem.tsx (2 hunks)
  • frontend/pages/admin/components/SideNavItem/_styles.scss (1 hunks)
  • frontend/pages/hosts/details/cards/Software/SelfService/CategoriesMenu/CategoriesMenu.tsx (2 hunks)
  • frontend/pages/hosts/details/cards/Software/SelfService/CategoriesMenu/_styles.scss (1 hunks)
  • frontend/pages/hosts/details/cards/Software/SelfService/_styles.scss (0 hunks)
  • frontend/styles/var/colors.scss (1 hunks)
  • frontend/styles/var/colors.ts (1 hunks)
  • frontend/styles/var/mixins.scss (1 hunks)
💤 Files with no reviewable changes (1)
  • frontend/pages/hosts/details/cards/Software/SelfService/_styles.scss
🧰 Additional context used
🧬 Code Graph Analysis (1)
frontend/pages/hosts/details/cards/Software/SelfService/CategoriesMenu/CategoriesMenu.tsx (1)
frontend/pages/hosts/details/cards/Software/SelfService/helpers.tsx (1)
  • ICategory (5-12)
🪛 Biome (1.9.4)
frontend/pages/hosts/details/cards/Software/SelfService/CategoriesMenu/CategoriesMenu.tsx

[error] 33-37: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (go)
  • GitHub Check: build-binaries
  • GitHub Check: test-js (ubuntu-latest)
  • GitHub Check: lint-js (ubuntu-latest)
  • GitHub Check: publish
  • GitHub Check: build-and-check
🔇 Additional comments (17)
frontend/styles/var/colors.ts (1)

17-17: LGTM! Color addition follows established conventions.

The new ui-fleet-black-5 color with hex value #F4F4F6 follows the existing naming pattern and fits appropriately in the gray scale sequence.

frontend/components/TooltipTruncatedText/TooltipTruncatedText.tsx (3)

18-18: Good addition with proper typing.

The tooltipPosition prop provides flexibility for tooltip placement while maintaining backward compatibility.


28-28: Excellent default value choice.

Setting the default to "top" maintains backward compatibility for existing usages while enabling new positioning options.


47-47: Proper prop utilization.

The tooltipPosition prop is correctly passed to the ReactTooltip component's place attribute.

frontend/styles/var/mixins.scss (3)

405-420: Well-implemented mixin with centralized navigation styling.

The side-nav-list mixin effectively centralizes side navigation styling. The sticky positioning and dimensions are appropriate for the current use case.


422-452: Comprehensive item styling with good hover/active states.

The side-nav-item mixin provides complete styling for navigation items including proper hover states and active styling. The font-weight reset for nested tooltip components is a thoughtful touch.


447-449: Smart handling of nested tooltip font-weight.

The font-weight reset for .__react_component_tooltip within active navigation items prevents inheritance issues with tooltip styling.

frontend/styles/var/colors.scss (1)

19-19: Perfect consistency between SCSS and TypeScript color definitions.

The $ui-fleet-black-5 variable matches the TypeScript definition exactly, maintaining consistency across the codebase.

frontend/pages/admin/components/SideNav/_styles.scss (1)

7-7: LGTM! Good refactoring for consistency.

The use of the side-nav-list mixin centralizes navigation styling and improves maintainability across the application.

frontend/pages/admin/components/SideNavItem/_styles.scss (1)

2-2: LGTM! Consistent with the refactoring pattern.

The use of the side-nav-item mixin aligns with the overall refactoring to centralize navigation styling.

frontend/pages/admin/components/SideNavItem/SideNavItem.tsx (3)

4-4: Good addition for tooltip functionality.

The import of TooltipTruncatedText supports the new tooltip feature for truncated navigation items.


15-17: Improved class application logic.

Moving the active class application to the li wrapper element is semantically correct and aligns with the new HTML structure.


20-24: Excellent semantic HTML improvement and UX enhancement.

The changes provide multiple benefits:

  • Using <li> as the wrapper element improves semantic HTML structure
  • Nesting <Link> inside <li> follows proper list semantics
  • Adding TooltipTruncatedText with right-positioned tooltip enhances UX for truncated navigation items
frontend/pages/hosts/details/cards/Software/SelfService/CategoriesMenu/_styles.scss (1)

2-4: LGTM! Consistent mixin usage.

The use of both side-nav-list and side-nav-item mixins maintains consistency with the navigation styling refactoring across the application.

frontend/pages/hosts/details/cards/Software/SelfService/CategoriesMenu/CategoriesMenu.tsx (3)

5-5: Good addition for tooltip functionality.

The import supports the tooltip feature for truncated category labels.


26-26: Excellent semantic HTML improvement.

Changing from <div> to <ul> provides proper semantic markup for the categories list.

Also applies to: 56-56


51-51: Great UX enhancement with tooltip integration.

The TooltipTruncatedText with right-positioned tooltip improves the user experience for truncated category labels.

@codecov

codecov Bot commented Jul 4, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 64.07%. Comparing base (dbd6a23) to head (dc24ac9).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...pages/admin/components/SideNavItem/SideNavItem.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #30568      +/-   ##
==========================================
- Coverage   64.07%   64.07%   -0.01%     
==========================================
  Files        1878     1878              
  Lines      184482   184441      -41     
  Branches     5399     5318      -81     
==========================================
- Hits       118213   118179      -34     
+ Misses      56948    56945       -3     
+ Partials     9321     9317       -4     
Flag Coverage Δ
frontend 53.49% <75.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jacobshandling jacobshandling linked an issue Jul 4, 2025 that may be closed by this pull request
19 tasks
@jacobshandling jacobshandling changed the title UI: New settings side styles UI: New side nav styles, abstractions Jul 4, 2025

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 0

🧹 Nitpick comments (3)
frontend/pages/admin/IntegrationsPage/IntegrationPage.tests.tsx (3)

30-33: Fix typo in comment and consider test approach.

The test logic correctly reflects the addition of tooltip functionality, but there's a typo in the comment.

Apply this diff to fix the typo:

-      // sidenave label, sidenav tooltip, and card header
+      // sidenav label, sidenav tooltip, and card header

The updated assertion count (3 occurrences) correctly accounts for the new tooltip functionality where the text appears in both the sidenav label and tooltip, plus the card header.


72-73: Fix typo in comment.

The test logic correctly reflects the tooltip functionality, but there's a typo in the comment.

Apply this diff to fix the typo:

-      // sidenave label, sidenav tooltip
+      // sidenav label, sidenav tooltip

The updated assertion count (2 occurrences) correctly accounts for the text appearing in both the sidenav label and tooltip.


30-33: Consider testing tooltip functionality at the component level.

While these test updates correctly reflect the UI changes, they're now testing implementation details (that tooltips duplicate text) rather than user behavior. Consider whether tooltip functionality should be tested in component-specific tests for SideNavItem or TooltipTruncatedText rather than in integration tests.

This approach makes the integration tests more brittle as they depend on tooltip implementation details. Component-level tests might be more appropriate for verifying tooltip behavior.

Also applies to: 72-73

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e2a5d64 and 7eeccba.

📒 Files selected for processing (2)
  • frontend/pages/admin/IntegrationsPage/IntegrationPage.tests.tsx (3 hunks)
  • frontend/pages/hosts/details/cards/Software/SelfService/CategoriesMenu/CategoriesMenu.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/pages/hosts/details/cards/Software/SelfService/CategoriesMenu/CategoriesMenu.tsx
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: build-binaries
  • GitHub Check: publish

@ghernandez345 ghernandez345 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.

@jacobshandling just had a quick question about the use of SideNav on the My Device page

Comment thread frontend/pages/admin/IntegrationsPage/IntegrationPage.tests.tsx Outdated
width: 232px;

// Matches styling in DropdownWrapper > options
@include side-nav-list;

@ghernandez345 ghernandez345 Jul 7, 2025

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.

Is it possible to use the actual SideNav component in this location instead of just using the styles? Would allow us to keep the styles in one place instead of pulling them away from the component.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agree that would be ideal. Implemented this way for speed and since it is an incremental improvement over the current completely decoupled implementation. Can refactor DUP to use the common component now if you feel it's important, otherwise as a further iteration the next time someone is working on this

"ui-fleet-black-33": "#B3B6C1",
"ui-fleet-black-25": "#C5C7D1",
"ui-fleet-black-10": "#E2E4EA",
"ui-fleet-black-5": "#F4F4F6",

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.

@rachaelshaw @jacobshandling notice this is a new colour used in figma but I couldn't find it in the design system. Can we add this to the design system if we'd like to start using it in designs.

ghernandez345
ghernandez345 previously approved these changes Jul 7, 2025
@jacobshandling
jacobshandling merged commit 5f820fe into main Jul 7, 2025
8 of 9 checks passed
@jacobshandling
jacobshandling deleted the 16846-new-settings-side-styles branch July 7, 2025 15:29
@coderabbitai coderabbitai Bot mentioned this pull request Oct 29, 2025
11 tasks
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.

Use new styles for side-navigation

4 participants