@@ -39,11 +39,24 @@ interface ChunkContextMenuProps {
3939 * Whether add chunk is disabled
4040 */
4141 disableAddChunk ?: boolean
42+ /**
43+ * Number of selected chunks (for batch operations)
44+ */
45+ selectedCount ?: number
46+ /**
47+ * Number of enabled chunks in selection
48+ */
49+ enabledCount ?: number
50+ /**
51+ * Number of disabled chunks in selection
52+ */
53+ disabledCount ?: number
4254}
4355
4456/**
4557 * Context menu for chunks table.
4658 * Shows chunk actions when right-clicking a row, or "Create chunk" when right-clicking empty space.
59+ * Supports batch operations when multiple chunks are selected.
4760 */
4861export function ChunkContextMenu ( {
4962 isOpen,
@@ -61,7 +74,20 @@ export function ChunkContextMenu({
6174 disableToggleEnabled = false ,
6275 disableDelete = false ,
6376 disableAddChunk = false ,
77+ selectedCount = 1 ,
78+ enabledCount = 0 ,
79+ disabledCount = 0 ,
6480} : ChunkContextMenuProps ) {
81+ const isMultiSelect = selectedCount > 1
82+
83+ const getToggleLabel = ( ) => {
84+ if ( isMultiSelect ) {
85+ if ( disabledCount > 0 ) return 'Enable'
86+ return 'Disable'
87+ }
88+ return isChunkEnabled ? 'Disable' : 'Enable'
89+ }
90+
6591 return (
6692 < Popover open = { isOpen } onOpenChange = { onClose } variant = 'secondary' size = 'sm' >
6793 < PopoverAnchor
@@ -76,7 +102,7 @@ export function ChunkContextMenu({
76102 < PopoverContent ref = { menuRef } align = 'start' side = 'bottom' sideOffset = { 4 } >
77103 { hasChunk ? (
78104 < >
79- { onOpenInNewTab && (
105+ { ! isMultiSelect && onOpenInNewTab && (
80106 < PopoverItem
81107 onClick = { ( ) => {
82108 onOpenInNewTab ( )
@@ -86,7 +112,7 @@ export function ChunkContextMenu({
86112 Open in new tab
87113 </ PopoverItem >
88114 ) }
89- { onEdit && (
115+ { ! isMultiSelect && onEdit && (
90116 < PopoverItem
91117 onClick = { ( ) => {
92118 onEdit ( )
@@ -96,7 +122,7 @@ export function ChunkContextMenu({
96122 Edit
97123 </ PopoverItem >
98124 ) }
99- { onCopyContent && (
125+ { ! isMultiSelect && onCopyContent && (
100126 < PopoverItem
101127 onClick = { ( ) => {
102128 onCopyContent ( )
@@ -114,7 +140,7 @@ export function ChunkContextMenu({
114140 onClose ( )
115141 } }
116142 >
117- { isChunkEnabled ? 'Disable' : 'Enable' }
143+ { getToggleLabel ( ) }
118144 </ PopoverItem >
119145 ) }
120146 { onDelete && (
0 commit comments