feat: Wallet admin wizard feat: Notifications admin wizard feat: Twillio admin wizard feat: Commissions admin wizard feat: OperatorInfor admin wizard feat: Locales admin wizard feat: wizard admin route fix: better margin for admin wizard sidebar feat: allow FormRenderer to receive a field xs size feat: add a few flags on notifications, to reuse component parts as desired fix: wrong gql fix: missnig prop fix: eslint fix: radio styles feat: configure bitgo wallet for single cryptocurrency on wizard fix: eslint feat: set up infura wallet on wizard feat: exchange account config on wizard fix: choose wallet choose exchange DRY fix: layout fix: rebase wizard to use commissions new changes fix: typo fix: eslint fix: horizontal radios feat: radio interacts with mailgun enabled/disabled state fix: use yup to validate wizard steps fix: eslint feat: add xl size for button feat: admin wizard splash feat: use fullsize modal for wizard fix: eslint feat: Footer styles feat: wizard footer styles fix: wallet step styles fix: zeplin spec fix: zeplin styles feat: blockcypher link fix: xs can only be used on item feat: minimize wizard footer on click away feat: read blockcypher config fix: all set title styles do not match fix: no need to wrap the wrapper feat: allow to override Setup table width for wizard fix: wrapper class for wizard steps fix: layout elements for mailgun step feat: use yup to validate wizard steps style: eslint feat: operator info components open by default on wizard fix: all set table is too wide feat: full example modal feat: check if wallet has valid config feat: check if twilio has valid config
71 lines
1.8 KiB
JavaScript
71 lines
1.8 KiB
JavaScript
import { useQuery } from '@apollo/react-hooks'
|
|
import gql from 'graphql-tag'
|
|
import * as R from 'ramda'
|
|
import React, { useEffect, useState } from 'react'
|
|
|
|
import { NamespacedTable as EditableTable } from 'src/components/editableTable'
|
|
import { P, H4 } from 'src/components/typography'
|
|
import { getElements } from 'src/pages/Wallet/helper'
|
|
import { fromNamespace } from 'src/utils/config'
|
|
|
|
const GET_INFO = gql`
|
|
query getData {
|
|
config
|
|
accounts
|
|
accountsConfig {
|
|
code
|
|
display
|
|
class
|
|
cryptos
|
|
}
|
|
cryptoCurrencies {
|
|
code
|
|
display
|
|
}
|
|
}
|
|
`
|
|
|
|
const Wallet = ({ dispatch, namespace }) => {
|
|
const { data } = useQuery(GET_INFO)
|
|
const [dispatched, setDispatched] = useState(false)
|
|
|
|
const config = data?.config && fromNamespace('wallets')(data.config)
|
|
|
|
const wizardCoin =
|
|
config && Object.keys(config).find(k => k.endsWith('_wizard') && config[k])
|
|
const coinCode = wizardCoin && wizardCoin.replace('_wizard', '')
|
|
|
|
const accountsConfig = data?.accountsConfig
|
|
const cryptoCurrencies =
|
|
data?.cryptoCurrencies?.filter(({ code }) => code === coinCode) ?? []
|
|
|
|
useEffect(() => {
|
|
if (dispatched || !data?.config) return
|
|
|
|
dispatch({
|
|
type: 'wizard/VALIDATE_STEP',
|
|
payload: { config: data.config, accounts: data.accounts }
|
|
})
|
|
setDispatched(true)
|
|
}, [data, dispatch, dispatched])
|
|
|
|
return (
|
|
<>
|
|
<H4>All set</H4>
|
|
<P>
|
|
This are your wallet settings. You can later edit these and add
|
|
additional coins.
|
|
</P>
|
|
<EditableTable
|
|
rowSize="lg"
|
|
titleLg
|
|
name="All set"
|
|
namespaces={R.map(R.path(['code']))(cryptoCurrencies)}
|
|
data={config}
|
|
elements={getElements(cryptoCurrencies, accountsConfig, true)}
|
|
/>
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default Wallet
|