pull/4774/head
Joseph Izang 8 months ago
parent 16917eb070
commit 36454a41dd
  1. 8
      apps/remix-ide/src/app/components/status-bar.tsx
  2. 2
      apps/remix-ide/src/app/tabs/settings-tab.tsx
  3. 11
      libs/remix-ui/statusbar/src/lib/components/aiStatus.tsx
  4. 11
      libs/remix-ui/statusbar/src/lib/components/gitStatus.tsx

@ -49,8 +49,12 @@ export class StatusBar extends Plugin implements StatusBarInterface {
this.renderComponent()
}
async isAIActive(aiActive: any) {
this.isAiActive = aiActive
async isAIActive() {
let aiActive
this.on('settings', 'copilotChoiceUpdated', async (isChecked) => {
aiActive = isChecked
this.isAiActive = isChecked
})
this.renderComponent()
return aiActive
}

@ -97,7 +97,7 @@ module.exports = class SettingsTab extends ViewPlugin {
updateCopilotChoice(isChecked) {
this.config.set('settings/copilot/suggest/activate', isChecked)
this.useCopilot = isChecked
this.call('statusbar', 'isAIActive', isChecked)
this.emit('copilotChoiceUpdated', isChecked)
this.dispatch({
...this
})

@ -15,7 +15,6 @@ export default function AIStatus(props: AIStatusProps) {
const run = async () => {
props.plugin.on('fileManager', 'currentFileChanged', async (isAiActive) => {
const aiActivate = await props.plugin.call('settings', 'get', 'settings/copilot/suggest/activate')
console.log('copilot active', aiActivate)
setCopilotActive(aiActivate)
})
}
@ -24,17 +23,15 @@ export default function AIStatus(props: AIStatusProps) {
useEffect(() => {
const run = async () => {
props.plugin.on('filePanel', 'workspaceInitializationCompleted', async (work) => {
const aiActivate = await props.plugin.call('settings', 'get', 'settings/copilot/suggest/activate')
const active = await props.plugin.isAIActive(aiActivate)
setCopilotActive(active)
props.plugin.on('settings', 'copilotChoiceUpdated', async (isChecked) => {
await props.plugin.isAIActive()
setCopilotActive(isChecked)
})
console.log('copilot active', copilotActive)
}
run()
}, [props.plugin.isAiActive])
return (
<div className="d-flex flex-row p-1 text-white justify-content-center align-items-center">
<div className="d-flex flex-row pr-2 text-white justify-content-center align-items-center">
<span className={copilotActive === false ? "fa-regular fa-microchip-ai ml-1 text-danger" : "fa-regular fa-microchip-ai ml-1"}></span>
<span className={copilotActive === false ? "small mx-1 text-danger" : "small mx-1" }>Remix Copilot</span>
</div>

@ -41,15 +41,6 @@ export default function GitStatus({ plugin, gitBranchName, setGitBranchName }: G
run()
}, [gitBranchName, plugin.isGitRepo])
useEffect(() => {
const run = async () => {
plugin.on('settings', 'copilotChoiceChanged', (isAiActive) => {
console.log('copilot active', isAiActive)
})
}
run()
}, [])
const lightDgitUp = async () => {
const isActive = await plugin.call('manager', 'isActive', 'dgit')
const isGit = await plugin.call('fileManager', 'isGitRepo')
@ -61,7 +52,7 @@ export default function GitStatus({ plugin, gitBranchName, setGitBranchName }: G
return (
<div
className="d-flex flex-row p-1 text-white justify-content-center align-items-center remixui_statusbar_gitstatus"
className="d-flex flex-row pl-3 text-white justify-content-center align-items-center remixui_statusbar_gitstatus"
onClick={async () => await lightDgitUp()}
>
{gitBranchName.length > 0 && gitBranchName !== 'Not a git repo' && <span className="fa-regular fa-code-branch ml-1"></span>}

Loading…
Cancel
Save