Skip to content
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
1 change: 0 additions & 1 deletion packages/neuron-ui/src/components/Receive/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ const Receive = (props: React.PropsWithoutRef<RouteComponentProps<{ address: str
const accountAddress = params.address || receiving[0]

if (!accountAddress) {
// TODO: better error handling
return <div>{t('receive.address-not-found')}</div>
}

Expand Down
1 change: 0 additions & 1 deletion packages/neuron-ui/src/components/Transaction/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const Transaction = (props: React.PropsWithoutRef<ContentProps & RouteComponentP
} = useNeuronWallet()

useEffect(() => {
// TODO: verify hash
dispatch(actionCreators.getTransaction(match.params.hash))
return () => {
providerDispatch({
Expand Down
14 changes: 11 additions & 3 deletions packages/neuron-ui/src/components/WalletEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import { actionCreators } from 'containers/MainContent/reducer'
import React, { useCallback, useEffect, useMemo } from 'react'
import { Button, Card, Form } from 'react-bootstrap'
import { useTranslation } from 'react-i18next'
import { RouteComponentProps } from 'react-router-dom'
import { RouteComponentProps, Link } from 'react-router-dom'
import { useNeuronWallet } from 'utils/hooks'
import InlineInput, { InputProps } from 'widgets/InlineInput'
import { Routes } from 'utils/const'
import { useAreParamsValid, useInputs, useToggleDialog, useWalletEditor } from './hooks'

export default ({
Expand All @@ -22,8 +23,15 @@ export default ({
const wallet = useMemo(() => wallets.find(w => w.id === id), [id, wallets])

if (!wallet) {
// TODO: Better error handling
throw new Error('Wallet not found')
const label = `${t('siderbar.settings')}-${t('settings.setting-tabs.wallets')}`
return (
<div>
<p>{t('messages.wallet-is-not-found')}</p>
<Link to={Routes.SettingsWallets} className="btn btn-primary">
{label}
</Link>
</div>
)
}

const editor = useWalletEditor()
Expand Down
6 changes: 4 additions & 2 deletions packages/neuron-ui/src/components/WalletWizard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ const Mnemonic = ({
payload: res,
})
})
// TODO: Better Error Handle
.catch(err => console.error(err))
.catch(err => {
console.error(err)
history.goBack()
})
} else {
dispatch({
type: 'imported',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ export default {
}
},
setNetwork: (id: string) => {
// TODO: verification
networksCall.activate(id)
return {
type: MainActions.Networks,
Expand Down
8 changes: 3 additions & 5 deletions packages/neuron-ui/src/containers/Providers/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ export const useChannelListeners = (i18n: any, chain: any, dispatch: React.Dispa
})
}
} else {
// TODO: better prompt
/* eslint-disable no-alert */
// TODO: better prompt, prd required
window.alert(i18n.t('messages.failed-to-initiate,-please-reopen-Neuron'))
/* eslint-enable no-alert */
window.close()
}
},
Expand All @@ -49,8 +51,6 @@ export const useChannelListeners = (i18n: any, chain: any, dispatch: React.Dispa
break
}
}
} else {
// TODO: handle error
}
})

Expand All @@ -75,8 +75,6 @@ export const useChannelListeners = (i18n: any, chain: any, dispatch: React.Dispa
break
}
}
} else {
// TODO: handle error
}
})

Expand Down
3 changes: 2 additions & 1 deletion packages/neuron-ui/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@
"wallet-imported-successfully": "{{name}} imported successfully",
"wallet-created-successfully": "{{name}} created successfully",
"wallet-updated-successfully": "{{name}} updated successfully",
"protocol-is-required": "Protocol is required"
"protocol-is-required": "Protocol is required",
"wallet-is-not-found": "Wallet is not found"
}
}
}
3 changes: 2 additions & 1 deletion packages/neuron-ui/src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@
"wallet-imported-successfully": "{{name}} 导入成功",
"wallet-created-successfully": "{{name}} 创建成功",
"wallet-updated-successfully": "{{name}} 更新成功",
"protocol-is-required": "请指定 URL 协议"
"protocol-is-required": "请指定 URL 协议",
"wallet-is-not-found": "未找到钱包"
}
}
}
4 changes: 2 additions & 2 deletions packages/neuron-ui/src/utils/validators.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ADDRESS_LENGTH, MIN_PASSWORD_LENGTH, MAX_PASSWORD_LENGTH } from './const'

export const verifyAddress = (address: string): boolean => {
// TODO: verify address
return address.replace(/^0x/, '').length === ADDRESS_LENGTH
// TODO: verify address, prd required
return address.length === ADDRESS_LENGTH
}
export const verifyWalletSubmission = ({
password,
Expand Down