1- import React , { useState , useCallback , useMemo , useRef , useEffect } from "react"
1+ import React , { useState , useCallback , useMemo , useRef } from "react"
22import { useTranslation } from "react-i18next"
33import CostTrendChart from "./CostTrendChart"
44import { } from "@src/components/ui"
@@ -19,8 +19,6 @@ interface TaskCostChartSectionProps {
1919
2020export type ChartType = "costDelta" | "cumulativeCost" | "tokensIn" | "tokensOut" | "gridView"
2121
22- const NARROW_THRESHOLD_PX = 300
23-
2422const TaskCostChartSection : React . FC < TaskCostChartSectionProps > = ( { costHistory } ) => {
2523 const { t } = useTranslation ( )
2624 const [ selectedChartType , setSelectedChartType ] = useState < ChartType > ( "gridView" )
@@ -31,30 +29,8 @@ const TaskCostChartSection: React.FC<TaskCostChartSectionProps> = ({ costHistory
3129 value ?: number
3230 type ?: ChartType
3331 } | null > ( null )
34- const [ _isNarrow , setIsNarrow ] = useState ( false )
3532 const gridContainerRef = useRef < HTMLDivElement > ( null )
3633
37- useEffect ( ( ) => {
38- const container = gridContainerRef . current
39- if ( ! container ) return
40-
41- const observer = new ResizeObserver ( ( entries ) => {
42- for ( let entry of entries ) {
43- const width = entry . contentBoxSize ?. [ 0 ] ?. inlineSize ?? entry . contentRect . width
44- setIsNarrow ( width < NARROW_THRESHOLD_PX )
45- }
46- } )
47-
48- observer . observe ( container )
49-
50- const initialWidth = container . getBoundingClientRect ( ) . width
51- setIsNarrow ( initialWidth < NARROW_THRESHOLD_PX )
52-
53- return ( ) => {
54- observer . disconnect ( )
55- }
56- } , [ selectedChartType ] )
57-
5834 const handleChartHoverChange = useCallback (
5935 (
6036 hoverData : { isHovering : boolean ; index ?: number ; yValue ?: number } | null ,
0 commit comments