1
- import React from 'react' ;
1
+ import React , { useState } from 'react' ;
2
2
import { BarStack } from '@visx/shape' ;
3
3
import { SeriesPoint } from '@visx/shape/lib/types' ;
4
4
import { Group } from '@visx/group' ;
@@ -9,7 +9,9 @@ import { useTooltip, useTooltipInPortal, defaultStyles } from '@visx/tooltip';
9
9
import { Text } from '@visx/text' ;
10
10
import { schemeSet3 } from 'd3-scale-chromatic' ;
11
11
import snapshots from './snapshots' ;
12
- import { onHover , onHoverExit } from '../actions/actions'
12
+ import { onHover , onHoverExit } from '../actions/actions' ;
13
+ import { useStoreContext } from '../store'
14
+
13
15
14
16
/* NOTES
15
17
Issue - Not fully compatible with recoil apps. Reference the recoil-todo-test.
@@ -110,6 +112,8 @@ const getPerfMetrics = (snapshots, snapshotsIds):any[] => {
110
112
/* EXPORT COMPONENT */
111
113
const PerformanceVisx = ( props : BarStackProps ) => {
112
114
115
+ const [ { tabs, currentTab } , dispatch ] = useStoreContext ( ) ;
116
+
113
117
const { width, height, snapshots, hierarchy } = props ;
114
118
115
119
console . log ( 'snapshots' , snapshots ) ;
@@ -215,13 +219,15 @@ const PerformanceVisx = (props: BarStackProps) => {
215
219
/* TIP TOOL EVENT HANDLERS */
216
220
// Hides tool tip once cursor moves off the current rect
217
221
onMouseLeave = { ( ) => {
218
- console . log ( 'datafrommouse' , data )
222
+ // dispatch(onHoverExit(allComponentRtids[bar.key] )
219
223
tooltipTimeout = window . setTimeout ( ( ) => {
220
224
hideTooltip ( ) ;
221
225
} , 300 ) ;
222
226
} }
223
227
// Cursor position in window updates position of the tool tip
224
228
onMouseMove = { event => {
229
+ console . log ( allComponentRtids [ bar . key ] )
230
+ dispatch ( onHover ( allComponentRtids [ bar . key ] ) )
225
231
if ( tooltipTimeout ) clearTimeout ( tooltipTimeout ) ;
226
232
const top = event . clientY - margin . top - bar . height ;
227
233
const left = bar . x + bar . width / 2 ;
0 commit comments