fix: PR fixes
This commit is contained in:
parent
1f6d272aa0
commit
21f3ee59ea
9 changed files with 52 additions and 43 deletions
|
|
@ -100,7 +100,7 @@ const ECol = ({ editing, config }) => {
|
||||||
const { values } = useFormikContext()
|
const { values } = useFormikContext()
|
||||||
const classes = useStyles({ textAlign, size })
|
const classes = useStyles({ textAlign, size })
|
||||||
|
|
||||||
const iProps = {
|
const innerProps = {
|
||||||
fullWidth: true,
|
fullWidth: true,
|
||||||
size,
|
size,
|
||||||
bold,
|
bold,
|
||||||
|
|
@ -109,8 +109,8 @@ const ECol = ({ editing, config }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Autocomplete
|
// Autocomplete
|
||||||
if (iProps.options && !iProps.getLabel) {
|
if (innerProps.options && !innerProps.getLabel) {
|
||||||
iProps.getLabel = view
|
innerProps.getLabel = view
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -121,7 +121,7 @@ const ECol = ({ editing, config }) => {
|
||||||
bold={bold}
|
bold={bold}
|
||||||
textAlign={textAlign}>
|
textAlign={textAlign}>
|
||||||
{editing && editable ? (
|
{editing && editable ? (
|
||||||
<Field name={name} component={input} {...iProps} />
|
<Field name={name} component={input} {...innerProps} />
|
||||||
) : (
|
) : (
|
||||||
values && <>{view(values[name])}</>
|
values && <>{view(values[name])}</>
|
||||||
)}
|
)}
|
||||||
|
|
@ -160,12 +160,12 @@ const ERow = ({ editing, disabled }) => {
|
||||||
const { values } = useFormikContext()
|
const { values } = useFormikContext()
|
||||||
const shouldStripe = stripeWhen && stripeWhen(values) && !editing
|
const shouldStripe = stripeWhen && stripeWhen(values) && !editing
|
||||||
|
|
||||||
const iElements = shouldStripe ? groupStriped(elements) : elements
|
const innerElements = shouldStripe ? groupStriped(elements) : elements
|
||||||
return (
|
return (
|
||||||
<Tr
|
<Tr
|
||||||
error={errors && errors.length}
|
error={errors && errors.length}
|
||||||
errorMessage={errors && errors.toString()}>
|
errorMessage={errors && errors.toString()}>
|
||||||
{iElements.map((it, idx) => {
|
{innerElements.map((it, idx) => {
|
||||||
return <ECol key={idx} config={it} editing={editing} />
|
return <ECol key={idx} config={it} editing={editing} />
|
||||||
})}
|
})}
|
||||||
{(enableEdit || enableDelete || enableToggle) && (
|
{(enableEdit || enableDelete || enableToggle) && (
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ const Autocomplete = ({
|
||||||
|
|
||||||
const value = getValue()
|
const value = getValue()
|
||||||
|
|
||||||
const iOnChange = (evt, value) => {
|
const innerOnChange = (evt, value) => {
|
||||||
if (!valueProp) return onChange(evt, value)
|
if (!valueProp) return onChange(evt, value)
|
||||||
|
|
||||||
const rValue = multiple ? R.map(mapToValue)(value) : mapToValue(value)
|
const rValue = multiple ? R.map(mapToValue)(value) : mapToValue(value)
|
||||||
|
|
@ -48,7 +48,7 @@ const Autocomplete = ({
|
||||||
options={options}
|
options={options}
|
||||||
multiple={multiple}
|
multiple={multiple}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={iOnChange}
|
onChange={innerOnChange}
|
||||||
getOptionLabel={getLabel}
|
getOptionLabel={getLabel}
|
||||||
forcePopupIcon={false}
|
forcePopupIcon={false}
|
||||||
filterOptions={createFilterOptions({ ignoreAccents: true, limit })}
|
filterOptions={createFilterOptions({ ignoreAccents: true, limit })}
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,12 @@ const SecretInput = memo(({ value, onFocus, onBlur, ...props }) => {
|
||||||
const previouslyFilled = !!value
|
const previouslyFilled = !!value
|
||||||
const tempValue = previouslyFilled ? '' : value
|
const tempValue = previouslyFilled ? '' : value
|
||||||
|
|
||||||
const iOnFocus = event => {
|
const innerOnFocus = event => {
|
||||||
setFocused(true)
|
setFocused(true)
|
||||||
onFocus && onFocus(event)
|
onFocus && onFocus(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
const iOnBlur = event => {
|
const innerOnBlur = event => {
|
||||||
setFocused(false)
|
setFocused(false)
|
||||||
onBlur && onBlur(event)
|
onBlur && onBlur(event)
|
||||||
}
|
}
|
||||||
|
|
@ -23,8 +23,8 @@ const SecretInput = memo(({ value, onFocus, onBlur, ...props }) => {
|
||||||
<TextInput
|
<TextInput
|
||||||
{...props}
|
{...props}
|
||||||
type="password"
|
type="password"
|
||||||
onFocus={iOnFocus}
|
onFocus={innerOnFocus}
|
||||||
onBlur={iOnBlur}
|
onBlur={innerOnBlur}
|
||||||
value={value}
|
value={value}
|
||||||
InputProps={{ value: !focused ? tempValue : value }}
|
InputProps={{ value: !focused ? tempValue : value }}
|
||||||
InputLabelProps={{ shrink: previouslyFilled || focused }}
|
InputLabelProps={{ shrink: previouslyFilled || focused }}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ const AutocompleteFormik = ({ options, ...props }) => {
|
||||||
const error = !!(touched[name] && errors[name])
|
const error = !!(touched[name] && errors[name])
|
||||||
const { initialValues } = useFormikContext()
|
const { initialValues } = useFormikContext()
|
||||||
|
|
||||||
const iOptions =
|
const innerOptions =
|
||||||
R.type(options) === 'Function' ? options(initialValues) : options
|
R.type(options) === 'Function' ? options(initialValues) : options
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -20,7 +20,7 @@ const AutocompleteFormik = ({ options, ...props }) => {
|
||||||
onBlur={onBlur}
|
onBlur={onBlur}
|
||||||
value={value}
|
value={value}
|
||||||
error={error}
|
error={error}
|
||||||
options={iOptions}
|
options={innerOptions}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,24 @@
|
||||||
import React, { memo, useState } from 'react'
|
|
||||||
import QRCode from 'qrcode.react'
|
|
||||||
import classnames from 'classnames'
|
|
||||||
import { Form, Formik, FastField } from 'formik'
|
|
||||||
import { makeStyles } from '@material-ui/core/styles'
|
|
||||||
import * as Yup from 'yup'
|
|
||||||
import { gql } from 'apollo-boost'
|
|
||||||
import { useMutation } from '@apollo/react-hooks'
|
import { useMutation } from '@apollo/react-hooks'
|
||||||
import { Dialog, DialogContent, SvgIcon, IconButton } from '@material-ui/core'
|
import { Dialog, DialogContent, SvgIcon, IconButton } from '@material-ui/core'
|
||||||
|
import { makeStyles } from '@material-ui/core/styles'
|
||||||
|
import { gql } from 'apollo-boost'
|
||||||
|
import classnames from 'classnames'
|
||||||
|
import { Form, Formik, FastField } from 'formik'
|
||||||
|
import QRCode from 'qrcode.react'
|
||||||
|
import React, { memo, useState } from 'react'
|
||||||
|
import * as Yup from 'yup'
|
||||||
|
|
||||||
|
import Title from 'src/components/Title'
|
||||||
|
import { Button } from 'src/components/buttons'
|
||||||
|
import { TextInput } from 'src/components/inputs/formik'
|
||||||
|
import Sidebar from 'src/components/layout/Sidebar'
|
||||||
|
import { Info2, P } from 'src/components/typography'
|
||||||
|
import { ReactComponent as CloseIcon } from 'src/styling/icons/action/close/zodiac.svg'
|
||||||
import { ReactComponent as CompleteStageIconZodiac } from 'src/styling/icons/stage/zodiac/complete.svg'
|
import { ReactComponent as CompleteStageIconZodiac } from 'src/styling/icons/stage/zodiac/complete.svg'
|
||||||
import { ReactComponent as CurrentStageIconZodiac } from 'src/styling/icons/stage/zodiac/current.svg'
|
import { ReactComponent as CurrentStageIconZodiac } from 'src/styling/icons/stage/zodiac/current.svg'
|
||||||
import { ReactComponent as EmptyStageIconZodiac } from 'src/styling/icons/stage/zodiac/empty.svg'
|
import { ReactComponent as EmptyStageIconZodiac } from 'src/styling/icons/stage/zodiac/empty.svg'
|
||||||
import { primaryColor } from 'src/styling/variables'
|
|
||||||
import Title from 'src/components/Title'
|
|
||||||
import Sidebar from 'src/components/Sidebar'
|
|
||||||
import { Info2, P } from 'src/components/typography'
|
|
||||||
import { TextInput } from 'src/components/inputs/formik'
|
|
||||||
import { Button } from 'src/components/buttons'
|
|
||||||
import { ReactComponent as WarningIcon } from 'src/styling/icons/warning-icon/comet.svg'
|
import { ReactComponent as WarningIcon } from 'src/styling/icons/warning-icon/comet.svg'
|
||||||
import { ReactComponent as CloseIcon } from 'src/styling/icons/action/close/zodiac.svg'
|
import { primaryColor } from 'src/styling/variables'
|
||||||
|
|
||||||
import styles from './styles'
|
import styles from './styles'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import * as R from 'ramda'
|
||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
|
|
||||||
import TitleSection from 'src/components/layout/TitleSection'
|
import TitleSection from 'src/components/layout/TitleSection'
|
||||||
import { fromNamespace, toNamespace } from 'src/utils/config'
|
import { fromNamespace, toNamespace, namespaces } from 'src/utils/config'
|
||||||
|
|
||||||
import Section from '../../components/layout/Section'
|
import Section from '../../components/layout/Section'
|
||||||
|
|
||||||
|
|
@ -49,12 +49,13 @@ const Notifications = ({ name: SCREEN_KEY }) => {
|
||||||
onError: error => setError({ error })
|
onError: error => setError({ error })
|
||||||
})
|
})
|
||||||
|
|
||||||
const config = data?.config && fromNamespace(SCREEN_KEY)(data.config)
|
const config = fromNamespace(SCREEN_KEY)(data?.config)
|
||||||
const machines = data?.machines
|
const machines = data?.machines
|
||||||
const cryptoCurrencies = data?.cryptoCurrencies
|
const cryptoCurrencies = data?.cryptoCurrencies
|
||||||
|
|
||||||
// TODO improve the way of fetching this
|
const currency = R.path(['fiatCurrency'])(
|
||||||
const currency = R.path(['locale_fiatCurrency', 'code'])(data?.config ?? {})
|
fromNamespace(namespaces.LOCALE)(data?.config)
|
||||||
|
)
|
||||||
|
|
||||||
const save = R.curry((section, rawConfig) => {
|
const save = R.curry((section, rawConfig) => {
|
||||||
const config = toNamespace(SCREEN_KEY)(rawConfig)
|
const config = toNamespace(SCREEN_KEY)(rawConfig)
|
||||||
|
|
|
||||||
|
|
@ -56,12 +56,10 @@ const CryptoBalanceOverrides = ({ section }) => {
|
||||||
[LOW_BALANCE_KEY]: Yup.number()
|
[LOW_BALANCE_KEY]: Yup.number()
|
||||||
.integer()
|
.integer()
|
||||||
.min(0)
|
.min(0)
|
||||||
.max(99999999)
|
|
||||||
.required(),
|
.required(),
|
||||||
[HIGH_BALANCE_KEY]: Yup.number()
|
[HIGH_BALANCE_KEY]: Yup.number()
|
||||||
.integer()
|
.integer()
|
||||||
.min(0)
|
.min(0)
|
||||||
.max(99999999)
|
|
||||||
.required()
|
.required()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import Services from 'src/pages/Services/Services'
|
||||||
import Transactions from 'src/pages/Transactions/Transactions'
|
import Transactions from 'src/pages/Transactions/Transactions'
|
||||||
import WalletSettings from 'src/pages/Wallet/Wallet'
|
import WalletSettings from 'src/pages/Wallet/Wallet'
|
||||||
import MachineStatus from 'src/pages/maintenance/MachineStatus'
|
import MachineStatus from 'src/pages/maintenance/MachineStatus'
|
||||||
|
import { namespaces } from 'src/utils/config'
|
||||||
|
|
||||||
const tree = [
|
const tree = [
|
||||||
{
|
{
|
||||||
|
|
@ -38,7 +39,7 @@ const tree = [
|
||||||
component: MachineLogs
|
component: MachineLogs
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'fuding',
|
key: 'funding',
|
||||||
label: 'Funding',
|
label: 'Funding',
|
||||||
route: '/maintenance/funding',
|
route: '/maintenance/funding',
|
||||||
component: Funding
|
component: Funding
|
||||||
|
|
@ -66,39 +67,39 @@ const tree = [
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
key: 'commissions',
|
key: namespaces.COMMISSIONS,
|
||||||
label: 'Commissions',
|
label: 'Commissions',
|
||||||
route: '/settings/commissions',
|
route: '/settings/commissions',
|
||||||
component: Commissions
|
component: Commissions
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'locale',
|
key: namespaces.LOCALE,
|
||||||
label: 'Locale',
|
label: 'Locale',
|
||||||
route: '/settings/locale',
|
route: '/settings/locale',
|
||||||
component: Locales
|
component: Locales
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'services',
|
key: namespaces.SERVICES,
|
||||||
label: '3rd party services',
|
label: '3rd party services',
|
||||||
route: '/settings/3rd-party-services',
|
route: '/settings/3rd-party-services',
|
||||||
component: Services
|
component: Services
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'notifications',
|
key: namespaces.NOTIFICATIONS,
|
||||||
label: 'Notifications',
|
label: 'Notifications',
|
||||||
route: '/settings/notifications',
|
route: '/settings/notifications',
|
||||||
component: Notifications
|
component: Notifications
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'info',
|
key: namespaces.OPERATOR_INFO,
|
||||||
label: 'Operator Info',
|
label: 'Operator Info',
|
||||||
route: '/settings/operator-info',
|
route: '/settings/operator-info',
|
||||||
component: OperatorInfo
|
component: OperatorInfo
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'wallet',
|
key: namespaces.WALLETS,
|
||||||
label: 'Wallet',
|
label: 'Wallet',
|
||||||
route: '/settings/wallet',
|
route: '/settings/wallet-settings',
|
||||||
component: WalletSettings
|
component: WalletSettings
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,14 @@
|
||||||
import * as R from 'ramda'
|
import * as R from 'ramda'
|
||||||
|
|
||||||
|
const namespaces = {
|
||||||
|
WALLETS: 'wallets',
|
||||||
|
OPERATOR_INFO: 'operatorInfo',
|
||||||
|
NOTIFICATIONS: 'notifications',
|
||||||
|
SERVICES: 'services',
|
||||||
|
LOCALE: 'locale',
|
||||||
|
COMMISSIONS: 'commissions'
|
||||||
|
}
|
||||||
|
|
||||||
const mapKeys = R.curry((fn, obj) =>
|
const mapKeys = R.curry((fn, obj) =>
|
||||||
R.fromPairs(R.map(R.adjust(0, fn), R.toPairs(obj)))
|
R.fromPairs(R.map(R.adjust(0, fn), R.toPairs(obj)))
|
||||||
)
|
)
|
||||||
|
|
@ -23,4 +32,4 @@ const toNamespace = R.curry((key, config) =>
|
||||||
mapKeys(it => `${key}_${it}`)(config)
|
mapKeys(it => `${key}_${it}`)(config)
|
||||||
)
|
)
|
||||||
|
|
||||||
export { fromNamespace, toNamespace }
|
export { fromNamespace, toNamespace, namespaces }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue