Skip to content

Commit 0ea23b8

Browse files
authored
chore(deps): remove remove-react-syntax-highlighting (#127)
1 parent 7ff7e0d commit 0ea23b8

File tree

5 files changed

+27
-272
lines changed

5 files changed

+27
-272
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
55

66
## Unreleased
77

8+
### Dependencies
9+
810
- upgrade to tailwind v4
11+
- remove react-syntax-highlighting
912

1013
## 2.0.1
1114

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"react-day-picker": "^9.11.0",
2727
"react-dom": "^18.0.0",
2828
"react-markdown": "^10.1.0",
29-
"react-syntax-highlighter": "^15.6.6",
3029
"source-map-explorer": "^2.5.3",
3130
"styled-components": "^6.1.19",
3231
"tailwind-merge": "^3.3.1",
@@ -44,7 +43,6 @@
4443
"@types/node": "^24.6.1",
4544
"@types/react": "^18.0.0",
4645
"@types/react-dom": "^18.0.0",
47-
"@types/react-syntax-highlighter": "^15.5.13",
4846
"@vitejs/plugin-react": "^5.0.4",
4947
"depcheck": "^1.4.7",
5048
"husky": ">=6",

src/components/ApiConfigPanel.tsx

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ import { Badge } from "@/components/ui/badge";
1414
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
1515
import { Switch } from "@/components/ui/switch";
1616
import { Label } from "@/components/ui/label";
17-
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
18-
import {
19-
coldarkCold,
20-
coldarkDark,
21-
} from "react-syntax-highlighter/dist/cjs/styles/prism";
2217
import {
2318
getApiHealth,
2419
getApisLackingCapability,
@@ -63,42 +58,13 @@ interface ApiConfigPanelProps {
6358
onUpdate: (apis: string[]) => void;
6459
}
6560

66-
// Custom hook for dark mode detection
67-
const useDarkMode = () => {
68-
const [isDark, setIsDark] = useState(() => {
69-
if (typeof window === "undefined") return false;
70-
return (
71-
localStorage.getItem("theme") === "dark" ||
72-
(!localStorage.getItem("theme") &&
73-
window.matchMedia("(prefers-color-scheme: dark)").matches)
74-
);
75-
});
76-
77-
React.useEffect(() => {
78-
const observer = new MutationObserver(() => {
79-
setIsDark(document.documentElement.classList.contains("dark"));
80-
});
81-
82-
observer.observe(document.documentElement, {
83-
attributes: true,
84-
attributeFilter: ["class"],
85-
});
86-
87-
return () => observer.disconnect();
88-
}, []);
89-
90-
return isDark;
91-
};
92-
9361
const ApiConfigPanel: React.FC<ApiConfigPanelProps> = ({
9462
stacApis,
9563
onUpdate,
9664
}) => {
9765
const [isOpen, setIsOpen] = useState(false);
9866
const [isFilterInfoOpen, setIsFilterInfoOpen] = useState(false);
99-
const isDark = useDarkMode();
10067
const [activeTab, setActiveTab] = useState("configuration");
101-
const syntaxStyle = isDark ? coldarkDark : coldarkCold;
10268
const [selectedFilterInfo, setSelectedFilterInfo] = useState<{
10369
url: string;
10470
description: string;
@@ -829,13 +795,9 @@ const ApiConfigPanel: React.FC<ApiConfigPanelProps> = ({
829795
<p className="font-bold mb-1 sm:mb-2 text-xs sm:text-sm">
830796
Filter Code:
831797
</p>
832-
<SyntaxHighlighter
833-
language="javascript"
834-
style={syntaxStyle}
835-
customStyle={{ fontSize: "11px", borderRadius: "6px" }}
836-
>
837-
{selectedFilterInfo.code}
838-
</SyntaxHighlighter>
798+
<pre className="rounded-md bg-muted p-3 text-[11px] overflow-x-auto">
799+
<code className="font-mono">{selectedFilterInfo.code}</code>
800+
</pre>
839801
</div>
840802
</div>
841803
)}

src/components/ResultsTable.tsx

Lines changed: 21 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ import {
2222
CollapsibleContent,
2323
CollapsibleTrigger,
2424
} from "@/components/ui/collapsible";
25-
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
26-
import {
27-
coldarkCold,
28-
coldarkDark,
29-
} from "react-syntax-highlighter/dist/cjs/styles/prism";
3025
import Map from "ol/Map";
3126
import FullScreen from "ol/control/FullScreen.js";
3227
import View from "ol/View";
@@ -256,13 +251,11 @@ const ResultsTable: React.FC<Props> = ({
256251
hasSearched = false,
257252
stacApis = [],
258253
}) => {
259-
const isDark = useDarkMode();
260254
const [isOpen, setIsOpen] = useState(false);
261255
const [selectedRecord, setSelectedRecord] = useState<Record<
262256
string,
263257
any | HintFormat
264258
> | null>(null);
265-
const hintStyle = isDark ? coldarkDark : coldarkCold;
266259
const { columns, isMobile } = useBreakpoint();
267260

268261
// State for collapsible sections
@@ -718,36 +711,24 @@ const ResultsTable: React.FC<Props> = ({
718711
<TabsTrigger value="r">R</TabsTrigger>
719712
</TabsList>
720713
<TabsContent value="python" className="mt-4 overflow-x-auto">
721-
<SyntaxHighlighter
722-
language="python"
723-
style={hintStyle}
724-
customStyle={{
725-
fontSize: "12px",
726-
maxWidth: "100%",
727-
overflowX: "auto",
728-
}}
729-
>
730-
{getPythonCodeHint(
731-
extractCatalogUrl(selectedRecord),
732-
selectedRecord.id || "collection-id"
733-
)}
734-
</SyntaxHighlighter>
714+
<pre className="rounded-md bg-muted p-4 text-xs overflow-x-auto">
715+
<code className="font-mono">
716+
{getPythonCodeHint(
717+
extractCatalogUrl(selectedRecord),
718+
selectedRecord.id || "collection-id"
719+
)}
720+
</code>
721+
</pre>
735722
</TabsContent>
736723
<TabsContent value="r" className="mt-4 overflow-x-auto">
737-
<SyntaxHighlighter
738-
language="r"
739-
style={hintStyle}
740-
customStyle={{
741-
fontSize: "12px",
742-
maxWidth: "100%",
743-
overflowX: "auto",
744-
}}
745-
>
746-
{getRCodeHint(
747-
extractCatalogUrl(selectedRecord),
748-
selectedRecord.id || "collection-id"
749-
)}
750-
</SyntaxHighlighter>
724+
<pre className="rounded-md bg-muted p-4 text-xs overflow-x-auto">
725+
<code className="font-mono">
726+
{getRCodeHint(
727+
extractCatalogUrl(selectedRecord),
728+
selectedRecord.id || "collection-id"
729+
)}
730+
</code>
731+
</pre>
751732
</TabsContent>
752733
</Tabs>
753734
</div>
@@ -840,17 +821,11 @@ const ResultsTable: React.FC<Props> = ({
840821
id="json-content"
841822
className="mt-2 transition-all duration-200 overflow-x-auto"
842823
>
843-
<SyntaxHighlighter
844-
language="json"
845-
style={hintStyle}
846-
customStyle={{
847-
fontSize: "12px",
848-
maxWidth: "100%",
849-
overflowX: "auto",
850-
}}
851-
>
852-
{JSON.stringify(selectedRecord, null, 2)}
853-
</SyntaxHighlighter>
824+
<pre className="rounded-md bg-muted p-4 text-xs overflow-x-auto">
825+
<code className="font-mono">
826+
{JSON.stringify(selectedRecord, null, 2)}
827+
</code>
828+
</pre>
854829
</CollapsibleContent>
855830
</Collapsible>
856831
</div>

0 commit comments

Comments
 (0)