Skip to content

Commit e430409

Browse files
committed
disable cursor highlight on all stats cards
The tooltip cursor (hover highlight rectangle) extends beyond the card boundary on small stats cards. Disable it for all four stats card variants (overview, server activity, composer, resources) via a new cursor prop on ChartProps.
1 parent 6625fd6 commit e430409

8 files changed

Lines changed: 23 additions & 5 deletions

File tree

apps/scan/src/app/(app)/(home)/(overview)/_components/stats/card.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,15 @@ export const OverallStatsCard = <T extends Record<string, number>>({
8181
bars={items.bars}
8282
height={100}
8383
tooltipRows={tooltipRows}
84+
cursor={false}
8485
/>
8586
) : (
8687
<BaseAreaChart
8788
data={data}
8889
areas={items.areas}
8990
height={100}
9091
tooltipRows={tooltipRows}
92+
cursor={false}
9193
/>
9294
)}
9395
</OverallStatsCardContainer>

apps/scan/src/app/(app)/(home)/resources/(overview)/_components/charts/card.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,15 @@ export const OverallStatsCard = <T extends Record<string, number>>({
8383
bars={items.bars}
8484
height={75}
8585
tooltipRows={tooltipRows}
86+
cursor={false}
8687
/>
8788
) : (
8889
<BaseAreaChart
8990
data={data}
9091
areas={items.areas}
9192
height={75}
9293
tooltipRows={tooltipRows}
94+
cursor={false}
9395
/>
9496
)}
9597
</OverallStatsCardContainer>

apps/scan/src/app/(app)/composer/(home)/_components/stats/card.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,15 @@ export const OverallStatsCard = <T extends Record<string, number>>({
7676
bars={items.bars}
7777
height={100}
7878
tooltipRows={tooltipRows}
79+
cursor={false}
7980
/>
8081
) : (
8182
<BaseAreaChart
8283
data={data}
8384
areas={items.areas}
8485
height={100}
8586
tooltipRows={tooltipRows}
87+
cursor={false}
8688
/>
8789
)}
8890
</OverallStatsCardContainer>

apps/scan/src/app/(app)/server/[id]/(overview)/_components/activity/card.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,15 @@ export const OverallStatsCard = <T extends Record<string, number>>({
8383
bars={items.bars}
8484
height={75}
8585
tooltipRows={tooltipRows}
86+
cursor={false}
8687
/>
8788
) : (
8889
<BaseAreaChart
8990
data={data}
9091
areas={items.areas}
9192
height={75}
9293
tooltipRows={tooltipRows}
94+
cursor={false}
9395
/>
9496
)}
9597
</OverallStatsCardContainer>

apps/scan/src/components/ui/charts/chart/area/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export const BaseAreaChart = <
2020
height = 350,
2121
margin = { top: 4, right: 0, left: 0, bottom: 4 },
2222
dataMax,
23+
cursor,
2324
}: AreaChartProps<T>) => {
2425
return (
2526
<BaseChart
@@ -29,6 +30,7 @@ export const BaseAreaChart = <
2930
tooltipRows={tooltipRows}
3031
margin={margin}
3132
dataMax={dataMax}
33+
cursor={cursor}
3234
>
3335
<defs>
3436
{areas.map(({ dataKey, color }) => (

apps/scan/src/components/ui/charts/chart/bar/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const BaseBarChart = <
2222
solid = false,
2323
stackOffset,
2424
xAxis,
25+
cursor,
2526
}: BarChartProps<T>) => {
2627
return (
2728
<BaseChart
@@ -32,6 +33,7 @@ export const BaseBarChart = <
3233
margin={margin}
3334
stackOffset={stackOffset}
3435
xAxis={xAxis}
36+
cursor={cursor}
3537
>
3638
{!solid && (
3739
<defs>

apps/scan/src/components/ui/charts/chart/chart.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const BaseChart = <T extends Omit<Record<string, number>, 'timestamp'>>({
2424
dataMax = 'dataMax',
2525
stackOffset,
2626
xAxis,
27+
cursor = true,
2728
}: ChartProps<T> & { type: 'bar' | 'area' | 'line' | 'composed' }) => {
2829
const Container = useMemo(() => {
2930
switch (type) {
@@ -83,11 +84,15 @@ export const BaseChart = <T extends Omit<Record<string, number>, 'timestamp'>>({
8384
}
8485
return null;
8586
}}
86-
cursor={{
87-
fill: 'var(--color-primary)',
88-
opacity: 0.2,
89-
radius: 4,
90-
}}
87+
cursor={
88+
cursor
89+
? {
90+
fill: 'var(--color-primary)',
91+
opacity: 0.2,
92+
radius: 4,
93+
}
94+
: false
95+
}
9196
/>
9297
)}
9398
</Container>

apps/scan/src/components/ui/charts/chart/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export interface ChartProps<T extends Record<string, number>> {
3636
angle?: number;
3737
height?: number;
3838
};
39+
cursor?: boolean;
3940
}
4041

4142
export type Series<T extends Record<string, number>, S> = S & {

0 commit comments

Comments
 (0)