@@ -20,7 +20,8 @@ import useKindTrendData from '@app/hooks/useKindTrendData';
2020import { Breakpoint } from 'antd/lib/_util/responsiveObserve' ;
2121import { useResponsive } from '@app/hooks/useResponsive' ;
2222import { BaseSkeleton } from '@app/components/common/BaseSkeleton/BaseSkeleton' ;
23- import { CaretDownOutlined , CaretRightOutlined } from '@ant-design/icons' ;
23+ import { CaretDownOutlined , CaretRightOutlined , ExpandOutlined , ShrinkOutlined } from '@ant-design/icons' ;
24+ import { BaseButton } from '@app/components/common/BaseButton/BaseButton' ;
2425ChartJS . register ( CategoryScale , LinearScale , PointElement , LineElement , Title , Tooltip , Legend , Filler ) ;
2526
2627interface KindData {
@@ -31,7 +32,17 @@ interface KindData {
3132 totalSize : number ;
3233}
3334
34- const EditableTable : React . FC = ( ) => {
35+ interface EditableTableProps {
36+ allExpanded ?: boolean ;
37+ expandedKeys ?: number [ ] ;
38+ setExpandedKeys ?: ( keys : number [ ] ) => void ;
39+ }
40+
41+ const EditableTable : React . FC < EditableTableProps > = ( {
42+ allExpanded : parentAllExpanded ,
43+ expandedKeys : parentExpandedKeys ,
44+ setExpandedKeys : parentSetExpandedKeys
45+ } ) => {
3546 const [ form ] = BaseForm . useForm ( ) ;
3647 const { t } = useTranslation ( ) ;
3748 const { kindData : initialKindData , isLoading } = useKindData ( ) ;
@@ -60,12 +71,29 @@ const EditableTable: React.FC = () => {
6071 }
6172 } , [ initialKindData , sortOrder , sortField ] ) ;
6273
74+ // Handle expand all/collapse all from parent
75+ useEffect ( ( ) => {
76+ if ( parentAllExpanded !== undefined && sortedData . length > 0 ) {
77+ if ( parentAllExpanded ) {
78+ const allKeys = sortedData . map ( ( item ) => item . kindNumber ) ;
79+ setExpandedRowKeys ( allKeys ) ;
80+ if ( parentSetExpandedKeys ) parentSetExpandedKeys ( allKeys ) ;
81+ } else {
82+ setExpandedRowKeys ( [ ] ) ;
83+ if ( parentSetExpandedKeys ) parentSetExpandedKeys ( [ ] ) ;
84+ }
85+ }
86+ } , [ parentAllExpanded , sortedData , parentSetExpandedKeys ] ) ;
87+
6388 const handleExpand = ( expanded : boolean , record : KindData ) => {
89+ let newKeys : number [ ] ;
6490 if ( expanded ) {
65- setExpandedRowKeys ( [ ...expandedRowKeys , record . kindNumber ] ) ;
91+ newKeys = [ ...expandedRowKeys , record . kindNumber ] ;
6692 } else {
67- setExpandedRowKeys ( expandedRowKeys . filter ( key => key !== record . kindNumber ) ) ;
93+ newKeys = expandedRowKeys . filter ( key => key !== record . kindNumber ) ;
6894 }
95+ setExpandedRowKeys ( newKeys ) ;
96+ if ( parentSetExpandedKeys ) parentSetExpandedKeys ( newKeys ) ;
6997 } ;
7098
7199 const handleChange = ( pagination : any , filters : any , sorter : any ) => {
@@ -134,17 +162,16 @@ const EditableTable: React.FC = () => {
134162 size : 12 ,
135163 weight : 'bold' ,
136164 } ,
137- color : 'rgba(0 , 255, 255, 0.9 )' , // Liquid cyan for titles
165+ color : 'rgba(255 , 255, 255, 0.95 )' , // White text for titles like Bitcoin chart
138166 } ,
139167 ticks : {
140168 font : {
141- size : 11 ,
169+ size : 12 ,
142170 } ,
143- color : 'rgba(0 , 255, 255, 0.6 )' , // Lighter cyan for tick labels
171+ color : 'rgba(255 , 255, 255, 0.9 )' , // White text like Bitcoin chart
144172 } ,
145173 grid : {
146- color : 'rgba(0, 255, 255, 0.05)' , // Very subtle cyan grid
147- drawBorder : false ,
174+ color : 'rgba(0, 255, 255, 0.15)' , // Match Bitcoin borderBase
148175 } ,
149176 } ,
150177 x : {
@@ -155,17 +182,16 @@ const EditableTable: React.FC = () => {
155182 size : 12 ,
156183 weight : 'bold' ,
157184 } ,
158- color : 'rgba(0 , 255, 255, 0.9 )' , // Liquid cyan for titles
185+ color : 'rgba(255 , 255, 255, 0.95 )' , // White text for titles like Bitcoin chart
159186 } ,
160187 ticks : {
161188 font : {
162189 size : 11 ,
163190 } ,
164- color : 'rgba(0 , 255, 255, 0.6 )' , // Lighter cyan for tick labels
191+ color : 'rgba(255 , 255, 255, 0.9 )' , // White text like Bitcoin chart
165192 } ,
166193 grid : {
167- color : 'rgba(0, 255, 255, 0.05)' , // Very subtle cyan grid
168- drawBorder : false ,
194+ color : 'rgba(0, 255, 255, 0.15)' , // Match Bitcoin borderBase
169195 } ,
170196 } ,
171197 } ,
@@ -176,7 +202,7 @@ const EditableTable: React.FC = () => {
176202 font : {
177203 size : 13 ,
178204 } ,
179- color : 'rgba(0 , 255, 255, 0.9 )' , // Liquid cyan for legend
205+ color : 'rgba(255 , 255, 255, 0.95 )' , // White text for legend like Bitcoin chart
180206 } ,
181207 } ,
182208 filler : {
@@ -186,21 +212,18 @@ const EditableTable: React.FC = () => {
186212 callbacks : {
187213 label : ( context : any ) => `Total Size: ${ context . raw . toFixed ( 3 ) } GB` ,
188214 } ,
189- backgroundColor : 'rgba(0, 10, 20 , 0.95 )' ,
190- titleColor : 'rgba(0, 255, 255, 1) ' , // Liquid cyan
191- bodyColor : 'rgba(255, 255, 255, 0.9 )' ,
192- borderColor : 'rgba(0, 255, 255, 0.3) ' ,
215+ backgroundColor : 'rgba(0, 0, 0 , 0.8 )' ,
216+ titleColor : '#06B6D4 ' , // Primary color like Bitcoin chart
217+ bodyColor : 'rgba(255, 255, 255, 0.95 )' ,
218+ borderColor : '#06B6D4 ' ,
193219 borderWidth : 1 ,
194- cornerRadius : 8 ,
195- displayColors : false ,
196- padding : 12 ,
197220 } ,
198221 } ,
199222 layout : {
200223 padding : 0 ,
201224 } ,
202225 animation : {
203- duration : 800 ,
226+ duration : 1000 ,
204227 easing : 'easeInOutQuart' ,
205228 } ,
206229 hover : {
@@ -222,16 +245,18 @@ const EditableTable: React.FC = () => {
222245 backgroundColor : ( context : any ) => {
223246 const ctx = context . chart . ctx ;
224247 const gradient = ctx . createLinearGradient ( 0 , 0 , 0 , 400 ) ;
225- gradient . addColorStop ( 0 , 'rgba(0, 255, 255, 0.3 )' ) ; // Liquid cyan
226- gradient . addColorStop ( 1 , 'rgba(0, 255, 255, 0.02 )' ) ; // Fade to transparent
248+ gradient . addColorStop ( 0 , 'rgba(0, 255, 255, 0.15 )' ) ; // Match Bitcoin chart gradient
249+ gradient . addColorStop ( 1 , 'rgba(0, 255, 255, 0.05 )' ) ; // Subtle fade
227250 return gradient ;
228251 } ,
229- borderColor : 'rgba(0, 255, 255, 0.8) ' , // Liquid cyan border
230- pointBackgroundColor : 'rgba(0, 255, 255, 0.9) ' ,
231- pointBorderColor : 'rgba(0 , 255, 255, 0.5 )' ,
232- pointHoverBackgroundColor : '#00FFFF ' ,
233- pointHoverBorderColor : 'rgba(0, 255, 255, 1) ' ,
252+ borderColor : '#06B6D4 ' , // Match liquid blue theme primary color (from Bitcoin chart)
253+ pointBackgroundColor : '#06B6D4 ' ,
254+ pointBorderColor : 'rgba(255 , 255, 255, 0.95 )' , // White border like Bitcoin chart
255+ pointHoverBackgroundColor : 'rgba(255, 255, 255, 0.95) ' ,
256+ pointHoverBorderColor : '#06B6D4 ' ,
234257 tension : 0.4 ,
258+ pointRadius : 4 ,
259+ pointHoverRadius : 6 ,
235260 } ,
236261 ] ,
237262 } ;
0 commit comments