From bba51fcd11703726d943f085f34d4dbcdb0942b1 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Thu, 5 Sep 2024 01:13:41 -0600 Subject: [PATCH] refactor: remove sort level column --- .../components/dashboard/requests/columns.tsx | 10 +- apps/dokploy/components/ui/chart.tsx | 616 +++++++++--------- 2 files changed, 309 insertions(+), 317 deletions(-) diff --git a/apps/dokploy/components/dashboard/requests/columns.tsx b/apps/dokploy/components/dashboard/requests/columns.tsx index afcd32ddf..4e1c749a4 100644 --- a/apps/dokploy/components/dashboard/requests/columns.tsx +++ b/apps/dokploy/components/dashboard/requests/columns.tsx @@ -26,15 +26,7 @@ export const columns: ColumnDef[] = [ { accessorKey: "level", header: ({ column }) => { - return ( - - ); + return ; }, cell: ({ row }) => { return
{row.original.level}
; diff --git a/apps/dokploy/components/ui/chart.tsx b/apps/dokploy/components/ui/chart.tsx index a21d77ee7..469ac8c8c 100644 --- a/apps/dokploy/components/ui/chart.tsx +++ b/apps/dokploy/components/ui/chart.tsx @@ -1,363 +1,363 @@ -import * as React from "react" -import * as RechartsPrimitive from "recharts" +import * as React from "react"; +import * as RechartsPrimitive from "recharts"; -import { cn } from "@/lib/utils" +import { cn } from "@/lib/utils"; // Format: { THEME_NAME: CSS_SELECTOR } -const THEMES = { light: "", dark: ".dark" } as const +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 } - ) -} + [k in string]: { + label?: React.ReactNode; + icon?: React.ComponentType; + } & ( + | { color?: string; theme?: never } + | { color?: never; theme: Record } + ); +}; type ChartContextProps = { - config: ChartConfig -} + config: ChartConfig; +}; -const ChartContext = React.createContext(null) +const ChartContext = React.createContext(null); function useChart() { - const context = React.useContext(ChartContext) + const context = React.useContext(ChartContext); - if (!context) { - throw new Error("useChart must be used within a ") - } + if (!context) { + throw new Error("useChart must be used within a "); + } - return context + return context; } const ChartContainer = React.forwardRef< - HTMLDivElement, - React.ComponentProps<"div"> & { - config: ChartConfig - children: React.ComponentProps< - typeof RechartsPrimitive.ResponsiveContainer - >["children"] - } + 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, "")}` + const uniqueId = React.useId(); + const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`; - return ( - -
- - - {children} - -
-
- ) -}) -ChartContainer.displayName = "Chart" + return ( + +
+ + + {children} + +
+
+ ); +}); +ChartContainer.displayName = "Chart"; const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => { - const colorConfig = Object.entries(config).filter( - ([_, config]) => config.theme || config.color - ) + const colorConfig = Object.entries(config).filter( + ([_, config]) => config.theme || config.color, + ); - if (!colorConfig.length) { - return null - } + if (!colorConfig.length) { + return null; + } - return ( -