Skip to content

Commit d1e155f

Browse files
Revert "Add copy button to JSON & fix button styles override."
This reverts commit c48670f.
1 parent c48670f commit d1e155f

File tree

4 files changed

+33
-27
lines changed

4 files changed

+33
-27
lines changed

client/src/components/JsonView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const JsonView = memo(
3333
: data;
3434

3535
return (
36-
<div className="font-mono text-sm transition-all duration-300">
36+
<div className="font-mono text-sm transition-all duration-300 ">
3737
<JsonNode
3838
data={normalizedData as JsonValue}
3939
name={name}

client/src/components/ToolsTab.tsx

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ import {
1313
ListToolsResult,
1414
Tool,
1515
} from "@modelcontextprotocol/sdk/types.js";
16-
import { AlertCircle, Copy, Send, CheckCheck } from "lucide-react";
17-
import { useCallback, useEffect, useState } from "react";
16+
import { AlertCircle, Send } from "lucide-react";
17+
import { useEffect, useState } from "react";
1818
import ListPane from "./ListPane";
1919
import JsonView from "./JsonView";
20-
import { toast } from 'react-toastify'
2120

2221
const ToolsTab = ({
2322
tools,
@@ -45,20 +44,6 @@ const ToolsTab = ({
4544
setParams({});
4645
}, [selectedTool]);
4746

48-
const [copied, setCopied] = useState(false)
49-
50-
const handleCopy = useCallback(() => {
51-
try {
52-
navigator.clipboard.writeText(JSON.stringify(toolResult))
53-
setCopied(true)
54-
setTimeout(() => {
55-
setCopied(false)
56-
}, 500)
57-
} catch (error) {
58-
toast.error(`There was an error coping result into the clipboard: ${error instanceof Error ? error.message : String(error)}`)
59-
}
60-
}, [toolResult])
61-
6247
const renderToolResult = () => {
6348
if (!toolResult) return null;
6449

@@ -68,8 +53,7 @@ const ToolsTab = ({
6853
return (
6954
<>
7055
<h4 className="font-semibold mb-2">Invalid Tool Result:</h4>
71-
<div className="p-4 border rounded relative">
72-
<Copy className="size-4 text-primary" />
56+
<div className="p-4 border rounded">
7357
<JsonView data={toolResult} />
7458
</div>
7559
<h4 className="font-semibold mb-2">Errors:</h4>
@@ -92,12 +76,7 @@ const ToolsTab = ({
9276
{structuredResult.content.map((item, index) => (
9377
<div key={index} className="mb-2">
9478
{item.type === "text" && (
95-
<div className="p-4 border rounded relative">
96-
<Button size="icon" variant="ghost" className="absolute top-2 right-2" onClick={handleCopy}>
97-
{copied ?
98-
<CheckCheck className="size-4 dark:text-green-700 text-green-600" />
99-
: <Copy className="size-4 text-foreground" />}
100-
</Button>
79+
<div className="p-4 border rounded">
10180
<JsonView data={item.text} />
10281
</div>
10382
)}
@@ -255,7 +234,7 @@ const ToolsTab = ({
255234
...params,
256235
[key]:
257236
prop.type === "number" ||
258-
prop.type === "integer"
237+
prop.type === "integer"
259238
? Number(e.target.value)
260239
: e.target.value,
261240
})

client/src/components/__tests__/ToolsTab.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ describe("ToolsTab", () => {
8181
expect(newInput.value).toBe("");
8282
});
8383

84+
8485
it("should display error message when error prop is provided", () => {
8586
const errorMessage = "Test error message";
8687
renderToolsTab({

client/src/index.css

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,29 @@ h1 {
3838
line-height: 1.1;
3939
}
4040

41+
button {
42+
border-radius: 8px;
43+
border: 1px solid transparent;
44+
padding: 0.6em 1.2em;
45+
font-size: 1em;
46+
font-weight: 500;
47+
font-family: inherit;
48+
background-color: #1a1a1a;
49+
cursor: pointer;
50+
transition: border-color 0.25s;
51+
}
52+
button:hover {
53+
border-color: #646cff;
54+
}
55+
button:focus,
56+
button:focus-visible {
57+
outline: 4px auto -webkit-focus-ring-color;
58+
}
59+
60+
button[role="checkbox"] {
61+
padding: 0;
62+
}
63+
4164
@media (prefers-color-scheme: light) {
4265
:root {
4366
color: #213547;
@@ -46,6 +69,9 @@ h1 {
4669
a:hover {
4770
color: #747bff;
4871
}
72+
button {
73+
background-color: #f9f9f9;
74+
}
4975
}
5076

5177
@layer base {

0 commit comments

Comments
 (0)