diff --git a/package.json b/package.json index 135557f..b64ff14 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "dev": "next dev", "lint": "next lint", "start": "next start", - "go": "next start" + "go": "next dev" }, "dependencies": { "@radix-ui/react-accordion": "^1.2.0", diff --git a/src/components/ui/chart.tsx b/src/components/ui/chart.tsx index ad0a55a..e7d5db9 100644 --- a/src/components/ui/chart.tsx +++ b/src/components/ui/chart.tsx @@ -74,7 +74,7 @@ ChartContainer.displayName = "Chart" const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => { const colorConfig = Object.entries(config).filter( - ([_, config]) => config.theme || config.color + ([_, config]) => config.theme ?? config.color ) if (!colorConfig.length) { @@ -91,7 +91,7 @@ ${prefix} [data-chart=${id}] { ${colorConfig .map(([key, itemConfig]) => { const color = - itemConfig.theme?.[theme as keyof typeof itemConfig.theme] || + itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ?? itemConfig.color return color ? ` --color-${key}: ${color};` : null }) @@ -144,11 +144,11 @@ const ChartTooltipContent = React.forwardRef< } const [item] = payload - const key = `${labelKey || item.dataKey || item.name || "value"}` + const key = `${labelKey ?? item.dataKey ?? item.name ?? "value"}` const itemConfig = getPayloadConfigFromPayload(config, item, key) const value = !labelKey && typeof label === "string" - ? config[label as keyof typeof config]?.label || label + ? config[label as keyof typeof config]?.label ?? label : itemConfig?.label if (labelFormatter) { @@ -191,9 +191,9 @@ const ChartTooltipContent = React.forwardRef< {!nestLabel ? tooltipLabel : null}
{payload.map((item, index) => { - const key = `${nameKey || item.name || item.dataKey || "value"}` + const key = `${nameKey ?? item.name ?? item.dataKey ?? "value"}` const itemConfig = getPayloadConfigFromPayload(config, item, key) - const indicatorColor = color || item.payload.fill || item.color + const indicatorColor = color ?? item.payload.fill ?? item.color return (
{nestLabel ? tooltipLabel : null} - {itemConfig?.label || item.name} + {itemConfig?.label ?? item.name}
{item.value && (