Files
cline-multi-mirror/webview-ui/src/components/chat/ErrorBlockTitle.tsx
T
BeeandJose R. Perez e9e616e317 Replace HeroUI Tooltip with shadcn (#6872)
* Set up Tailwind v4

npx @tailwindcss/upgrade                                                                                                                                   1 ↵
≈ tailwindcss v4.1.13

│ Searching for CSS files in the current directory and its subdirectories…

│ Migrating stylesheets…

│ ↳ Migrated stylesheet: `./src/index.css`

│ Updating dependencies…

│ ↳ Updated package: `tailwindcss`

│ ↳ Updated package: `@tailwindcss/vite`

│ Migrating templates…

│ ↳ Migrated templates for: `./src/index.css`

│ Verify the changes and commit them to your repository.

* Migrate HeroUITooltip to radix-ui shadcn components

* import main.css

* Update e2e test text

* clean up

* Update mode switch test

* Fix auto approve modal z-index number

* Unify styles with theme

* fix spacing and sizes

* update logo id

* Fix e2e test

* Clean up

* npm install tailwindcss @tailwindcss/vite

* npx @tailwindcss/upgrade
≈ tailwindcss v4.1.14

│ ↳ Upgrading from Tailwind CSS `v4.1.14`

│ Searching for CSS files in the current directory and its subdirectories…

│ Migrating stylesheets…

│ ↳ Migrated stylesheet: `./webview-ui/src/index.css`

│ Updating dependencies…

│ ↳ Updated package: `tailwindcss`

│ ↳ Updated package: `@tailwindcss/vite`

│ Migrating templates…

│ ↳ Migrated templates for: `./webview-ui/src/index.css`

│ Verify the changes and commit them to your repository.

* clean up

* clean up

* Remove DRY code and update descriptionForeground class name

* Update TaskHeader classnames

* unify font size

* clean up

* update test with clear test id

* size

* Fix tooltip trigger in settings

* Apply feedback - hide arrow for autoapprove menu

* Align chat toolbox icon stylings

* update data-testid

* set

* CheckpointError

* feat: arrow alignment issues

* text-wrap tooltip

* feat: mcp tooltip arrow fix

---------

Co-authored-by: Jose R. Perez <trupix@gmail.com>
2025-10-28 09:15:29 -07:00

75 lines
2.4 KiB
TypeScript

import React from "react"
import { ClineError, ClineErrorType } from "../../../../src/services/error/ClineError"
import { ProgressIndicator } from "./ChatRow"
interface ErrorBlockTitleProps {
cost?: number
apiReqCancelReason?: string
apiRequestFailedMessage?: string
retryStatus?: {
attempt: number
maxAttempts: number
delaySec?: number
errorSnippet?: string
}
}
export const ErrorBlockTitle = ({
cost,
apiReqCancelReason,
apiRequestFailedMessage,
retryStatus,
}: ErrorBlockTitleProps): [React.ReactElement, React.ReactElement] => {
const getIconSpan = (iconName: string, colorClass: string) => (
<div className="w-4 h-4 flex items-center justify-center">
<span className={`codicon codicon-${iconName} text-base -mb-0.5 ${colorClass}`}></span>
</div>
)
const icon =
apiReqCancelReason != null ? (
apiReqCancelReason === "user_cancelled" ? (
getIconSpan("error", "text-(--vscode-descriptionForeground)")
) : (
getIconSpan("error", "text-(--vscode-errorForeground)")
)
) : cost != null ? (
getIconSpan("check", "text-(--vscode-charts-green)")
) : apiRequestFailedMessage ? (
getIconSpan("error", "text-(--vscode-errorForeground)")
) : (
<ProgressIndicator />
)
const title = (() => {
// Default loading state
const details = { title: "API Request...", classNames: ["font-bold"] }
// Handle cancellation states first
if (apiReqCancelReason === "user_cancelled") {
details.title = "API Request Cancelled"
details.classNames.push("text-(--vscode-foreground)")
} else if (apiReqCancelReason != null) {
details.title = "API Request Failed"
details.classNames.push("text-(--vscode-errorForeground)")
} else if (cost != null) {
// Handle completed request
details.title = "API Request"
details.classNames.push("text-(--vscode-foreground)")
} else if (apiRequestFailedMessage) {
// Handle failed request
const clineError = ClineError.parse(apiRequestFailedMessage)
const titleText = clineError?.isErrorType(ClineErrorType.Balance) ? "Credit Limit Reached" : "API Request Failed"
details.title = titleText
details.classNames.push("font-bold text-(--vscode-errorForeground)")
} else if (retryStatus) {
// Handle retry state
details.title = "API Request"
details.classNames.push("text-(--vscode-foreground)")
}
return <span className={details.classNames.join(" ")}>{details.title}</span>
})()
return [icon, title]
}