Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
thesergsb committed Dec 22, 2024
1 parent b674f6f commit 37aba31
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 91 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,6 @@
"@semantic-release/npm",
"@semantic-release/github"
]
}
},
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
170 changes: 86 additions & 84 deletions src/components/chart-elements/AreaChart/AreaChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -384,58 +384,20 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)
</defs>
);
})}
{categories.map((category, idx) => {
{categories.map((category) => {
const gradientId = (categoryColors.get(category) ?? BaseColors.Gray).replace("#", "");
return (<Area
className={
getColorClassNames(
categoryColors.get(category) ?? BaseColors.Gray,
colorPalette.text,
).strokeColor
}
strokeOpacity={activeDot || (activeLegend && activeLegend !== category) ? 0.3 : 1}
activeDot={(props: any) => {
const { cx, cy, stroke, strokeLinecap, strokeLinejoin, strokeWidth, dataKey } =
props;
return (
<Dot
className={tremorTwMerge(
"stroke-tremor-background dark:stroke-dark-tremor-background",
onValueChange ? "cursor-pointer" : "",
getColorClassNames(
categoryColors.get(dataKey) ?? BaseColors.Gray,
colorPalette.text,
).fillColor,
)}
cx={cx}
cy={cy}
r={5}
fill=""
stroke={stroke}
strokeLinecap={strokeLinecap}
strokeLinejoin={strokeLinejoin}
strokeWidth={strokeWidth}
onClick={(dotProps: any, event) => onDotClick(props, event)}
/>
);
}}
dot={(props: any) => {
const {
stroke,
strokeLinecap,
strokeLinejoin,
strokeWidth,
cx,
cy,
dataKey,
index,
} = props;

if (
(hasOnlyOneValueForThisKey(data, category) &&
!(activeDot || (activeLegend && activeLegend !== category))) ||
(activeDot?.index === index && activeDot?.dataKey === category)
) {
return (
<Area
className={
getColorClassNames(
categoryColors.get(category) ?? BaseColors.Gray,
colorPalette.text,
).strokeColor
}
strokeOpacity={activeDot || (activeLegend && activeLegend !== category) ? 0.3 : 1}
activeDot={(props: any) => {
const { cx, cy, stroke, strokeLinecap, strokeLinejoin, strokeWidth, dataKey } =
props;
return (
<Dot
className={tremorTwMerge(
Expand All @@ -457,40 +419,80 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)
onClick={(dotProps: any, event) => onDotClick(props, event)}
/>
);
}}
dot={(props: any) => {
const {
stroke,
strokeLinecap,
strokeLinejoin,
strokeWidth,
cx,
cy,
dataKey,
index,
} = props;

if (
(hasOnlyOneValueForThisKey(data, category) &&
!(activeDot || (activeLegend && activeLegend !== category))) ||
(activeDot?.index === index && activeDot?.dataKey === category)
) {
return (
<Dot
className={tremorTwMerge(
"stroke-tremor-background dark:stroke-dark-tremor-background",
onValueChange ? "cursor-pointer" : "",
getColorClassNames(
categoryColors.get(dataKey) ?? BaseColors.Gray,
colorPalette.text,
).fillColor,
)}
cx={cx}
cy={cy}
r={5}
fill=""
stroke={stroke}
strokeLinecap={strokeLinecap}
strokeLinejoin={strokeLinejoin}
strokeWidth={strokeWidth}
onClick={(dotProps: any, event) => onDotClick(props, event)}
/>
);
}
return <Fragment key={index}></Fragment>;
}}
key={category}
label={
dataLabelOptions?.[category] == null
? undefined
: {
style: {
fontSize: `${dataLabelOptions?.[category].fontSize ?? 12}px`,
fontWeight: "300",
fill: categoryColors.get(category) ?? BaseColors.Gray,
stroke: "#000",
strokeWidth: 0.3,
},
position: dataLabelOptions[category].position ?? "top",
offset: dataLabelOptions?.[category].offset ?? 10,
angle: dataLabelOptions?.[category].angle ?? 0,
}
}
return <Fragment key={index}></Fragment>;
}}
key={category}
label={
dataLabelOptions?.[category] == null
? undefined
: {
style: {
fontSize: `${dataLabelOptions?.[category].fontSize ?? 12}px`,
fontWeight: "300",
fill: categoryColors.get(category) ?? BaseColors.Gray,
stroke: "#000",
strokeWidth: 0.3,
},
position: dataLabelOptions[category].position ?? "top",
offset: dataLabelOptions?.[category].offset ?? 10,
angle: dataLabelOptions?.[category].angle ?? 0,
}
}
name={category}
type={curveType}
dataKey={category}
stroke=""
fill={`url(#${gradientId})`}
strokeWidth={2}
strokeLinejoin="round"
strokeLinecap="round"
isAnimationActive={showAnimation}
animationDuration={animationDuration}
stackId={stack ? "a" : undefined}
connectNulls={connectNulls}
/>
)})}
name={category}
type={curveType}
dataKey={category}
stroke=""
fill={`url(#${gradientId})`}
strokeWidth={2}
strokeLinejoin="round"
strokeLinecap="round"
isAnimationActive={showAnimation}
animationDuration={animationDuration}
stackId={stack ? "a" : undefined}
connectNulls={connectNulls}
/>
);
})}
{onValueChange
? categories.map((category) => (
<Line
Expand Down
4 changes: 2 additions & 2 deletions src/components/chart-elements/FunnelChart/FunnelChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ const FunnelChartPrimitive = React.forwardRef<HTMLDivElement, FunnelChartProps>(
return data.reduce((acc: FormattedDataT[], item, index) => {
const prev = acc[index - 1];
const value = item.value;
const valueToCompareWith = isPreviousCalculation ? (prev?.value ?? maxValue) : maxValue;
const valueToCompareWith = isPreviousCalculation ? prev?.value ?? maxValue : maxValue;

Check failure on line 213 in src/components/chart-elements/FunnelChart/FunnelChart.tsx

View workflow job for this annotation

GitHub Actions / Build dist

Replace `prev?.value·??·maxValue` with `(prev?.value·??·maxValue)`

Check failure on line 213 in src/components/chart-elements/FunnelChart/FunnelChart.tsx

View workflow job for this annotation

GitHub Actions / Build dist

Replace `prev?.value·??·maxValue` with `(prev?.value·??·maxValue)`
const calculationHeight = isPreviousCalculation
? (prev?.barHeight ?? realHeight)
? prev?.barHeight ?? realHeight

Check failure on line 215 in src/components/chart-elements/FunnelChart/FunnelChart.tsx

View workflow job for this annotation

GitHub Actions / Build dist

Replace `prev?.barHeight·??·realHeight` with `(prev?.barHeight·??·realHeight)`

Check failure on line 215 in src/components/chart-elements/FunnelChart/FunnelChart.tsx

View workflow job for this annotation

GitHub Actions / Build dist

Replace `prev?.barHeight·??·realHeight` with `(prev?.barHeight·??·realHeight)`
: realHeight;

const normalizedValue = value / valueToCompareWith;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ const ScatterChart = React.forwardRef<HTMLDivElement, ScatterChartProps>((props,
const categories = constructCategories(data, category);
const categoryColors = constructCategoryColors(categories, colors);


//maybe rename getYAxisDomain to getAxisDomain
const xAxisDomain = getYAxisDomain(autoMinXValue, minXValue, maxXValue);
const yAxisDomain = getYAxisDomain(autoMinYValue, minYValue, maxYValue);
Expand Down
2 changes: 1 addition & 1 deletion src/components/chart-elements/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const getYAxisDomain = (
minValue: number | undefined,
maxValue: number | undefined,
) => {
const minDomain = autoMinValue ? "auto" : (minValue ?? 0);
const minDomain = autoMinValue ? "auto" : minValue ?? 0;

Check failure on line 25 in src/components/chart-elements/common/utils.ts

View workflow job for this annotation

GitHub Actions / Build dist

Replace `minValue·??·0` with `(minValue·??·0)`

Check failure on line 25 in src/components/chart-elements/common/utils.ts

View workflow job for this annotation

GitHub Actions / Build dist

Replace `minValue·??·0` with `(minValue·??·0)`
const maxDomain = maxValue ?? "auto";
return [minDomain, maxDomain];
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ const DateRangePicker = React.forwardRef<HTMLDivElement, DateRangePickerProps>((
getSelectButtonColors(hasValue<string>(value), disabled),
)}
>
{value ? (valueToNameMapping.get(value) ?? selectPlaceholder) : selectPlaceholder}
{value ? valueToNameMapping.get(value) ?? selectPlaceholder : selectPlaceholder}

Check failure on line 321 in src/components/input-elements/DateRangePicker/DateRangePicker.tsx

View workflow job for this annotation

GitHub Actions / Build dist

Replace `valueToNameMapping.get(value)·??·selectPlaceholder` with `(valueToNameMapping.get(value)·??·selectPlaceholder)`

Check failure on line 321 in src/components/input-elements/DateRangePicker/DateRangePicker.tsx

View workflow job for this annotation

GitHub Actions / Build dist

Replace `valueToNameMapping.get(value)·??·selectPlaceholder` with `(valueToNameMapping.get(value)·??·selectPlaceholder)`
</ListboxButton>
<Transition
enter="transition ease duration-100 transform"
Expand Down
2 changes: 1 addition & 1 deletion src/components/input-elements/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const Select = React.forwardRef<HTMLInputElement, SelectProps>((props, ref) => {
</span>
)}
<span className="w-[90%] block truncate">
{value ? (valueToNameMapping.get(value) ?? placeholder) : placeholder}
{value ? valueToNameMapping.get(value) ?? placeholder : placeholder}

Check failure on line 150 in src/components/input-elements/Select/Select.tsx

View workflow job for this annotation

GitHub Actions / Build dist

Replace `valueToNameMapping.get(value)·??·placeholder` with `(valueToNameMapping.get(value)·??·placeholder)`

Check failure on line 150 in src/components/input-elements/Select/Select.tsx

View workflow job for this annotation

GitHub Actions / Build dist

Replace `valueToNameMapping.get(value)·??·placeholder` with `(valueToNameMapping.get(value)·??·placeholder)`
</span>
<span
className={tremorTwMerge("absolute inset-y-0 right-0 flex items-center mr-3")}
Expand Down

0 comments on commit 37aba31

Please sign in to comment.