Skip to content

Commit a00d5fa

Browse files
committed
More cleanup
1 parent 92b6fcd commit a00d5fa

File tree

4 files changed

+27
-23
lines changed

4 files changed

+27
-23
lines changed

webview-ui/package-lock.json

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"class-variance-authority": "^0.7.1",
3737
"clsx": "^2.1.1",
3838
"cmdk": "^1.0.0",
39+
"date-fns": "^4.1.0",
3940
"debounce": "^2.1.1",
4041
"fast-deep-equal": "^3.1.3",
4142
"fzf": "^0.5.2",
Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,34 @@
1+
import { useMemo } from "react"
12
import { formatRelative } from "date-fns"
2-
import { McpErrorEntry } from "../../../../src/shared/mcp"
3+
4+
import type { McpErrorEntry } from "@roo/shared/mcp"
35

46
type McpErrorRowProps = {
57
error: McpErrorEntry
68
}
79

8-
const McpErrorRow = ({ error }: McpErrorRowProps) => {
9-
const getErrorColor = (level: string) => {
10-
switch (level) {
10+
export const McpErrorRow = ({ error }: McpErrorRowProps) => {
11+
const color = useMemo(() => {
12+
switch (error.level) {
1113
case "error":
1214
return "var(--vscode-testing-iconFailed)"
1315
case "warn":
1416
return "var(--vscode-charts-yellow)"
1517
case "info":
1618
return "var(--vscode-testing-iconPassed)"
17-
default:
18-
return "var(--vscode-testing-iconFailed)"
1919
}
20-
}
20+
}, [error.level])
2121

2222
return (
2323
<div
24-
style={{
25-
padding: "8px",
26-
borderLeft: `3px solid ${getErrorColor(error.level)}`,
27-
background: "var(--vscode-textCodeBlock-background)",
28-
borderRadius: "4px",
29-
fontSize: "13px",
30-
}}>
31-
<div style={{ marginBottom: "4px", color: getErrorColor(error.level) }}>{error.message}</div>
32-
<div
33-
style={{
34-
fontSize: "11px",
35-
color: "var(--vscode-descriptionForeground)",
36-
}}>
24+
className="p-2 rounded bg-vscode-textCodeBlock-background text-sm"
25+
style={{ borderLeft: `3px solid ${color}` }}>
26+
<div className="mb-1" style={{ color }}>
27+
{error.message}
28+
</div>
29+
<div className="text-xs text-vscode-descriptionForeground">
3730
{formatRelative(error.timestamp, new Date())}
3831
</div>
3932
</div>
4033
)
4134
}
42-
43-
export default McpErrorRow

webview-ui/src/components/mcp/McpView.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { Tab, TabContent, TabHeader } from "../common/Tab"
2020
import McpToolRow from "./McpToolRow"
2121
import McpResourceRow from "./McpResourceRow"
2222
import McpEnabledToggle from "./McpEnabledToggle"
23-
import McpErrorRow from "./McpErrorRow"
23+
import { McpErrorRow } from "./McpErrorRow"
2424

2525
type McpViewProps = {
2626
onDone: () => void
@@ -34,6 +34,7 @@ const McpView = ({ onDone }: McpViewProps) => {
3434
enableMcpServerCreation,
3535
setEnableMcpServerCreation,
3636
} = useExtensionState()
37+
3738
const { t } = useAppTranslation()
3839

3940
return (

0 commit comments

Comments
 (0)