@@ -5,6 +5,7 @@ import React, {useState, useRef, useEffect, useReducer} from 'react' // eslint-d
5
5
import { FormattedMessage } from 'react-intl'
6
6
import { Tab , Tabs , TabList , TabPanel } from 'react-tabs'
7
7
import './remix-ui-tabs.css'
8
+ import { values } from 'lodash'
8
9
const _paq = ( window . _paq = window . _paq || [ ] )
9
10
10
11
/* eslint-disable-next-line */
@@ -64,7 +65,6 @@ export const TabsUI = (props: TabsUIProps) => {
64
65
const tabsRef = useRef ( { } )
65
66
const tabsElement = useRef ( null )
66
67
const [ ai_switch , setAI_switch ] = useState < boolean > ( false )
67
-
68
68
const tabs = useRef ( props . tabs )
69
69
tabs . current = props . tabs // we do this to pass the tabs list to the onReady callbacks
70
70
@@ -77,6 +77,14 @@ export const TabsUI = (props: TabsUIProps) => {
77
77
}
78
78
} , [ tabsState . selectedIndex ] )
79
79
80
+ const getAI = async ( ) => {
81
+ try {
82
+ return await props . plugin . call ( 'settings' , 'getCopilotSetting' )
83
+ } catch ( e ) {
84
+ return false
85
+ }
86
+ }
87
+
80
88
const getFileDecorationClasses = ( tab : any ) => {
81
89
const fileDecoration = tabsState . fileDecorations . find ( ( fileDecoration : fileDecoration ) => {
82
90
if ( `${ fileDecoration . workspace . name } /${ fileDecoration . path } ` === tab . name ) return true
@@ -92,7 +100,6 @@ export const TabsUI = (props: TabsUIProps) => {
92
100
const classNameImg = 'my-1 mr-1 text-dark ' + tab . iconClass
93
101
const classNameTab = 'nav-item nav-link d-flex justify-content-center align-items-center px-2 py-1 tab' + ( index === currentIndexRef . current ? ' active' : '' )
94
102
const invert = props . themeQuality === 'dark' ? 'invert(1)' : 'invert(0)'
95
-
96
103
return (
97
104
< CustomTooltip tooltipId = "tabsActive" tooltipText = { tab . tooltip } placement = "bottom-start" >
98
105
< div
@@ -133,6 +140,7 @@ export const TabsUI = (props: TabsUIProps) => {
133
140
}
134
141
135
142
const setFileDecorations = ( fileStates : fileDecoration [ ] ) => {
143
+ getAI ( ) . then ( value => setAI_switch ( value ) ) . catch ( error => console . log ( error ) )
136
144
dispatch ( { type : 'SET_FILE_DECORATIONS' , payload : fileStates } )
137
145
}
138
146
@@ -208,6 +216,7 @@ export const TabsUI = (props: TabsUIProps) => {
208
216
< i className = "fas fa-play" > </ i >
209
217
</ button >
210
218
</ CustomTooltip >
219
+
211
220
< div className = "d-flex border-left ml-2 align-items-center" style = { { height : "3em" } } >
212
221
< CustomTooltip
213
222
placement = "bottom"
0 commit comments