fix(frontend): align react-syntax-highlighter JSX types with React 19
Some checks failed
Create Changelog Pull Request / update-changelog-pull-request (push) Has been skipped
Close Discussion on PR Merge / close-discussion (push) Has been skipped
Frontend CI/CD / test-json-files (push) Successful in 44s
Sync to Gitea / sync (push) Has been skipped
Frontend CI/CD / build (push) Has been skipped
Frontend CI/CD / deploy (push) Has been skipped
Check Node.js Version Drift / check-node-versions (push) Has been cancelled
Stale PR Management / stale-prs (push) Successful in 10s
Lock closed issues / lock (push) Failing after 11s
Build and Publish Docker Image / build (push) Has been skipped
Archive Old Changelog Entries / archive-changelog (push) Has been skipped
Create Daily Release / create-daily-release (push) Has been skipped
Crawl Versions from newreleases.io / crawl-versions (push) Has been skipped
Update GitHub Versions (New) / update-github-versions (push) Has been skipped

Made-with: Cursor
This commit is contained in:
2026-04-07 16:24:15 +08:00
parent 35b5957ad1
commit 53d837b48f

View File

@@ -3,7 +3,15 @@
import type { z } from "zod"; import type { z } from "zod";
import { CalendarIcon, Check, Clipboard, Download } from "lucide-react"; import { CalendarIcon, Check, Clipboard, Download } from "lucide-react";
import { useCallback, useEffect, useMemo, useState } from "react"; import {
useCallback,
useEffect,
useMemo,
useState,
type ComponentType,
type CSSProperties,
type ReactNode,
} from "react";
import { format } from "date-fns"; import { format } from "date-fns";
import { toast } from "sonner"; import { toast } from "sonner";
@@ -31,6 +39,14 @@ import Note from "./_components/note";
import { githubGist, nord } from "react-syntax-highlighter/dist/esm/styles/hljs"; import { githubGist, nord } from "react-syntax-highlighter/dist/esm/styles/hljs";
import SyntaxHighlighter from "react-syntax-highlighter"; import SyntaxHighlighter from "react-syntax-highlighter";
/** react-syntax-highlighter types lag React 19; align with app React types for JSX. */
const JsonSyntaxHighlighter = SyntaxHighlighter as ComponentType<{
language: string;
style: Record<string, CSSProperties>;
className?: string;
children?: ReactNode;
}>;
import { ScriptItem } from "../scripts/_components/script-item"; import { ScriptItem } from "../scripts/_components/script-item";
import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"; import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog";
@@ -523,13 +539,13 @@ export default function JSONGenerator() {
</Button> </Button>
</div> </div>
<SyntaxHighlighter <JsonSyntaxHighlighter
language="json" language="json"
style={theme === "light" ? githubGist : nord} style={theme === "light" ? githubGist : nord}
className="mt-4 p-4 bg-secondary rounded shadow overflow-x-scroll" className="mt-4 p-4 bg-secondary rounded shadow overflow-x-scroll"
> >
{JSON.stringify(script, null, 2)} {JSON.stringify(script, null, 2)}
</SyntaxHighlighter> </JsonSyntaxHighlighter>
</div> </div>
</TabsContent> </TabsContent>
<TabsContent value="preview" className="h-full w-full"> <TabsContent value="preview" className="h-full w-full">