Update remix-ui-tabs.tsx

pull/5370/head
Liana Husikyan 7 months ago committed by Aniket
parent 4e65488eee
commit 45e355fb14
  1. 127
      libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx

@ -208,72 +208,71 @@ export const TabsUI = (props: TabsUIProps) => {
<i className="fas fa-play"></i> <i className="fas fa-play"></i>
</button> </button>
</CustomTooltip> </CustomTooltip>
<div className= "border-left ml-2" style={{ height: "3em" }}></div> <div className= "d-flex"
<CustomTooltip <CustomTooltip
placement="bottom" placement="bottom"
tooltipId="overlay-tooltip-explaination" tooltipId="overlay-tooltip-explaination"
tooltipText={ tooltipText={
<span> <span>
{tabsState.currentExt === 'sol'? ( {tabsState.currentExt === 'sol'? (
<FormattedMessage id="remixUiTabs.tooltipText5" /> <FormattedMessage id="remixUiTabs.tooltipText5" />
) : ( ) : (
<FormattedMessage id="remixUiTabs.tooltipText4" /> <FormattedMessage id="remixUiTabs.tooltipText4" />
)} )}
</span> </span>
} }
>
<button
data-id="explain-editor"
id='explain_btn'
className='btn text-ai pl-2 pr-0 py-0 d-flex'
disabled={!(tabsState.currentExt === 'sol') || explaining}
onClick={async () => {
const path = active().substr(active().indexOf('/') + 1, active().length)
const content = await props.plugin.call('fileManager', 'readFile', path)
if (tabsState.currentExt === 'sol') {
setExplaining(true)
await props.plugin.call('solcoder', 'code_explaining', content)
setExplaining(false)
_paq.push(['trackEvent', 'ai', 'solcoder', 'explain_file'])
}
}}
> >
<i className={`fas fa-user-robot ${explaining ? 'loadingExplanation' : ''}`}></i> <button
</button> data-id="explain-editor"
</CustomTooltip> id='explain_btn'
<CustomTooltip className='btn text-ai pl-2 pr-0 py-0 d-flex'
placement="bottom" disabled={!(tabsState.currentExt === 'sol') || explaining}
tooltipId="overlay-tooltip-copilot" onClick={async () => {
tooltipText={ const path = active().substr(active().indexOf('/') + 1, active().length)
<span> const content = await props.plugin.call('fileManager', 'readFile', path)
{ tabsState.currentExt === 'sol'? ( if (tabsState.currentExt === 'sol') {
!ai_switch ? ( setExplaining(true)
<FormattedMessage id="remixUiTabs.tooltipText6" /> await props.plugin.call('solcoder', 'code_explaining', content)
) : (<FormattedMessage id="remixUiTabs.tooltipText7" />) setExplaining(false)
) : ( _paq.push(['trackEvent', 'ai', 'solcoder', 'explain_file'])
<FormattedMessage id="remixUiTabs.tooltipTextDisabledCopilot" /> }
)} }}
</span> >
} <i className={`fas fa-user-robot ${explaining ? 'loadingExplanation' : ''}`}></i>
> </button>
<button </CustomTooltip>
data-id="remix_ai_switch" <CustomTooltip
id='remix_ai_switch' placement="bottom"
className="btn ai-switch text-ai pl-2 pr-0 py-0 d-flex" tooltipId="overlay-tooltip-copilot"
disabled={!(tabsState.currentExt === 'sol' )} tooltipText={
onClick={async () => { <span>
await props.plugin.call('settings', 'updateCopilotChoice', !ai_switch) { tabsState.currentExt === 'sol'? (
setAI_switch(!ai_switch) !ai_switch ? (
ai_switch ? _paq.push(['trackEvent', 'ai', 'solcoder', 'copilot_enabled']) : _paq.push(['trackEvent', 'ai', 'solcoder', 'copilot_disabled']) <FormattedMessage id="remixUiTabs.tooltipText6" />
}} ) : (<FormattedMessage id="remixUiTabs.tooltipText7" />)
) : (
<FormattedMessage id="remixUiTabs.tooltipTextDisabledCopilot" />
)}
</span>
}
> >
<i <button
className={ai_switch ? "fas fa-toggle-on" : "fas fa-toggle-off"} data-id="remix_ai_switch"
></i> id='remix_ai_switch'
</button> className="btn ai-switch text-ai pl-2 pr-0 py-0 d-flex"
</CustomTooltip> disabled={!(tabsState.currentExt === 'sol' )}
onClick={async () => {
<div className= "border-left ml-2" style={{ height: "3em" }}></div> await props.plugin.call('settings', 'updateCopilotChoice', !ai_switch)
setAI_switch(!ai_switch)
ai_switch ? _paq.push(['trackEvent', 'ai', 'solcoder', 'copilot_enabled']) : _paq.push(['trackEvent', 'ai', 'solcoder', 'copilot_disabled'])
}}
>
<i
className={ai_switch ? "fas fa-toggle-on" : "fas fa-toggle-off"}
></i>
</button>
</CustomTooltip>
</div>
<CustomTooltip placement="bottom" tooltipId="overlay-tooltip-zoom-out" tooltipText={<FormattedMessage id="remixUiTabs.zoomOut" />}> <CustomTooltip placement="bottom" tooltipId="overlay-tooltip-zoom-out" tooltipText={<FormattedMessage id="remixUiTabs.zoomOut" />}>
<span data-id="tabProxyZoomOut" className="btn fas fa-search-minus text-dark pl-2 pr-0 py-0 d-flex" onClick={() => props.onZoomOut()}></span> <span data-id="tabProxyZoomOut" className="btn fas fa-search-minus text-dark pl-2 pr-0 py-0 d-flex" onClick={() => props.onZoomOut()}></span>

Loading…
Cancel
Save