|
1 | | -import { useEffect, useState } from "react"; |
| 1 | +import { useEffect, useState } from 'react'; |
2 | 2 |
|
3 | | -import { MonacoEditor } from "#/monaco"; |
| 3 | +import { MonacoEditor } from '#/monaco'; |
4 | 4 |
|
5 | 5 | async function fetchDataclipContent(dataclipId: string) { |
6 | 6 | try { |
7 | 7 | const response = await fetch(`/dataclip/body/${dataclipId}`); |
8 | 8 | if (!response.ok && response.status !== 304) { |
9 | | - throw new Error("Network response was not ok"); |
| 9 | + throw new Error('Network response was not ok'); |
10 | 10 | } |
11 | 11 |
|
12 | 12 | return await response.text(); |
13 | 13 | } 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'; |
16 | 16 | } |
17 | 17 | } |
18 | 18 |
|
19 | 19 | export const DataclipViewer = ({ dataclipId }: { dataclipId: string }) => { |
20 | | - const [content, setContent] = useState<string>(""); |
| 20 | + const [content, setContent] = useState<string>(''); |
21 | 21 | const [copied, setCopied] = useState(false); |
22 | 22 |
|
23 | 23 | useEffect(() => { |
@@ -53,19 +53,19 @@ export const DataclipViewer = ({ dataclipId }: { dataclipId: string }) => { |
53 | 53 | return; |
54 | 54 | }) |
55 | 55 | .catch((error: unknown) => { |
56 | | - console.error("Failed to copy:", error); |
| 56 | + console.error('Failed to copy:', error); |
57 | 57 | }); |
58 | 58 | } |
59 | 59 | }; |
60 | 60 |
|
61 | 61 | return ( |
62 | 62 | <div className="h-full relative"> |
63 | | - {content && content !== "Failed to load content" && ( |
| 63 | + {content && content !== 'Failed to load content' && ( |
64 | 64 | <button |
65 | 65 | onClick={handleCopy} |
66 | 66 | 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'} |
69 | 69 | > |
70 | 70 | {copied ? ( |
71 | 71 | <svg |
@@ -110,13 +110,13 @@ export const DataclipViewer = ({ dataclipId }: { dataclipId: string }) => { |
110 | 110 | scrollBeyondLastLine: false, |
111 | 111 | overviewRulerLanes: 0, |
112 | 112 | overviewRulerBorder: false, |
113 | | - fontFamily: "Fira Code VF", |
| 113 | + fontFamily: 'Fira Code VF', |
114 | 114 | fontSize: 14, |
115 | 115 | fontLigatures: true, |
116 | 116 | minimap: { |
117 | 117 | enabled: false, |
118 | 118 | }, |
119 | | - wordWrap: "on", |
| 119 | + wordWrap: 'on', |
120 | 120 | }} |
121 | 121 | /> |
122 | 122 | </div> |
|
0 commit comments