11import React from 'react' ;
22import produce from 'immer' ;
33import { parseAsArrayOf , parseAsJson , useQueryState } from 'nuqs' ;
4- import { ChartConfigWithDateRange } from '@hyperdx/common-utils/dist/types' ;
54
65import DBRowSidePanel from '@/components/DBRowSidePanel' ;
76
87type SidePanelState = {
98 sid : string ;
109 rw : string ;
11- tcfg ?: ChartConfigWithDateRange ;
1210} ;
1311
1412type SidePanelStack = SidePanelState [ ] ;
1513
1614export const useRowSidePanel = ( ) => {
1715 const [ sidePanelStack , setSidePanelStack ] = useQueryState < SidePanelStack > (
18- 'drawer ' ,
16+ 'rowDetails ' ,
1917 parseAsArrayOf ( parseAsJson ( ) ) ,
2018 ) ;
2119
@@ -54,13 +52,8 @@ export const useRowSidePanel = () => {
5452
5553 // Row Side Panel
5654 const openRowSidePanel = React . useCallback (
57- (
58- sid : string ,
59- rw : string ,
60- tcfg ?: ChartConfigWithDateRange ,
61- replace ?: boolean ,
62- ) => {
63- pushSidePanel ( { sid, rw, tcfg } , replace ) ;
55+ ( sid : string , rw : string , replace ?: boolean ) => {
56+ pushSidePanel ( { sid, rw } , replace ) ;
6457 } ,
6558 [ pushSidePanel ] ,
6659 ) ;
@@ -73,22 +66,21 @@ export const useRowSidePanel = () => {
7366 } ;
7467} ;
7568
76- export const RowSidePanels = ( ) => {
69+ export const RowSidePanels : React . FC = ( ) => {
7770 const { sidePanelStack, closeSidePanel } = useRowSidePanel ( ) ;
7871
79- if ( ! sidePanelStack ) {
80- return null ;
81- }
82-
83- return sidePanelStack . map ( ( sidePanel , index ) => (
84- < DBRowSidePanel
85- key = { index }
86- onClose = { ( ) => closeSidePanel ( index ) }
87- rowId = { sidePanel . rw }
88- sourceId = { sidePanel . sid }
89- zIndexOffset = { index }
90- dbSqlRowTableConfig = { sidePanel . tcfg }
91- isTopPanel = { index === sidePanelStack . length - 1 }
92- />
93- ) ) ;
72+ return (
73+ < >
74+ { sidePanelStack ?. map ( ( sidePanel , index ) => (
75+ < DBRowSidePanel
76+ key = { index }
77+ onClose = { ( ) => closeSidePanel ( index ) }
78+ rowId = { sidePanel . rw }
79+ sourceId = { sidePanel . sid }
80+ zIndexOffset = { index }
81+ isTopPanel = { index === sidePanelStack . length - 1 }
82+ />
83+ ) ) }
84+ </ >
85+ ) ;
9486} ;
0 commit comments