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
95 lines
2.3 KiB
JavaScript
95 lines
2.3 KiB
JavaScript
import { makeStyles } from '@material-ui/core'
|
|
import * as R from 'ramda'
|
|
import React, { useContext } from 'react'
|
|
|
|
import {
|
|
Table,
|
|
THead,
|
|
TBody,
|
|
Tr,
|
|
Td,
|
|
Th
|
|
} from 'src/components/fake-table/Table'
|
|
import { Switch } from 'src/components/inputs'
|
|
import { fromNamespace, toNamespace } from 'src/utils/config'
|
|
import { startCase } from 'src/utils/string'
|
|
|
|
import NotificationsCtx from '../NotificationsContext'
|
|
|
|
const channelSize = 129
|
|
const sizes = {
|
|
balance: 152,
|
|
transactions: 184,
|
|
compliance: 178,
|
|
errors: 142,
|
|
active: 263
|
|
}
|
|
const width = R.sum(R.values(sizes)) + channelSize
|
|
|
|
const Row = ({ namespace, forceDisable }) => {
|
|
const { data: rawData, save: rawSave } = useContext(NotificationsCtx)
|
|
|
|
const save = R.compose(rawSave(null), toNamespace(namespace))
|
|
const data = fromNamespace(namespace)(rawData)
|
|
|
|
const disabled = forceDisable || !data || !data.active
|
|
|
|
const Cell = ({ name, disabled }) => {
|
|
const value = !!(data && data[name])
|
|
|
|
return (
|
|
<Td width={sizes[name]} textAlign="center">
|
|
<Switch
|
|
disabled={disabled}
|
|
checked={value}
|
|
onChange={event => {
|
|
save({ [name]: event.target.checked })
|
|
}}
|
|
value={value}
|
|
/>
|
|
</Td>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<Tr>
|
|
<Td width={channelSize}>{startCase(namespace)}</Td>
|
|
<Cell name="balance" disabled={disabled} />
|
|
<Cell name="transactions" disabled={disabled} />
|
|
<Cell name="compliance" disabled={disabled} />
|
|
<Cell name="errors" disabled={disabled} />
|
|
<Cell name="active" disabled={forceDisable} />
|
|
</Tr>
|
|
)
|
|
}
|
|
|
|
const useStyles = makeStyles({
|
|
mainTable: {
|
|
width
|
|
},
|
|
wizardTable: {
|
|
width: 930
|
|
}
|
|
})
|
|
const Setup = ({ wizard, forceDisable }) => {
|
|
const widthAdjust = wizard ? 20 : 0
|
|
const classes = useStyles()
|
|
return (
|
|
<Table className={wizard ? classes.wizardTable : classes.mainTable}>
|
|
<THead>
|
|
<Th width={channelSize - widthAdjust}>Channel</Th>
|
|
{Object.keys(sizes).map(it => (
|
|
<Th key={it} width={sizes[it] - widthAdjust} textAlign="center">
|
|
{startCase(it)}
|
|
</Th>
|
|
))}
|
|
</THead>
|
|
<TBody>
|
|
<Row namespace="email" forceDisable={forceDisable} />
|
|
<Row namespace="sms" forceDisable={forceDisable} />
|
|
</TBody>
|
|
</Table>
|
|
)
|
|
}
|
|
|
|
export default Setup
|