Skip to content

Commit be564db

Browse files
committed
feat: resolve tooltip overflow
1 parent dfb2ec5 commit be564db

File tree

2 files changed

+39
-19
lines changed

2 files changed

+39
-19
lines changed

assets/js/collaborative-editor/components/manual-run/SelectedDataclipView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export function SelectedDataclipView({
144144
)}
145145

146146
{/* Body Preview */}
147-
<div className="flex-1 overflow-hidden">
147+
<div className="flex-1">
148148
<DataclipViewer dataclipId={dataclip.id} />
149149
</div>
150150
</div>

assets/js/react/components/DataclipViewer.tsx

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
import { useEffect, useState } from 'react';
1+
import { useEffect, useState } from "react";
22

3-
import { MonacoEditor } from '#/monaco';
3+
import { MonacoEditor } from "#/monaco";
44

55
async function fetchDataclipContent(dataclipId: string) {
66
try {
77
const response = await fetch(`/dataclip/body/${dataclipId}`);
88
if (!response.ok && response.status !== 304) {
9-
throw new Error('Network response was not ok');
9+
throw new Error("Network response was not ok");
1010
}
1111

1212
return await response.text();
1313
} catch (error) {
14-
console.error('Error fetching content:', error);
15-
return 'Failed to load content';
14+
console.error("Error fetching content:", error);
15+
return "Failed to load content";
1616
}
1717
}
1818

1919
export const DataclipViewer = ({ dataclipId }: { dataclipId: string }) => {
20-
const [content, setContent] = useState<string>('');
20+
const [content, setContent] = useState<string>("");
2121
const [copied, setCopied] = useState(false);
2222

2323
useEffect(() => {
24-
void fetchDataclipContent(dataclipId).then((rawContent) => {
24+
void fetchDataclipContent(dataclipId).then(rawContent => {
2525
// Format JSON once when it loads
2626
try {
2727
const parsed = JSON.parse(rawContent);
@@ -53,27 +53,47 @@ export const DataclipViewer = ({ dataclipId }: { dataclipId: string }) => {
5353
return;
5454
})
5555
.catch((error: unknown) => {
56-
console.error('Failed to copy:', error);
56+
console.error("Failed to copy:", error);
5757
});
5858
}
5959
};
6060

6161
return (
62-
<div className='h-full relative overflow-hidden'>
63-
{content && content !== 'Failed to load content' && (
62+
<div className="h-full relative">
63+
{content && content !== "Failed to load content" && (
6464
<button
6565
onClick={handleCopy}
6666
className="absolute top-3 right-3 z-10 p-1.5 rounded text-gray-400 hover:text-gray-600 hover:bg-gray-100/80 focus:outline-none transition-colors"
67-
title={copied ? 'Copied!' : 'Copy to clipboard'}
68-
aria-label={copied ? 'Copied to clipboard' : 'Copy to clipboard'}
67+
title={copied ? "Copied!" : "Copy to clipboard"}
68+
aria-label={copied ? "Copied to clipboard" : "Copy to clipboard"}
6969
>
7070
{copied ? (
71-
<svg className="w-4 h-4 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
72-
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" />
71+
<svg
72+
className="w-4 h-4 text-green-600"
73+
fill="none"
74+
stroke="currentColor"
75+
viewBox="0 0 24 24"
76+
>
77+
<path
78+
strokeLinecap="round"
79+
strokeLinejoin="round"
80+
strokeWidth={2}
81+
d="M5 13l4 4L19 7"
82+
/>
7383
</svg>
7484
) : (
75-
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
76-
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z" />
85+
<svg
86+
className="w-4 h-4"
87+
fill="none"
88+
stroke="currentColor"
89+
viewBox="0 0 24 24"
90+
>
91+
<path
92+
strokeLinecap="round"
93+
strokeLinejoin="round"
94+
strokeWidth={2}
95+
d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"
96+
/>
7797
</svg>
7898
)}
7999
</button>
@@ -90,13 +110,13 @@ export const DataclipViewer = ({ dataclipId }: { dataclipId: string }) => {
90110
scrollBeyondLastLine: false,
91111
overviewRulerLanes: 0,
92112
overviewRulerBorder: false,
93-
fontFamily: 'Fira Code VF',
113+
fontFamily: "Fira Code VF",
94114
fontSize: 14,
95115
fontLigatures: true,
96116
minimap: {
97117
enabled: false,
98118
},
99-
wordWrap: 'on',
119+
wordWrap: "on",
100120
}}
101121
/>
102122
</div>

0 commit comments

Comments
 (0)