1- import type { MouseEvent } from "react" ;
2- import { createElement , useCallback } from "react" ;
3- import { useSpring , animated } from "@react-spring/web" ;
4- import { useAnimatedPath } from "@nivo/core" ;
5- import { useTooltip } from "@nivo/tooltip" ;
61import { SankeyLinkGradient } from "./SankeyLinkGradient" ;
72import type {
83 DefaultLink ,
@@ -19,7 +14,6 @@ import {
1914 failedSlotNodes ,
2015} from "../features/Overview/SlotPerformance/SlotSankey/consts" ;
2116import { useShowNode } from "./useShowNode" ;
22- import { useCustomMotionConfig } from "./useCustomMotionConfig" ;
2317import {
2418 failureColor ,
2519 sankeyDroppedLinkColor ,
@@ -56,43 +50,43 @@ export const SankeyLinksItem = <N extends DefaultNode, L extends DefaultLink>({
5650 onClick,
5751} : SankeyLinksItemProps < N , L > ) => {
5852 const linkId = `${ link . source . id } .${ link . target . id } .${ link . index } ` ;
59- const { animate, config : springConfig } = useCustomMotionConfig ( ) ;
60- const animatedPath = useAnimatedPath ( path ) ;
61- const animatedProps = useSpring ( {
62- color,
63- opacity,
64- config : springConfig ,
65- immediate : ! animate ,
66- } ) ;
53+ // const { animate, config: springConfig } = useCustomMotionConfig();
54+ // const animatedPath = useAnimatedPath(path);
55+ // const animatedProps = useSpring({
56+ // color,
57+ // opacity,
58+ // config: springConfig,
59+ // immediate: !animate,
60+ // });
6761
68- const { showTooltipFromEvent, hideTooltip } = useTooltip ( ) ;
62+ // const { showTooltipFromEvent, hideTooltip } = useTooltip();
6963
70- const handleMouseEnter = useCallback (
71- ( event : MouseEvent < SVGPathElement > ) => {
72- setCurrent ( link ) ;
73- showTooltipFromEvent ( createElement ( tooltip , { link } ) , event , "left" ) ;
74- } ,
75- [ setCurrent , link , showTooltipFromEvent , tooltip ] ,
76- ) ;
64+ // const handleMouseEnter = useCallback(
65+ // (event: MouseEvent<SVGPathElement>) => {
66+ // setCurrent(link);
67+ // showTooltipFromEvent(createElement(tooltip, { link }), event, "left");
68+ // },
69+ // [setCurrent, link, showTooltipFromEvent, tooltip],
70+ // );
7771
78- const handleMouseMove = useCallback (
79- ( event : MouseEvent < SVGPathElement > ) => {
80- showTooltipFromEvent ( createElement ( tooltip , { link } ) , event , "left" ) ;
81- } ,
82- [ showTooltipFromEvent , link , tooltip ] ,
83- ) ;
72+ // const handleMouseMove = useCallback(
73+ // (event: MouseEvent<SVGPathElement>) => {
74+ // showTooltipFromEvent(createElement(tooltip, { link }), event, "left");
75+ // },
76+ // [showTooltipFromEvent, link, tooltip],
77+ // );
8478
85- const handleMouseLeave = useCallback ( ( ) => {
86- setCurrent ( null ) ;
87- hideTooltip ( ) ;
88- } , [ setCurrent , hideTooltip ] ) ;
79+ // const handleMouseLeave = useCallback(() => {
80+ // setCurrent(null);
81+ // hideTooltip();
82+ // }, [setCurrent, hideTooltip]);
8983
90- const handleClick = useCallback (
91- ( event : MouseEvent < SVGPathElement > ) => {
92- onClick ?.( link , event ) ;
93- } ,
94- [ onClick , link ] ,
95- ) ;
84+ // const handleClick = useCallback(
85+ // (event: MouseEvent<SVGPathElement>) => {
86+ // onClick?.(link, event);
87+ // },
88+ // [onClick, link],
89+ // );
9690 let linkColor ;
9791 if ( incomingSlotNodes . includes ( link . source . id as SlotNode ) ) {
9892 linkColor = sankeyIncomingLinkColor ;
@@ -125,19 +119,16 @@ export const SankeyLinksItem = <N extends DefaultNode, L extends DefaultLink>({
125119 endColor = { link . endColor || link . target . color }
126120 />
127121 ) }
128- < animated . path
122+ < path
129123 fill = {
130- linkColor ??
131- ( enableGradient
132- ? `url("#${ encodeURI ( linkId ) } ")`
133- : animatedProps . color )
124+ linkColor ?? ( enableGradient ? `url("#${ encodeURI ( linkId ) } ")` : color )
134125 }
135- d = { animatedPath }
136- fillOpacity = { animatedProps . opacity }
137- onMouseEnter = { isInteractive ? handleMouseEnter : undefined }
138- onMouseMove = { isInteractive ? handleMouseMove : undefined }
139- onMouseLeave = { isInteractive ? handleMouseLeave : undefined }
140- onClick = { isInteractive ? handleClick : undefined }
126+ d = { path }
127+ // fillOpacity={animatedProps.opacity}
128+ // onMouseEnter={isInteractive ? handleMouseEnter : undefined}
129+ // onMouseMove={isInteractive ? handleMouseMove : undefined}
130+ // onMouseLeave={isInteractive ? handleMouseLeave : undefined}
131+ // onClick={isInteractive ? handleClick : undefined}
141132 />
142133 </ >
143134 ) ;
0 commit comments