Skip to content

Commit 18ca6e2

Browse files
committed
Use <pre> tag inside JsonView component for consistency
1 parent 2d252a3 commit 18ca6e2

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

client/src/components/History.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ const HistoryAndNotifications = ({
7575
<Copy size={16} />
7676
</button>
7777
</div>
78-
<pre className="whitespace-pre-wrap break-words bg-background p-2 rounded">
78+
<div className="bg-background p-2 rounded">
7979
<JsonView data={request.request} />
80-
</pre>
80+
</div>
8181
</div>
8282
{request.response && (
8383
<div className="mt-2">
@@ -92,9 +92,9 @@ const HistoryAndNotifications = ({
9292
<Copy size={16} />
9393
</button>
9494
</div>
95-
<pre className="whitespace-pre-wrap break-words bg-background p-2 rounded">
95+
<div className="bg-background p-2 rounded">
9696
<JsonView data={request.response} />
97-
</pre>
97+
</div>
9898
</div>
9999
)}
100100
</>
@@ -143,11 +143,11 @@ const HistoryAndNotifications = ({
143143
<Copy size={16} />
144144
</button>
145145
</div>
146-
<pre className="whitespace-pre-wrap break-words bg-background p-2 rounded">
146+
<div className="bg-background p-2 rounded">
147147
<JsonView
148148
data={JSON.stringify(notification, null, 2)}
149149
/>
150-
</pre>
150+
</div>
151151
</div>
152152
)}
153153
</li>

client/src/components/JsonView.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const JsonNode = memo(
7171
boolean: "text-amber-600",
7272
null: "text-purple-600",
7373
undefined: "text-gray-600",
74-
string: "text-green-600 break-all",
74+
string: "text-green-600 break-all whitespace-pre-wrap",
7575
default: "text-gray-700",
7676
};
7777

@@ -174,7 +174,7 @@ const JsonNode = memo(
174174
{name}:
175175
</span>
176176
)}
177-
<p className={typeStyleMap.string}>"{value}"</p>
177+
<pre className={typeStyleMap.string}>"{value}"</pre>
178178
</div>
179179
);
180180
}
@@ -186,7 +186,7 @@ const JsonNode = memo(
186186
{name}:
187187
</span>
188188
)}
189-
<span
189+
<pre
190190
className={clsx(
191191
typeStyleMap.string,
192192
"cursor-pointer group-hover:text-green-500",
@@ -195,7 +195,7 @@ const JsonNode = memo(
195195
title={isExpanded ? "Click to collapse" : "Click to expand"}
196196
>
197197
{isExpanded ? `"${value}"` : `"${value.slice(0, maxLength)}..."`}
198-
</span>
198+
</pre>
199199
</div>
200200
);
201201
};

client/src/components/ResourcesTab.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ const ResourcesTab = ({
215215
<AlertDescription>{error}</AlertDescription>
216216
</Alert>
217217
) : selectedResource ? (
218-
<pre className="bg-gray-50 dark:bg-gray-800 p-4 rounded text-sm overflow-auto max-h-96 whitespace-pre-wrap break-words text-gray-900 dark:text-gray-100">
218+
<div className="bg-gray-50 dark:bg-gray-800 p-4 rounded text-sm overflow-auto max-h-96 text-gray-900 dark:text-gray-100">
219219
<JsonView data={resourceContent} />
220-
</pre>
220+
</div>
221221
) : selectedTemplate ? (
222222
<div className="space-y-4">
223223
<p className="text-sm text-gray-600">

client/src/components/SamplingTab.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ const SamplingTab = ({ pendingRequests, onApprove, onReject }: Props) => {
4444
<h3 className="text-lg font-semibold">Recent Requests</h3>
4545
{pendingRequests.map((request) => (
4646
<div key={request.id} className="p-4 border rounded-lg space-y-4">
47-
<pre className="bg-gray-50 dark:bg-gray-800 dark:text-gray-100 p-2 rounded">
47+
<div className="bg-gray-50 dark:bg-gray-800 dark:text-gray-100 p-2 rounded">
4848
<JsonView data={JSON.stringify(request.request)} />
49-
</pre>
49+
</div>
5050
<div className="flex space-x-2">
5151
<Button onClick={() => handleApprove(request.id)}>Approve</Button>
5252
<Button variant="outline" onClick={() => onReject(request.id)}>

0 commit comments

Comments
 (0)