Skip to content

[Feature] UI - Navbar: Option to Hide Community Engagement Buttons#20308

Merged
yuneng-jiang merged 1 commit intomainfrom
litellm_ui_community_buttons
Feb 3, 2026
Merged

[Feature] UI - Navbar: Option to Hide Community Engagement Buttons#20308
yuneng-jiang merged 1 commit intomainfrom
litellm_ui_community_buttons

Conversation

@yuneng-jiang
Copy link
Collaborator

Relevant issues

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

🧹 Refactoring
✅ Test

Changes

Extracts community engagement buttons (Join Slack and Star us on GitHub) from the navbar into a separate CommunityEngagementButtons component. The component respects the useDisableShowPrompts hook to conditionally hide the buttons when prompts are disabled. Adds unit tests for the new component and updates navbar tests to mock the extracted component.

Screenshots

image image image

@vercel
Copy link

vercel bot commented Feb 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Feb 3, 2026 1:32am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 3, 2026

Greptile Overview

Greptile Summary

Refactored community engagement buttons (Join Slack and Star us on GitHub) from the navbar into a separate CommunityEngagementButtons component. The extracted component respects the existing "Hide All Prompts" user preference (disableShowPrompts hook) to conditionally hide the buttons when the user toggles this setting in their UserDropdown menu.

Key Changes

  • Created new component at ui/litellm-dashboard/src/components/Navbar/CommunityEngagementButtons/CommunityEngagementButtons.tsx
  • Added comprehensive unit tests following the project's Vitest and React Testing Library conventions
  • Updated navbar to use the new component, removing inline button definitions and unused icon imports
  • Refactored navbar tests to mock the extracted component, eliminating duplicate test coverage

Implementation Details

The refactor maintains identical functionality while improving code organization. The useDisableShowPrompts hook uses useSyncExternalStore to track the disableShowPrompts localStorage setting, ensuring reactive updates when users toggle the preference. All existing buttons maintain their external links, security attributes (target="_blank", rel="noopener noreferrer"), and styling.

Confidence Score: 5/5

  • This PR is safe to merge with no risk - pure refactoring with comprehensive tests
  • Clean component extraction with no functional changes, comprehensive test coverage following project conventions, proper mocking patterns, and all existing functionality preserved
  • No files require special attention

Important Files Changed

Filename Overview
ui/litellm-dashboard/src/components/Navbar/CommunityEngagementButtons/CommunityEngagementButtons.tsx Extracted community engagement buttons into separate component with conditional rendering based on disableShowPrompts setting
ui/litellm-dashboard/src/components/Navbar/CommunityEngagementButtons/CommunityEngagementButtons.test.tsx Added comprehensive unit tests for the new component with proper mocking and coverage of all scenarios
ui/litellm-dashboard/src/components/navbar.tsx Replaced inline buttons with CommunityEngagementButtons component, removed unused imports
ui/litellm-dashboard/src/components/navbar.test.tsx Updated tests to mock the extracted component, removed duplicate tests now covered by component-specific tests

Sequence Diagram

sequenceDiagram
    participant User
    participant UserDropdown
    participant LocalStorage
    participant CommunityEngagementButtons
    participant useDisableShowPrompts

    User->>UserDropdown: Toggle "Hide All Prompts"
    UserDropdown->>LocalStorage: setItem("disableShowPrompts", "true")
    UserDropdown->>LocalStorage: emitLocalStorageChange("disableShowPrompts")
    LocalStorage->>useDisableShowPrompts: Trigger storage event
    useDisableShowPrompts->>CommunityEngagementButtons: Re-render with disableShowPrompts=true
    CommunityEngagementButtons->>User: Buttons hidden (return null)
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

4 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@yuneng-jiang yuneng-jiang merged commit 9202870 into main Feb 3, 2026
49 of 65 checks passed
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.

1 participant