fix: No reason for 'Enable' switch on 'Wallet Settings' panel (#439)
* fix: remove the "enable" toggle fix: make edit available at all times and make it toggle the wizard if the coin config is empty fix: disable focus on the first edit feat: open the coin config wizard when adding a not configured coin on locales * fix: set default value for focusOnEditWhen to avoid breaking tables first field focus refactor: replaced relative path imports from outside the module with full paths fix: removed console.log * fix: changed the edit override logic to a cleaner one * fix: trigger the wizard only when the coin isn't configured
This commit is contained in:
parent
363e69402d
commit
92eebd630e
5 changed files with 67 additions and 26 deletions
|
|
@ -56,10 +56,9 @@ const Wallet = ({ name: SCREEN_KEY }) => {
|
|||
const cryptoCurrencies = data?.cryptoCurrencies ?? []
|
||||
const accounts = data?.accounts ?? []
|
||||
|
||||
const onToggle = id => {
|
||||
const namespaced = fromNamespace(id)(config)
|
||||
if (!WalletSchema.isValidSync(namespaced)) return setWizard(id)
|
||||
save(toNamespace(id, { active: !namespaced?.active }))
|
||||
const shouldOverrideEdit = it => {
|
||||
const namespaced = fromNamespace(it)(config)
|
||||
return !WalletSchema.isValidSync(namespaced)
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
@ -71,13 +70,11 @@ const Wallet = ({ name: SCREEN_KEY }) => {
|
|||
data={config}
|
||||
stripeWhen={it => !WalletSchema.isValidSync(it)}
|
||||
enableEdit
|
||||
editWidth={134}
|
||||
enableToggle
|
||||
toggleWidth={109}
|
||||
onToggle={onToggle}
|
||||
shouldOverrideEdit={shouldOverrideEdit}
|
||||
editOverride={setWizard}
|
||||
editWidth={174}
|
||||
save={save}
|
||||
validationSchema={WalletSchema}
|
||||
disableRowEdit={R.compose(R.not, R.path(['active']))}
|
||||
elements={getElements(cryptoCurrencies, accountsConfig)}
|
||||
/>
|
||||
{wizard && (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue