@@ -39,11 +39,9 @@ export const ListDisplay = ({ dataKey, type }: { dataKey: string; type: ListData
39
39
< InfiniteScroll query = { query } >
40
40
< div className = "pr-3" >
41
41
< table className = "w-full" >
42
- < ItemContextMenu dataKey = { dataKey } type = { type } >
43
- < tbody >
44
- < ListItems dataKey = { dataKey } type = { type } query = { query } />
45
- </ tbody >
46
- </ ItemContextMenu >
42
+ < tbody >
43
+ < ListItems dataKey = { dataKey } type = { type } query = { query } />
44
+ </ tbody >
47
45
</ table >
48
46
</ div >
49
47
</ InfiniteScroll >
@@ -52,7 +50,7 @@ export const ListDisplay = ({ dataKey, type }: { dataKey: string; type: ListData
52
50
)
53
51
}
54
52
55
- export type ItemData = {
53
+ type ItemData = {
56
54
key : string
57
55
value ?: string
58
56
}
@@ -77,58 +75,56 @@ export const ListItems = ({
77
75
return (
78
76
< >
79
77
{ keys . map ( ( { key, value } , i ) => (
80
- < tr
78
+ < ItemContextMenu
81
79
key = { `${ dataKey } -${ key } -${ i } ` }
82
- data-item-key = { key }
83
- data-item-value = { value }
84
- onClick = { ( ) => {
85
- setSelectedListItem ( { key, value } )
86
- } }
87
- className = "h-10 border-b border-b-zinc-100 hover:bg-zinc-50"
80
+ dataKey = { dataKey }
81
+ type = { type }
82
+ itemKey = { key }
83
+ itemValue = { value }
88
84
>
89
- < td
90
- className = { cn (
91
- "cursor-pointer truncate px-3" ,
92
- type === "list" || type === "stream" ? "w-32 min-w-24" : "max-w-0"
93
- ) }
85
+ < tr
86
+ onClick = { ( ) => {
87
+ setSelectedListItem ( { key , value } )
88
+ } }
89
+ className = "h-10 border-b border-b-zinc-100 hover:bg-zinc-50"
94
90
>
95
- { key }
96
- </ td >
97
- { value !== undefined && (
98
91
< td
99
- className = { cn ( "cursor-pointer truncate px-3" , type === "zset" ? "w-24" : "max-w-0" ) }
92
+ className = { cn (
93
+ "cursor-pointer truncate px-3" ,
94
+ type === "list" || type === "stream" ? "w-32 min-w-24" : "max-w-0"
95
+ ) }
100
96
>
101
- { value }
97
+ { key }
102
98
</ td >
103
- ) }
104
- { type !== "stream" && (
105
- < td
106
- width = { 20 }
107
- className = "px-3"
108
- onClick = { ( e ) => {
109
- e . stopPropagation ( )
110
- } }
111
- >
112
- < DeleteAlertDialog
113
- deletionType = "item"
114
- onDeleteConfirm = { ( e ) => {
115
- e . stopPropagation ( )
116
- editItem ( {
117
- type,
118
- dataKey,
119
- itemKey : key ,
120
- // For deletion
121
- newKey : undefined ,
122
- } )
123
- } }
99
+ { value !== undefined && (
100
+ < td
101
+ className = { cn ( "cursor-pointer truncate px-3" , type === "zset" ? "w-24" : "max-w-0" ) }
124
102
>
125
- < Button size = "icon-sm" variant = "secondary" onClick = { ( e ) => e . stopPropagation ( ) } >
126
- < IconTrash className = "size-4 text-zinc-500" />
127
- </ Button >
128
- </ DeleteAlertDialog >
129
- </ td >
130
- ) }
131
- </ tr >
103
+ { value }
104
+ </ td >
105
+ ) }
106
+ { type !== "stream" && (
107
+ < td width = { 20 } className = "px-3" >
108
+ < DeleteAlertDialog
109
+ onDeleteConfirm = { ( e ) => {
110
+ e . stopPropagation ( )
111
+ editItem ( {
112
+ type,
113
+ dataKey,
114
+ itemKey : key ,
115
+ // For deletion
116
+ newKey : undefined ,
117
+ } )
118
+ } }
119
+ >
120
+ < Button size = "icon-sm" variant = "secondary" onClick = { ( e ) => e . stopPropagation ( ) } >
121
+ < IconTrash className = "size-4 text-zinc-500" />
122
+ </ Button >
123
+ </ DeleteAlertDialog >
124
+ </ td >
125
+ ) }
126
+ </ tr >
127
+ </ ItemContextMenu >
132
128
) ) }
133
129
</ >
134
130
)
0 commit comments