@@ -5,6 +5,7 @@ import React, {useState, useRef, useEffect, useReducer} from 'react' // eslint-d
55import { FormattedMessage } from 'react-intl'
66import { Tab , Tabs , TabList , TabPanel } from 'react-tabs'
77import './remix-ui-tabs.css'
8+ import { values } from 'lodash'
89const _paq = ( window . _paq = window . _paq || [ ] )
910
1011/* eslint-disable-next-line */
@@ -64,7 +65,6 @@ export const TabsUI = (props: TabsUIProps) => {
6465 const tabsRef = useRef ( { } )
6566 const tabsElement = useRef ( null )
6667 const [ ai_switch , setAI_switch ] = useState < boolean > ( false )
67-
6868 const tabs = useRef ( props . tabs )
6969 tabs . current = props . tabs // we do this to pass the tabs list to the onReady callbacks
7070
@@ -77,6 +77,14 @@ export const TabsUI = (props: TabsUIProps) => {
7777 }
7878 } , [ tabsState . selectedIndex ] )
7979
80+ const getAI = async ( ) => {
81+ try {
82+ return await props . plugin . call ( 'settings' , 'getCopilotSetting' )
83+ } catch ( e ) {
84+ return false
85+ }
86+ }
87+
8088 const getFileDecorationClasses = ( tab : any ) => {
8189 const fileDecoration = tabsState . fileDecorations . find ( ( fileDecoration : fileDecoration ) => {
8290 if ( `${ fileDecoration . workspace . name } /${ fileDecoration . path } ` === tab . name ) return true
@@ -92,7 +100,6 @@ export const TabsUI = (props: TabsUIProps) => {
92100 const classNameImg = 'my-1 mr-1 text-dark ' + tab . iconClass
93101 const classNameTab = 'nav-item nav-link d-flex justify-content-center align-items-center px-2 py-1 tab' + ( index === currentIndexRef . current ? ' active' : '' )
94102 const invert = props . themeQuality === 'dark' ? 'invert(1)' : 'invert(0)'
95-
96103 return (
97104 < CustomTooltip tooltipId = "tabsActive" tooltipText = { tab . tooltip } placement = "bottom-start" >
98105 < div
@@ -133,6 +140,7 @@ export const TabsUI = (props: TabsUIProps) => {
133140 }
134141
135142 const setFileDecorations = ( fileStates : fileDecoration [ ] ) => {
143+ getAI ( ) . then ( value => setAI_switch ( value ) ) . catch ( error => console . log ( error ) )
136144 dispatch ( { type : 'SET_FILE_DECORATIONS' , payload : fileStates } )
137145 }
138146
@@ -208,6 +216,7 @@ export const TabsUI = (props: TabsUIProps) => {
208216 < i className = "fas fa-play" > </ i >
209217 </ button >
210218 </ CustomTooltip >
219+
211220 < div className = "d-flex border-left ml-2 align-items-center" style = { { height : "3em" } } >
212221 < CustomTooltip
213222 placement = "bottom"
0 commit comments