Merge pull request #1154 from siiky/refact/lam-252/omit-0conf
refactor: remove old 0conf mentions from admin
This commit is contained in:
commit
75097cc48a
6 changed files with 40 additions and 77 deletions
|
|
@ -49,7 +49,7 @@ const ALL_ACCOUNTS = [
|
||||||
{ code: 'mock-id-verify', display: 'Mock ID verifier', class: ID_VERIFIER, dev: true },
|
{ code: 'mock-id-verify', display: 'Mock ID verifier', class: ID_VERIFIER, dev: true },
|
||||||
{ code: 'twilio', display: 'Twilio', class: SMS },
|
{ code: 'twilio', display: 'Twilio', class: SMS },
|
||||||
{ code: 'mailgun', display: 'Mailgun', class: EMAIL },
|
{ code: 'mailgun', display: 'Mailgun', class: EMAIL },
|
||||||
{ code: 'none', display: 'None', class: ZERO_CONF, cryptos: [BTC, ZEC, LTC, DASH, BCH, ETH, XMR] },
|
{ code: 'none', display: 'None', class: ZERO_CONF, cryptos: ALL_CRYPTOS },
|
||||||
{ code: 'blockcypher', display: 'Blockcypher', class: ZERO_CONF, cryptos: [BTC] },
|
{ code: 'blockcypher', display: 'Blockcypher', class: ZERO_CONF, cryptos: [BTC] },
|
||||||
{ code: 'mock-zero-conf', display: 'Mock 0-conf', class: ZERO_CONF, cryptos: ALL_CRYPTOS, dev: true },
|
{ code: 'mock-zero-conf', display: 'Mock 0-conf', class: ZERO_CONF, cryptos: ALL_CRYPTOS, dev: true },
|
||||||
{ code: 'ciphertrace', display: 'CipherTrace', class: WALLET_SCORING, cryptos: [BTC, ETH, LTC, BCH] },
|
{ code: 'ciphertrace', display: 'CipherTrace', class: WALLET_SCORING, cryptos: [BTC, ETH, LTC, BCH] },
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ const MODAL_WIDTH = 554
|
||||||
const MODAL_HEIGHT = 520
|
const MODAL_HEIGHT = 520
|
||||||
|
|
||||||
const Wizard = ({ machine, locale, onClose, save, error }) => {
|
const Wizard = ({ machine, locale, onClose, save, error }) => {
|
||||||
const LAST_STEP = machine.numberOfCassettes + 2
|
const LAST_STEP = machine.numberOfCassettes + 1
|
||||||
const [{ step, config }, setState] = useState({
|
const [{ step, config }, setState] = useState({
|
||||||
step: 0,
|
step: 0,
|
||||||
config: { active: true }
|
config: { active: true }
|
||||||
|
|
@ -46,34 +46,20 @@ const Wizard = ({ machine, locale, onClose, save, error }) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const steps = []
|
const steps = R.map(
|
||||||
|
it => ({
|
||||||
R.until(
|
|
||||||
R.gt(R.__, machine.numberOfCassettes),
|
|
||||||
it => {
|
|
||||||
steps.push({
|
|
||||||
type: `cassette${it}`,
|
type: `cassette${it}`,
|
||||||
display: `Cassette ${it}`,
|
display: `Cassette ${it}`,
|
||||||
component: Autocomplete,
|
component: Autocomplete,
|
||||||
inputProps: {
|
inputProps: {
|
||||||
options: R.map(it => ({ code: it, display: it }))(options),
|
options: R.map(it => ({ code: it, display: it }), options),
|
||||||
labelProp: 'display',
|
labelProp: 'display',
|
||||||
valueProp: 'code'
|
valueProp: 'code'
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
return R.add(1, it)
|
R.range(1, machine.numberOfCassettes + 1)
|
||||||
},
|
|
||||||
1
|
|
||||||
)
|
)
|
||||||
|
|
||||||
steps.push({
|
|
||||||
type: 'zeroConfLimit',
|
|
||||||
display: '0-conf Limit',
|
|
||||||
schema: Yup.object().shape({
|
|
||||||
zeroConfLimit: Yup.number().required()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
const schema = () =>
|
const schema = () =>
|
||||||
Yup.object().shape({
|
Yup.object().shape({
|
||||||
cassette1: Yup.number().required(),
|
cassette1: Yup.number().required(),
|
||||||
|
|
@ -113,7 +99,7 @@ const Wizard = ({ machine, locale, onClose, save, error }) => {
|
||||||
name={machine.name}
|
name={machine.name}
|
||||||
numberOfCassettes={machine.numberOfCassettes}
|
numberOfCassettes={machine.numberOfCassettes}
|
||||||
error={error}
|
error={error}
|
||||||
lastStep={isLastStep}
|
isLastStep={isLastStep}
|
||||||
steps={steps}
|
steps={steps}
|
||||||
fiatCurrency={locale.fiatCurrency}
|
fiatCurrency={locale.fiatCurrency}
|
||||||
options={options}
|
options={options}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ const WizardStep = ({
|
||||||
step,
|
step,
|
||||||
schema,
|
schema,
|
||||||
error,
|
error,
|
||||||
lastStep,
|
isLastStep,
|
||||||
onContinue,
|
onContinue,
|
||||||
steps,
|
steps,
|
||||||
fiatCurrency,
|
fiatCurrency,
|
||||||
|
|
@ -53,7 +53,7 @@ const WizardStep = ({
|
||||||
}) => {
|
}) => {
|
||||||
const classes = useStyles()
|
const classes = useStyles()
|
||||||
|
|
||||||
const label = lastStep ? 'Finish' : 'Next'
|
const label = isLastStep ? 'Finish' : 'Next'
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
@ -62,7 +62,7 @@ const WizardStep = ({
|
||||||
<Stepper steps={steps.length + 1} currentStep={step} />
|
<Stepper steps={steps.length + 1} currentStep={step} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{step <= numberOfCassettes && (
|
{!isLastStep && (
|
||||||
<Formik
|
<Formik
|
||||||
validateOnBlur={false}
|
validateOnBlur={false}
|
||||||
validateOnChange={false}
|
validateOnChange={false}
|
||||||
|
|
@ -121,46 +121,7 @@ const WizardStep = ({
|
||||||
</Formik>
|
</Formik>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{step === numberOfCassettes + 1 && (
|
{isLastStep && (
|
||||||
<Formik
|
|
||||||
validateOnBlur={false}
|
|
||||||
validateOnChange={false}
|
|
||||||
onSubmit={onContinue}
|
|
||||||
initialValues={{ zeroConfLimit: '' }}
|
|
||||||
enableReinitialize
|
|
||||||
validationSchema={steps[step - 1].schema}>
|
|
||||||
<Form>
|
|
||||||
<div className={classes.thirdStepHeader}>
|
|
||||||
<div className={classes.step}>
|
|
||||||
<H4 className={classes.edit}>Edit 0-conf Limit</H4>
|
|
||||||
|
|
||||||
<Label1>Choose a limit</Label1>
|
|
||||||
<div className={classes.bill}>
|
|
||||||
<Field
|
|
||||||
className={classes.billInput}
|
|
||||||
type="text"
|
|
||||||
size="lg"
|
|
||||||
autoFocus={true}
|
|
||||||
component={NumberInput}
|
|
||||||
fullWidth
|
|
||||||
decimalPlaces={0}
|
|
||||||
name={steps[step - 1].type}
|
|
||||||
/>
|
|
||||||
<Info1 noMargin className={classes.suffix}>
|
|
||||||
{fiatCurrency}
|
|
||||||
</Info1>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Button className={classes.submit} type="submit">
|
|
||||||
{label}
|
|
||||||
</Button>
|
|
||||||
</Form>
|
|
||||||
</Formik>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{lastStep && (
|
|
||||||
<div className={classes.disclaimer}>
|
<div className={classes.disclaimer}>
|
||||||
<Info2 className={classes.title}>Cash Cassette Bill Count</Info2>
|
<Info2 className={classes.title}>Cash Cassette Bill Count</Info2>
|
||||||
<P>
|
<P>
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,10 @@ const Wizard = ({
|
||||||
}),
|
}),
|
||||||
...zeroConfs
|
...zeroConfs
|
||||||
},
|
},
|
||||||
{ type: 'zeroConfLimit', name: '0-conf limit', ...zeroConfs }
|
{
|
||||||
|
type: 'zeroConfLimit',
|
||||||
|
name: '0-conf limit'
|
||||||
|
}
|
||||||
])
|
])
|
||||||
: commonWizardSteps
|
: commonWizardSteps
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,8 +112,7 @@ const WizardStep = ({
|
||||||
radioClassName={classes.radio}
|
radioClassName={classes.radio}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{/* Hack to support optional 0conf setup */
|
{type === 'zeroConfLimit' && (
|
||||||
isLastStep && step === maxSteps && (
|
|
||||||
<Formik
|
<Formik
|
||||||
validateOnBlur={false}
|
validateOnBlur={false}
|
||||||
validateOnChange={true}
|
validateOnChange={true}
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,20 @@ const AllSet = ({ data: currentData, doContinue }) => {
|
||||||
return saveConfig({ variables: { config } })
|
return saveConfig({ variables: { config } })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const presentableData = R.pipe(
|
||||||
|
R.omit(['coin', 'zeroConf', 'zeroConfLimit']),
|
||||||
|
toNamespace(coin)
|
||||||
|
)(currentData)
|
||||||
|
|
||||||
|
const presentableElements = R.filter(
|
||||||
|
R.pipe(
|
||||||
|
R.prop('name'),
|
||||||
|
R.flip(R.includes)(['zeroConf', 'zeroConfLimit']),
|
||||||
|
R.not()
|
||||||
|
),
|
||||||
|
getElements(cryptoCurrencies, accountsConfig, null, true)
|
||||||
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<H4 className={error && classes.error}>All set</H4>
|
<H4 className={error && classes.error}>All set</H4>
|
||||||
|
|
@ -82,8 +96,8 @@ const AllSet = ({ data: currentData, doContinue }) => {
|
||||||
titleLg
|
titleLg
|
||||||
name="All set"
|
name="All set"
|
||||||
namespaces={[coin]}
|
namespaces={[coin]}
|
||||||
data={toNamespace(coin, R.omit('coin', currentData))}
|
data={presentableData}
|
||||||
elements={getElements(cryptoCurrencies, accountsConfig, true)}
|
elements={presentableElements}
|
||||||
/>
|
/>
|
||||||
<Button size="lg" onClick={save} className={classes.button}>
|
<Button size="lg" onClick={save} className={classes.button}>
|
||||||
Continue
|
Continue
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue