Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Remix copilot status in status bar #5168

Merged
merged 6 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,13 @@ module.exports = {
.waitForElementPresent('#solidityUnittestsOutput div[class^="testPass"]', 60000)
.waitForElementContainsText('#solidityUnittestsOutput', 'tests/hhLogs_test.sol', 60000)
.pause(2000)
.assert.containsText('#journal > div:nth-child(4) > span', 'Before all:')
.assert.containsText('#journal > div:nth-child(4) > span', 'Inside beforeAll')
.assert.containsText('#journal > div:nth-child(5) > span', 'Check sender:')
.assert.containsText('#journal > div:nth-child(5) > span', 'msg.sender is 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4')
.assert.containsText('#journal > div:nth-child(6) > span', 'Check int logs:')
.assert.containsText('#journal > div:nth-child(6) > span', '10 20')
.assert.containsText('#journal > div:nth-child(6) > span', 'Number is 25')
.assert.textContains('#journal > div:nth-child(3) > span', 'Before all:')
.assert.textContains('#journal > div:nth-child(3) > span', 'Inside beforeAll')
.assert.textContains('#journal > div:nth-child(4) > span', 'Check sender:')
.assert.textContains('#journal > div:nth-child(4) > span', 'msg.sender is 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4')
.assert.textContains('#journal > div:nth-child(5) > span', 'Check int logs:')
.assert.textContains('#journal > div:nth-child(5) > span', '10 20')
.assert.textContains('#journal > div:nth-child(5) > span', 'Number is 25')
.openFile('tests/hhLogs_test.sol')
.removeFile('tests/hhLogs_test.sol', 'workspace_new')
},
Expand Down
6 changes: 3 additions & 3 deletions apps/remix-ide/src/app/tabs/locales/en/remixUiTabs.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"remixUiTabs.tooltipText3": "Select .sol or .yul file to compile OR a .ts or .js file to run",
"remixUiTabs.tooltipText4": "To explain a contract, choose a .sol file",
"remixUiTabs.tooltipText5": "Explain the contract(s) in current file [BETA]",
"remixUiTabs.tooltipText6": "Enable Remix AI Copilot [BETA]",
"remixUiTabs.tooltipText7": "Disable Remix AI Copilot [BETA]",
"remixUiTabs.tooltipText6": "Enable RemixAI Copilot [BETA]",
"remixUiTabs.tooltipText7": "Disable RemixAI Copilot [BETA]",
"remixUiTabs.tooltipText8": "Remix AI Tools Documentation",
"remixUiTabs.tooltipTextDisabledCopilot": "To use Remix AI Copilot, choose a .sol file",
"remixUiTabs.tooltipTextDisabledCopilot": "To use RemixAI Copilot, choose a .sol file",
"remixUiTabs.zoomOut": "Zoom out",
"remixUiTabs.zoomIn": "Zoom in"
}
2 changes: 0 additions & 2 deletions libs/remix-ui/settings/src/lib/remix-ui-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,11 @@ export const RemixUiSettings = (props: RemixUiSettingsProps) => {
const onchangeCopilotActivate = () => {
if (!props.useCopilot) {
copilotActivate(props.config, props.useCopilot, dispatch)
props.plugin.call('terminal', 'log', { type: 'typewriterlog', value: `Solidity copilot not activated!` })
return
}

const startCopilot = async () => {
copilotActivate(props.config, props.useCopilot, dispatch)
props.plugin.call('terminal', 'log', { type: 'typewriterlog', value: `Solidity copilot activated!` })
}

startCopilot()
Expand Down
14 changes: 6 additions & 8 deletions libs/remix-ui/statusbar/src/lib/components/aiStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ export default function AIStatus(props: AIStatusProps) {
const [copilotActive, setCopilotActive] = useState(false)
useEffect(() => {
const run = async () => {
props.plugin.on('fileManager', 'currentFileChanged', async (isAiActive) => {
const aiActivate = await props.plugin.call('settings', 'get', 'settings/copilot/suggest/activate')
setCopilotActive(aiActivate)
})
const aiActivate = await props.plugin.call('settings', 'get', 'settings/copilot/suggest/activate')
setCopilotActive(aiActivate)
}
run()
}, [props.plugin.isAiActive, props.isAiActive])
}, [])

useEffect(() => {
const run = async () => {
Expand All @@ -30,14 +28,14 @@ export default function AIStatus(props: AIStatusProps) {
})
}
run()
}, [props.plugin.isAiActive])
}, [props.plugin.isAiActive, props.plugin.isAiActive])
return (
<CustomTooltip
tooltipText={copilotActive ? "Remix Copilot activated" : "Remix Copilot disabled. To activate copilot, open a .sol file and toggle the ai switch at the top of the Ide"}
tooltipText={copilotActive ? "RemixAI Copilot enabled" : "RemixAI Copilot disabled. To enable, open a .sol file and toggle the switch at the left-top of the editor"}
>
<div className="d-flex flex-row pr-2 text-white justify-content-center align-items-center">
<span className={copilotActive === false ? "small mx-1 text-white semi-bold" : "small mx-1 text-white semi-bold" }>
{copilotActive === false ? 'Remix Copilot (disabled)' : 'Remix Copilot (enabled)'}
{copilotActive === false ? 'RemixAI Copilot (disabled)' : 'RemixAI Copilot (enabled)'}
</span>
</div>
</CustomTooltip>
Expand Down
Loading