π OpenHands: AI-Driven Development
refactor(theme): use status classes for icons and diff counts (#18641)
Engel Nyst2a0806d8200f
diff --git a/__tests__/components/chat/error-message-banner.test.tsx b/__tests__/components/chat/error-message-banner.test.tsxindex 807ace04f1..ea6b538c4c 100644--- a/__tests__/components/chat/error-message-banner.test.tsx+++ b/__tests__/components/chat/error-message-banner.test.tsx@@ -47,11 +47,10 @@ describe("ErrorMessageBanner", () => {expect(onRetry).toHaveBeenCalledTimes(1);});- it("shows a red error icon beside the message", () => {+ it("shows an error icon beside the message", () => {render(<ErrorMessageBanner message="Something went wrong" />);- const icon = screen.getByTestId("error-message-banner-icon");- expect(icon).toHaveStyle({ color: "var(--oh-status-error)" });+ expect(screen.getByTestId("error-message-banner-icon")).toBeInTheDocument();});it("uses a warning icon for non-internal outcomes", () => {@@ -83,9 +82,7 @@ describe("ErrorMessageBanner", () => {/>,);- expect(screen.getByTestId("error-message-banner-icon")).toHaveStyle({- color: "var(--oh-status-error)",- });+ expect(screen.getByTestId("error-message-banner-icon")).toBeInTheDocument();});it("uses the error icon for unknown (diagnostic) outcomes", () => {@@ -100,9 +97,7 @@ describe("ErrorMessageBanner", () => {/>,);- expect(screen.getByTestId("error-message-banner-icon")).toHaveStyle({- color: "var(--oh-status-error)",- });+ expect(screen.getByTestId("error-message-banner-icon")).toBeInTheDocument();});it("uses greyscale theme tokens instead of red error styling", () => {diff --git a/src/components/features/chat/error-message-banner.tsx b/src/components/features/chat/error-message-banner.tsxindex dea19bd6dc..a2ded690cc 100644--- a/src/components/features/chat/error-message-banner.tsx+++ b/src/components/features/chat/error-message-banner.tsx@@ -1,7 +1,6 @@import React from "react";import { Trans, useTranslation } from "react-i18next";import { Check, CircleAlert, CircleX, Copy, X } from "lucide-react";-import { OH_STATUS_ERROR_COLOR } from "#/constants/status-colors";import { I18nKey } from "#/i18n/declaration";import { displayErrorToast } from "#/utils/custom-toast-handlers";import { getAcpErrorHeaderKey } from "#/utils/acp-error-codes";@@ -112,9 +111,8 @@ export function ErrorMessageBanner({) : (<CircleXaria-hidden- className="h-4 w-4 shrink-0"+ className="h-4 w-4 shrink-0 text-status-error"strokeWidth={2}- style={{ color: OH_STATUS_ERROR_COLOR }}data-testid="error-message-banner-icon"/>)}diff --git a/src/components/features/conversation/conversation-overview-diffs-row.tsx b/src/components/features/conversation/conversation-overview-diffs-row.tsxindex dcccdf46cf..3472d999f8 100644--- a/src/components/features/conversation/conversation-overview-diffs-row.tsx+++ b/src/components/features/conversation/conversation-overview-diffs-row.tsx@@ -6,10 +6,6 @@ import { useActiveConversation } from "#/hooks/query/use-active-conversation";import { useConversationOverviewGitDiffStats } from "#/hooks/use-conversation-overview-git-diff-stats";import { useSelectConversationTab } from "#/hooks/use-select-conversation-tab";import { I18nKey } from "#/i18n/declaration";-import {- OH_STATUS_ERROR_COLOR,- OH_STATUS_SUCCESS_COLOR,-} from "#/constants/status-colors";import { cn } from "#/utils/utils";import { Provider } from "#/types/settings";import { useConversationOverviewDrawerOptional } from "./conversation-overview-drawer-context";@@ -107,7 +103,7 @@ export function ConversationOverviewDiffsRow() {><spandata-testid="conversation-overview-diffs-additions"- style={{ color: OH_STATUS_SUCCESS_COLOR }}+ className="text-status-success">{t(I18nKey.CONVERSATION$OVERVIEW_DIFF_ADDITIONS, {count: additions.toLocaleString(),@@ -115,7 +111,7 @@ export function ConversationOverviewDiffsRow() {</span><spandata-testid="conversation-overview-diffs-deletions"- style={{ color: OH_STATUS_ERROR_COLOR }}+ className="text-status-error">{t(I18nKey.CONVERSATION$OVERVIEW_DIFF_DELETIONS, {count: deletions.toLocaleString(),diff --git a/src/utils/custom-toast-handlers.tsx b/src/utils/custom-toast-handlers.tsxindex 4c747c4ede..5824b7e94b 100644--- a/src/utils/custom-toast-handlers.tsx+++ b/src/utils/custom-toast-handlers.tsx@@ -1,7 +1,6 @@import React, { CSSProperties, ReactNode } from "react";import { CircleX } from "lucide-react";import toast, { ToastOptions } from "react-hot-toast";-import { OH_STATUS_ERROR_COLOR } from "#/constants/status-colors";import { calculateToastDuration } from "./toast-duration";import { cn } from "#/utils/utils";import i18n from "#/i18n";@@ -74,9 +73,8 @@ export function ErrorToastContent({ message }: { message: ReactNode }) {><CircleXaria-hidden- className="h-4 w-4 shrink-0"+ className="h-4 w-4 shrink-0 text-status-error"strokeWidth={2}- style={{ color: OH_STATUS_ERROR_COLOR }}/><spanref={contentRef}