fixing modal for consent

aiui_fix
lianahus 12 months ago
parent 9ab946a675
commit 56bfd93b8f
  1. 11
      libs/remix-ui/settings/src/lib/remix-ui-settings.tsx

@ -133,7 +133,7 @@ export const RemixUiSettings = (props: RemixUiSettingsProps) => {
console.log("useEffect on useCopilot") console.log("useEffect on useCopilot")
if (props.useCopilot !== null) copilotActivate(props.config, props.useCopilot, dispatch) if (props.useCopilot !== null) copilotActivate(props.config, props.useCopilot, dispatch)
if (props.useCopilot) { if (props.useCopilot) {
const a = async () => await onchangeCopilotActivate() onchangeCopilotActivate()
} }
console.log("useEffect on useCopilot finish") console.log("useEffect on useCopilot finish")
}, [props.useCopilot]) }, [props.useCopilot])
@ -146,7 +146,7 @@ export const RemixUiSettings = (props: RemixUiSettingsProps) => {
textWrapEventAction(props.config, props.editor, event.target.checked, dispatch) textWrapEventAction(props.config, props.editor, event.target.checked, dispatch)
} }
const onchangeCopilotActivate = async () => { const onchangeCopilotActivate = () => {
console.log("onchangeCopilotActivate ", props.useCopilot) console.log("onchangeCopilotActivate ", props.useCopilot)
if (!props.useCopilot) { if (!props.useCopilot) {
copilotActivate(props.config, props.useCopilot, dispatch) copilotActivate(props.config, props.useCopilot, dispatch)
@ -175,8 +175,8 @@ export const RemixUiSettings = (props: RemixUiSettingsProps) => {
id: 'loadcopilotActivate', id: 'loadcopilotActivate',
title: 'Download Solidity copilot', title: 'Download Solidity copilot',
modalType: ModalTypes.default, modalType: ModalTypes.default,
okLabel: 'OK', okLabel: 'Hide',
//cancelLabel: 'Cancel', cancelLabel: 'Cancel',
message, message,
okFn: async() => { okFn: async() => {
consentGivenForAI = CONSENT.GIVEN consentGivenForAI = CONSENT.GIVEN
@ -195,6 +195,7 @@ export const RemixUiSettings = (props: RemixUiSettingsProps) => {
} }
if (consentGivenForAI === CONSENT.NOT_ASKED) { if (consentGivenForAI === CONSENT.NOT_ASKED) {
console.log("CONSENT.NOT_ASKED modal")
props.plugin.call('notification', 'modal', modalActivate) props.plugin.call('notification', 'modal', modalActivate)
} else if (consentGivenForAI === CONSENT.GIVEN) { } else if (consentGivenForAI === CONSENT.GIVEN) {
startCopilot() startCopilot()
@ -202,7 +203,7 @@ export const RemixUiSettings = (props: RemixUiSettingsProps) => {
// NOT_GIVEN // NOT_GIVEN
} }
if (await props.plugin.call('copilot-suggestion', 'status')) { if (props.plugin.call('copilot-suggestion', 'status')) {
copilotActivate(props.config, true, dispatch) copilotActivate(props.config, true, dispatch)
} else { } else {
props.plugin.call('copilot-suggestion', 'uninstall') props.plugin.call('copilot-suggestion', 'uninstall')

Loading…
Cancel
Save