@@ -2,7 +2,7 @@ import Statuses from "@/src/components/shared/statuses/Statuses";
22import { selectAllLookupLists , setAllLookupLists } from "@/src/reduxStore/states/pages/lookup-lists" ;
33import { selectAttributes , selectVisibleAttributeAC , setAllAttributes , setLabelingTasksAll , updateAttributeById } from "@/src/reduxStore/states/pages/settings" ;
44import { selectProjectId } from "@/src/reduxStore/states/project"
5- import { Attribute , AttributeState , LLMConfig } from "@/src/types/components/projects/projectId/settings/data-schema" ;
5+ import { Attribute , AttributeState , AttributeWithOnClick , LLMConfig } from "@/src/types/components/projects/projectId/settings/data-schema" ;
66import { DataTypeEnum } from "@/src/types/shared/general" ;
77import { LLM_PROVIDER_OPTIONS , postProcessCurrentAttribute } from "@/src/util/components/projects/projectId/settings/attribute-calculation-helper" ;
88import { ATTRIBUTES_VISIBILITY_STATES , DATA_TYPES , getTooltipVisibilityState } from "@/src/util/components/projects/projectId/settings/data-schema-helper" ;
@@ -318,6 +318,10 @@ export default function AttributeCalculation() {
318318 [ ]
319319 ) ;
320320
321+ const usableAttributesFinal = useMemo ( ( ) => usableAttributes . map ( ( attribute ) => (
322+ { ...attribute , onClick : copyToClipboardFunc ( attribute . name ) }
323+ ) ) , [ usableAttributes ] ) ;
324+
321325 const disabledOptions = useMemo ( ( ) => {
322326 if ( ! currentAttribute || currentAttribute . dataType == DataTypeEnum . LLM_RESPONSE ) return undefined ;
323327 return DATA_TYPES . map ( ( e ) => e . value == DataTypeEnum . LLM_RESPONSE ) ;
@@ -387,10 +391,10 @@ export default function AttributeCalculation() {
387391 </ div >
388392 < div className = "text-sm leading-5 font-medium text-gray-700 inline-block" > Attributes</ div >
389393 < div className = "flex flex-row items-center" >
390- { usableAttributes . length == 0 && < div className = "text-sm font-normal text-gray-500" > No usable attributes.</ div > }
391- { usableAttributes . map ( ( attribute : Attribute ) => (
394+ { usableAttributesFinal . length == 0 && < div className = "text-sm font-normal text-gray-500" > No usable attributes.</ div > }
395+ { usableAttributesFinal . map ( ( attribute : AttributeWithOnClick ) => (
392396 < Tooltip key = { attribute . id } content = { attribute . dataTypeName + ' - ' + TOOLTIPS_DICT . GENERAL . CLICK_TO_COPY } color = "invert" placement = "top" >
393- < span onClick = { copyToClipboardFunc ( attribute . name ) } >
397+ < span onClick = { attribute . onClick } >
394398 < div className = { `cursor-pointer border items-center px-2 py-0.5 rounded text-xs font-medium text-center mr-2 ${ 'bg-' + attribute . color + '-100' } ${ 'text-' + attribute . color + '-700' } ${ 'border-' + attribute . color + '-400' } ${ 'hover:bg-' + attribute . color + '-200' } ` } >
395399 { attribute . name }
396400 </ div >
0 commit comments