diff --git a/components/value-dialog.tsx b/components/value-dialog.tsx index 1022137..4105a41 100644 --- a/components/value-dialog.tsx +++ b/components/value-dialog.tsx @@ -2,17 +2,10 @@ import { Dialog, DialogContent, - DialogDescription, - DialogHeader, - DialogTitle, DialogTrigger, } from "@/components/ui/dialog" -import useSWR, { mutate } from "swr" -import { GetPlugins, PluginFunctionCall } from "@/apis/backend" import { Separator } from "./ui/separator" import { Input } from "./ui/input" -import { GetSettingsJSON, SetSettingByKey, SetSettingByKeys } from "@/apis/settings" -import { DisablePlugin, EnablePlugin } from "@/apis/backend" import { Select, SelectContent, @@ -23,35 +16,64 @@ import { import { Toggle } from "@/components/ui/toggle" import { Switch } from "./ui/switch" import { Button } from "./ui/button" -import { toast } from "sonner" -import { useEffect } from "react" import { Slider } from "./ui/slider" import { useState } from "react" import { translate } from "@/apis/translation" -import React, { Component } from 'react'; -import { SkeletonItem } from "./skeleton_item" +import React from 'react'; import { Check, X } from "lucide-react" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { Progress } from "./ui/progress" +import Markdown from "react-markdown" +// @ts-expect-error +import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'; +// @ts-expect-error +import { vscDarkPlus } from 'react-syntax-highlighter/dist/esm/styles/prism'; export default function ValueDialog({onClose, open, json}: {onClose: any, open: boolean, json: string}) { const [returnValue, setReturnValue] = useState({}) if (!json) return
- const TitleRenderer = (data:string) => { - return{translate(data)}
+ // Literal["thin", "light", "normal", "medium", "semibold", "bold"] + const weights = { + "thin": "font-thin", + "light": "font-light", + "normal": "font-normal", + "medium": "font-medium", + "semibold": "font-semibold", + "bold": "font-bold" } - const LabelRenderer = (data:string) => { - return{translate(data)}
+ const TitleRenderer = (data: any) => { + // @ts-ignore + return{translate(data.text)}
+ } + + const DescriptionRenderer = (data: any) => { + // @ts-ignore + return{translate(data.text)}
+ } + + const LabelRenderer = (data: any) => { + // @ts-ignore + return{translate(data.text)}
+ } + + const LinkRenderer = (data: any) => { + // @ts-ignore + return {translate(data.text)} } const SeparatorRenderer = () => { @@ -60,6 +82,60 @@ export default function ValueDialog({onClose, open, json}: {onClose: any, open: > } + function MarkdownRenderer(data: any, no_padding?: boolean) { + return ( +