@ -3,7 +3,7 @@ import React, { useState, useReducer, useEffect, useCallback } from 'react' // e
import { labels , textDark , textSecondary } from './constants'
import { labels , textDark , textSecondary } from './constants'
import './remix-ui-settings.css'
import './remix-ui-settings.css'
import { ethereumVM , generateContractMetadat , personal , textWrapEventAction , useMatomoAnalytics , saveTokenToast , removeTokenToast , saveSwarmSettingsToast , saveIpfsSettingsToast , useAutoCompletion , useShowGasInEditor , useDisplayErrors } from './settingsAction'
import { generateContractMetadat , personal , textWrapEventAction , useMatomoAnalytics , saveTokenToast , removeTokenToast , saveSwarmSettingsToast , saveIpfsSettingsToast , useAutoCompletion , useShowGasInEditor , useDisplayErrors } from './settingsAction'
import { initialState , toastInitialState , toastReducer , settingReducer } from './settingsReducer'
import { initialState , toastInitialState , toastReducer , settingReducer } from './settingsReducer'
import { Toaster } from '@remix-ui/toaster' // eslint-disable-line
import { Toaster } from '@remix-ui/toaster' // eslint-disable-line
import { RemixUiThemeModule , ThemeModule } from '@remix-ui/theme-module'
import { RemixUiThemeModule , ThemeModule } from '@remix-ui/theme-module'
@ -41,17 +41,14 @@ export const RemixUiSettings = (props: RemixUiSettingsProps) => {
const metadataConfig = props . config . get ( 'settings/generate-contract-metadata' )
const metadataConfig = props . config . get ( 'settings/generate-contract-metadata' )
if ( metadataConfig === undefined || metadataConfig === null ) generateContractMetadat ( props . config , true , dispatch )
if ( metadataConfig === undefined || metadataConfig === null ) generateContractMetadat ( props . config , true , dispatch )
const javascriptVM = props . config . get ( 'settings/always-use-vm' )
if ( javascriptVM === null || javascriptVM === undefined ) ethereumVM ( props . config , true , dispatch )
const useAutoComplete = props . config . get ( 'settings/auto-completion' )
const useAutoComplete = props . config . get ( 'settings/auto-completion' )
if ( useAutoComplete === null || useAutoComplete === undefined ) useAutoCompletion ( props . config , fals e, dispatch )
if ( useAutoComplete === null || useAutoComplete === undefined ) useAutoCompletion ( props . config , true , dispatch )
const displayErrors = props . config . get ( 'settings/display-errors' )
const displayErrors = props . config . get ( 'settings/display-errors' )
if ( displayErrors === null || displayErrors === undefined ) useDisplayErrors ( props . config , fals e, dispatch )
if ( displayErrors === null || displayErrors === undefined ) useDisplayErrors ( props . config , tru e, dispatch )
const useShowGas = props . config . get ( 'settings/show-gas' )
const useShowGas = props . config . get ( 'settings/show-gas' )
if ( useShowGas === null || useShowGas === undefined ) useShowGasInEditor ( props . config , fals e, dispatch )
if ( useShowGas === null || useShowGas === undefined ) useShowGasInEditor ( props . config , tru e, dispatch )
}
}
useEffect ( ( ) = > initValue ( ) , [ resetState , props . config ] )
useEffect ( ( ) = > initValue ( ) , [ resetState , props . config ] )
useEffect ( ( ) = > initValue ( ) , [ ] )
useEffect ( ( ) = > initValue ( ) , [ ] )
@ -110,10 +107,6 @@ export const RemixUiSettings = (props: RemixUiSettingsProps) => {
generateContractMetadat ( props . config , event . target . checked , dispatch )
generateContractMetadat ( props . config , event . target . checked , dispatch )
}
}
const onchangeOption = ( event ) = > {
ethereumVM ( props . config , event . target . checked , dispatch )
}
const textWrapEvent = ( event ) = > {
const textWrapEvent = ( event ) = > {
textWrapEventAction ( props . config , props . editor , event . target . checked , dispatch )
textWrapEventAction ( props . config , props . editor , event . target . checked , dispatch )
}
}
@ -148,7 +141,6 @@ export const RemixUiSettings = (props: RemixUiSettingsProps) => {
const generalConfig = ( ) = > {
const generalConfig = ( ) = > {
const isMetadataChecked = props . config . get ( 'settings/generate-contract-metadata' ) || false
const isMetadataChecked = props . config . get ( 'settings/generate-contract-metadata' ) || false
const isEthereumVMChecked = props . config . get ( 'settings/always-use-vm' ) || false
const isEditorWrapChecked = props . config . get ( 'settings/text-wrap' ) || false
const isEditorWrapChecked = props . config . get ( 'settings/text-wrap' ) || false
const isPersonalChecked = props . config . get ( 'settings/personal-mode' ) || false
const isPersonalChecked = props . config . get ( 'settings/personal-mode' ) || false
const isMatomoChecked = props . config . get ( 'settings/matomo-analytics' ) || false
const isMatomoChecked = props . config . get ( 'settings/matomo-analytics' ) || false
@ -192,12 +184,6 @@ export const RemixUiSettings = (props: RemixUiSettingsProps) => {
< FormattedMessage id = 'settings.generateContractMetadataText' / >
< FormattedMessage id = 'settings.generateContractMetadataText' / >
< / label >
< / label >
< / div >
< / div >
< div className = "fmt-2 custom-control custom-checkbox mb-1" >
< input onChange = { onchangeOption } className = "custom-control-input" id = "alwaysUseVM" data - id = "settingsTabAlwaysUseVM" type = "checkbox" name = "ethereumVM" checked = { isEthereumVMChecked } / >
< label className = { ` form-check-label custom-control-label align-middle ${ getTextClass ( 'settings/always-use-vm' ) } ` } htmlFor = "alwaysUseVM" >
< FormattedMessage id = 'settings.ethereunVMText' / >
< / label >
< / div >
< div className = "mt-2 custom-control custom-checkbox mb-1" >
< div className = "mt-2 custom-control custom-checkbox mb-1" >
< input id = "editorWrap" className = "custom-control-input" type = "checkbox" onChange = { textWrapEvent } checked = { isEditorWrapChecked } / >
< input id = "editorWrap" className = "custom-control-input" type = "checkbox" onChange = { textWrapEvent } checked = { isEditorWrapChecked } / >
< label className = { ` form-check-label custom-control-label align-middle ${ getTextClass ( 'settings/text-wrap' ) } ` } htmlFor = "editorWrap" >
< label className = { ` form-check-label custom-control-label align-middle ${ getTextClass ( 'settings/text-wrap' ) } ` } htmlFor = "editorWrap" >