Fix some stuff for prod

This commit is contained in:
Gabriel Brown 2024-09-17 13:34:11 -05:00
parent b6b9aa753e
commit 55034ee4ba
2 changed files with 9 additions and 8 deletions

View File

@ -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",

View File

@ -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}
<div className="grid gap-1.5">
{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 (
<div
@ -224,6 +224,7 @@ const ChartTooltipContent = React.forwardRef<
)}
style={
{
// @ts-expect-error - Not my code
"--color-bg": indicatorColor,
"--color-border": indicatorColor,
} as React.CSSProperties
@ -240,7 +241,7 @@ const ChartTooltipContent = React.forwardRef<
<div className="grid gap-1.5">
{nestLabel ? tooltipLabel : null}
<span className="text-muted-foreground">
{itemConfig?.label || item.name}
{itemConfig?.label ?? item.name}
</span>
</div>
{item.value && (