Repository navigation
feat(ui): add reusable BetaBadge and use it for Projects sidebar item #33449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ryan-crabbe-berri
merged 6 commits into
litellm_internal_staging
from
litellm_remove_projects_new_badge
Jul 15, 2026
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
626adc4
fix(ui): remove New badge from Projects sidebar item
ryan-crabbe-berri b8a6473
feat(ui): add reusable BetaBadge and use it for Projects sidebar item
ryan-crabbe-berri e216413
feat(ui): rename disableShowNewBadge flag to disableShowBadges and ma…
ryan-crabbe-berri 01f17f8
style(ui): use blue for BetaBadge to match existing New badge
ryan-crabbe-berri ced7ce2
revert(ui): keep disableShowNewBadge localStorage key to preserve exi…
ryan-crabbe-berri a15af8a
chore: remove non-functional md artifacts from PR
ryan-crabbe-berri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| import { render, screen } from "@testing-library/react"; | ||
| import { describe, it, expect, vi, beforeEach } from "vitest"; | ||
| import BetaBadge from "./BetaBadge"; | ||
|
|
||
| // Mock the hook directly | ||
| vi.mock("@/app/(dashboard)/hooks/useDisableShowBadges", () => ({ | ||
| useDisableShowBadges: vi.fn(), | ||
| })); | ||
|
|
||
| import { useDisableShowBadges } from "@/app/(dashboard)/hooks/useDisableShowBadges"; | ||
|
|
||
| const mockUseDisableShowBadges = vi.mocked(useDisableShowBadges); | ||
|
|
||
| describe("BetaBadge", () => { | ||
| beforeEach(() => { | ||
| vi.clearAllMocks(); | ||
| }); | ||
|
|
||
| it("should render the badge when disableShowBadges is false", () => { | ||
| mockUseDisableShowBadges.mockReturnValue(false); | ||
|
|
||
| render(<BetaBadge>Test Content</BetaBadge>); | ||
|
|
||
| expect(screen.getByText("Beta")).toBeInTheDocument(); | ||
| expect(screen.getByText("Test Content")).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it("should render the badge when disableShowBadges is not set", () => { | ||
| mockUseDisableShowBadges.mockReturnValue(false); | ||
|
|
||
| render(<BetaBadge />); | ||
|
|
||
| expect(screen.getByText("Beta")).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it("should render only children when disableShowBadges is true", () => { | ||
| mockUseDisableShowBadges.mockReturnValue(true); | ||
|
|
||
| render(<BetaBadge>Test Content</BetaBadge>); | ||
|
|
||
| expect(screen.queryByText("Beta")).not.toBeInTheDocument(); | ||
| expect(screen.getByText("Test Content")).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it("should render nothing when disableShowBadges is true and no children", () => { | ||
| mockUseDisableShowBadges.mockReturnValue(true); | ||
|
|
||
| const { container } = render(<BetaBadge />); | ||
|
|
||
| expect(container.firstChild).toBeNull(); | ||
| }); | ||
|
|
||
| it("should render badge with dot instead of text when dot prop is true", () => { | ||
| mockUseDisableShowBadges.mockReturnValue(false); | ||
|
|
||
| render(<BetaBadge dot={true}>Test Content</BetaBadge>); | ||
|
|
||
| expect(screen.queryByText("Beta")).not.toBeInTheDocument(); | ||
| expect(screen.getByText("Test Content")).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it("should render badge with 'Beta' text when dot prop is not provided (defaults to false)", () => { | ||
| mockUseDisableShowBadges.mockReturnValue(false); | ||
|
|
||
| render(<BetaBadge>Test Content</BetaBadge>); | ||
|
|
||
| expect(screen.getByText("Beta")).toBeInTheDocument(); | ||
| expect(screen.getByText("Test Content")).toBeInTheDocument(); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { Badge } from "antd"; | ||
| import { useDisableShowBadges } from "@/app/(dashboard)/hooks/useDisableShowBadges"; | ||
|
|
||
| export default function BetaBadge({ children, dot = false }: { children?: React.ReactNode; dot?: boolean }) { | ||
| const disableShowBadges = useDisableShowBadges(); | ||
|
|
||
| if (disableShowBadges) { | ||
| return children ? <>{children}</> : null; | ||
| } | ||
|
|
||
| return children ? ( | ||
| <Badge color="gold" count={dot ? undefined : "Beta"} dot={dot}> | ||
| {children} | ||
| </Badge> | ||
| ) : ( | ||
| <Badge color="gold" count={dot ? undefined : "Beta"} dot={dot} /> | ||
| ); | ||
| } | ||
|
greptile-apps[bot] marked this conversation as resolved.
Resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.