@@ -5,6 +5,7 @@ import { useCallback, useMemo } from 'react';
55
66import  {  Flex ,  Tooltip ,  TooltipTrigger  }  from  '@geti/ui' ; 
77import  {  isEmpty  }  from  'lodash-es' ; 
8+ import  {  useHotkeys  }  from  'react-hotkeys-hook' ; 
89import  {  useLocalStorage  }  from  'usehooks-ts' ; 
910
1011import  {  Annotation  }  from  '../../../../../core/annotations/annotation.interface' ; 
@@ -15,6 +16,8 @@ import { useProjectIdentifier } from '../../../../../hooks/use-project-identifie
1516import  {  LOCAL_STORAGE_KEYS  }  from  '../../../../../shared/local-storage-keys' ; 
1617import  {  getId ,  getIds ,  hasEqualId  }  from  '../../../../../shared/utils' ; 
1718import  {  AnnotationToolContext ,  ToolSettings ,  ToolType  }  from  '../../../core/annotation-tool-context.interface' ; 
19+ import  {  useAnnotatorHotkeys  }  from  '../../../hooks/use-hotkeys-configuration.hook' ; 
20+ import  {  HOTKEY_OPTIONS  }  from  '../../../hot-keys/utils' ; 
1821import  {  getOutputFromTask  }  from  '../../../providers/task-chain-provider/utils' ; 
1922import  {  useTask  }  from  '../../../providers/task-provider/task-provider.component' ; 
2023import  {  LabelsHotkeys  }  from  '../../labels/labels-hotkeys/labels-hotkeys.component' ; 
@@ -39,6 +42,7 @@ const hasNotAnomalousNorLocalLabels = (annotation: Annotation) =>
3942export  const  LabelsShortcuts  =  ( {  labels,  annotationToolContext,  isDisabled =  false  } : LabelsShortcutsProps )  =>  { 
4043    const  {  selectedTask,  tasks,  setDefaultLabel }  =  useTask ( ) ; 
4144    const  {  projectId }  =  useProjectIdentifier ( ) ; 
45+     const  {  hotkeys }  =  useAnnotatorHotkeys ( ) ; 
4246    const  { 
4347        isDrawing, 
4448        annotations : annotationsScene , 
@@ -111,6 +115,21 @@ export const LabelsShortcuts = ({ labels, annotationToolContext, isDisabled = fa
111115        return  isDrawingSmartTool  ? smartToolHandler ( label )  : clickHandler ( label ) ; 
112116    } ; 
113117
118+     const  emptyLabel  =  labels . find ( ( label )  =>  isEmptyLabel ( label ) ) ; 
119+ 
120+     useHotkeys ( 
121+         hotkeys [ 'empty-label' ] , 
122+         ( event )  =>  { 
123+             event . preventDefault ( ) ; 
124+ 
125+             if  ( emptyLabel  &&  selectedAnnotations . length  >  0 )  { 
126+                 handleSelectLabelShortcut ( emptyLabel ) ; 
127+             } 
128+         } , 
129+         HOTKEY_OPTIONS , 
130+         [ emptyLabel ,  selectedAnnotations ,  handleSelectLabelShortcut ,  hotkeys ] 
131+     ) ; 
132+ 
114133    return  ( 
115134        < div  aria-label = 'Label shortcuts'  role = 'list' > 
116135            { ! isDisabled  &&  ( 
0 commit comments