From 4abe3000a53efba9c0b0149dab6c6e25bb6fc000 Mon Sep 17 00:00:00 2001 From: Jingles Date: Thu, 30 Apr 2026 21:34:07 +0800 Subject: [PATCH 1/6] refactor: remove unused recharts and busboy deps; relocate swagger CSS - Delete src/components/ui/chart.tsx (recharts wrapper, zero consumers) - Remove recharts from dependencies - Remove busboy and @types/busboy (formidable is the actual uploader) - Move swagger-ui CSS imports out of _app.tsx into api-docs.tsx --- package.json | 3 - src/components/ui/chart.tsx | 368 ------------------------------------ src/pages/_app.tsx | 3 - src/pages/api-docs.tsx | 1 + 4 files changed, 1 insertion(+), 374 deletions(-) delete mode 100644 src/components/ui/chart.tsx diff --git a/package.json b/package.json index ef470275..ac878917 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,6 @@ "@trpc/react-query": "^11.0.0-rc.446", "@trpc/server": "^11.0.0-rc.446", "@utxos/sdk": "^0.0.78", - "busboy": "^1.6.0", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", "cors": "^2.8.5", @@ -79,7 +78,6 @@ "react-dropzone": "^14.3.5", "react-hook-form": "^7.53.0", "react-markdown": "^10.1.0", - "recharts": "^2.12.7", "remark-gfm": "^4.0.1", "superjson": "^2.2.1", "swagger-jsdoc": "^6.2.8", @@ -100,7 +98,6 @@ "@next/bundle-analyzer": "^16.0.10", "@react-three/drei": "^9.122.0", "@react-three/fiber": "^8.17.7", - "@types/busboy": "^1.5.4", "@types/cors": "^2.8.18", "@types/eslint": "^8.56.10", "@types/formidable": "^3.4.5", diff --git a/src/components/ui/chart.tsx b/src/components/ui/chart.tsx deleted file mode 100644 index a9a39ad9..00000000 --- a/src/components/ui/chart.tsx +++ /dev/null @@ -1,368 +0,0 @@ -import * as React from "react" -import * as RechartsPrimitive from "recharts" -import { - NameType, - Payload, - ValueType, -} from "recharts/types/component/DefaultTooltipContent" - -import { cn } from "@/lib/utils" - -// Format: { THEME_NAME: CSS_SELECTOR } -const THEMES = { light: "", dark: ".dark" } as const - -export type ChartConfig = { - [k in string]: { - label?: React.ReactNode - icon?: React.ComponentType - } & ( - | { color?: string; theme?: never } - | { color?: never; theme: Record } - ) -} - -type ChartContextProps = { - config: ChartConfig -} - -const ChartContext = React.createContext(null) - -function useChart() { - const context = React.useContext(ChartContext) - - if (!context) { - throw new Error("useChart must be used within a ") - } - - return context -} - -const ChartContainer = React.forwardRef< - HTMLDivElement, - React.ComponentProps<"div"> & { - config: ChartConfig - children: React.ComponentProps< - typeof RechartsPrimitive.ResponsiveContainer - >["children"] - } ->(({ id, className, children, config, ...props }, ref) => { - const uniqueId = React.useId() - const chartId = `chart-${id || uniqueId.replace(/:/g, "")}` - - return ( - -
- - - {children} - -
-
- ) -}) -ChartContainer.displayName = "Chart" - -const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => { - const colorConfig = Object.entries(config).filter( - ([_, config]) => config.theme || config.color - ) - - if (!colorConfig.length) { - return null - } - - return ( -