diff --git a/new-lamassu-admin/src/components/editableTable/Row.js b/new-lamassu-admin/src/components/editableTable/Row.js
index f476afea..0a6b91dc 100644
--- a/new-lamassu-admin/src/components/editableTable/Row.js
+++ b/new-lamassu-admin/src/components/editableTable/Row.js
@@ -100,7 +100,7 @@ const ECol = ({ editing, config }) => {
const { values } = useFormikContext()
const classes = useStyles({ textAlign, size })
- const iProps = {
+ const innerProps = {
fullWidth: true,
size,
bold,
@@ -109,8 +109,8 @@ const ECol = ({ editing, config }) => {
}
// Autocomplete
- if (iProps.options && !iProps.getLabel) {
- iProps.getLabel = view
+ if (innerProps.options && !innerProps.getLabel) {
+ innerProps.getLabel = view
}
return (
@@ -121,7 +121,7 @@ const ECol = ({ editing, config }) => {
bold={bold}
textAlign={textAlign}>
{editing && editable ? (
-
+
) : (
values && <>{view(values[name])}>
)}
@@ -160,12 +160,12 @@ const ERow = ({ editing, disabled }) => {
const { values } = useFormikContext()
const shouldStripe = stripeWhen && stripeWhen(values) && !editing
- const iElements = shouldStripe ? groupStriped(elements) : elements
+ const innerElements = shouldStripe ? groupStriped(elements) : elements
return (
- {iElements.map((it, idx) => {
+ {innerElements.map((it, idx) => {
return
})}
{(enableEdit || enableDelete || enableToggle) && (
diff --git a/new-lamassu-admin/src/components/inputs/base/Autocomplete.js b/new-lamassu-admin/src/components/inputs/base/Autocomplete.js
index 4892bd3d..4f9b31c5 100644
--- a/new-lamassu-admin/src/components/inputs/base/Autocomplete.js
+++ b/new-lamassu-admin/src/components/inputs/base/Autocomplete.js
@@ -36,7 +36,7 @@ const Autocomplete = ({
const value = getValue()
- const iOnChange = (evt, value) => {
+ const innerOnChange = (evt, value) => {
if (!valueProp) return onChange(evt, value)
const rValue = multiple ? R.map(mapToValue)(value) : mapToValue(value)
@@ -48,7 +48,7 @@ const Autocomplete = ({
options={options}
multiple={multiple}
value={value}
- onChange={iOnChange}
+ onChange={innerOnChange}
getOptionLabel={getLabel}
forcePopupIcon={false}
filterOptions={createFilterOptions({ ignoreAccents: true, limit })}
diff --git a/new-lamassu-admin/src/components/inputs/base/SecretInput.js b/new-lamassu-admin/src/components/inputs/base/SecretInput.js
index 023772a1..f63cf5dc 100644
--- a/new-lamassu-admin/src/components/inputs/base/SecretInput.js
+++ b/new-lamassu-admin/src/components/inputs/base/SecretInput.js
@@ -9,12 +9,12 @@ const SecretInput = memo(({ value, onFocus, onBlur, ...props }) => {
const previouslyFilled = !!value
const tempValue = previouslyFilled ? '' : value
- const iOnFocus = event => {
+ const innerOnFocus = event => {
setFocused(true)
onFocus && onFocus(event)
}
- const iOnBlur = event => {
+ const innerOnBlur = event => {
setFocused(false)
onBlur && onBlur(event)
}
@@ -23,8 +23,8 @@ const SecretInput = memo(({ value, onFocus, onBlur, ...props }) => {
{
const error = !!(touched[name] && errors[name])
const { initialValues } = useFormikContext()
- const iOptions =
+ const innerOptions =
R.type(options) === 'Function' ? options(initialValues) : options
return (
@@ -20,7 +20,7 @@ const AutocompleteFormik = ({ options, ...props }) => {
onBlur={onBlur}
value={value}
error={error}
- options={iOptions}
+ options={innerOptions}
{...props}
/>
)
diff --git a/new-lamassu-admin/src/pages/AddMachine/AddMachine.js b/new-lamassu-admin/src/pages/AddMachine/AddMachine.js
index 57b496d3..f89c48f4 100644
--- a/new-lamassu-admin/src/pages/AddMachine/AddMachine.js
+++ b/new-lamassu-admin/src/pages/AddMachine/AddMachine.js
@@ -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 { 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 CurrentStageIconZodiac } from 'src/styling/icons/stage/zodiac/current.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 CloseIcon } from 'src/styling/icons/action/close/zodiac.svg'
+import { primaryColor } from 'src/styling/variables'
import styles from './styles'
diff --git a/new-lamassu-admin/src/pages/Notifications/Notifications.js b/new-lamassu-admin/src/pages/Notifications/Notifications.js
index 0eeb4cc2..ffcd3fac 100644
--- a/new-lamassu-admin/src/pages/Notifications/Notifications.js
+++ b/new-lamassu-admin/src/pages/Notifications/Notifications.js
@@ -4,7 +4,7 @@ import * as R from 'ramda'
import React, { useState } from 'react'
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'
@@ -49,12 +49,13 @@ const Notifications = ({ name: SCREEN_KEY }) => {
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 cryptoCurrencies = data?.cryptoCurrencies
- // TODO improve the way of fetching this
- const currency = R.path(['locale_fiatCurrency', 'code'])(data?.config ?? {})
+ const currency = R.path(['fiatCurrency'])(
+ fromNamespace(namespaces.LOCALE)(data?.config)
+ )
const save = R.curry((section, rawConfig) => {
const config = toNamespace(SCREEN_KEY)(rawConfig)
diff --git a/new-lamassu-admin/src/pages/Notifications/sections/CryptoBalanceOverrides.js b/new-lamassu-admin/src/pages/Notifications/sections/CryptoBalanceOverrides.js
index fc39f25c..05b44439 100644
--- a/new-lamassu-admin/src/pages/Notifications/sections/CryptoBalanceOverrides.js
+++ b/new-lamassu-admin/src/pages/Notifications/sections/CryptoBalanceOverrides.js
@@ -56,12 +56,10 @@ const CryptoBalanceOverrides = ({ section }) => {
[LOW_BALANCE_KEY]: Yup.number()
.integer()
.min(0)
- .max(99999999)
.required(),
[HIGH_BALANCE_KEY]: Yup.number()
.integer()
.min(0)
- .max(99999999)
.required()
})
diff --git a/new-lamassu-admin/src/routing/routes.js b/new-lamassu-admin/src/routing/routes.js
index 73db367c..02c6ce7c 100644
--- a/new-lamassu-admin/src/routing/routes.js
+++ b/new-lamassu-admin/src/routing/routes.js
@@ -15,6 +15,7 @@ import Services from 'src/pages/Services/Services'
import Transactions from 'src/pages/Transactions/Transactions'
import WalletSettings from 'src/pages/Wallet/Wallet'
import MachineStatus from 'src/pages/maintenance/MachineStatus'
+import { namespaces } from 'src/utils/config'
const tree = [
{
@@ -38,7 +39,7 @@ const tree = [
component: MachineLogs
},
{
- key: 'fuding',
+ key: 'funding',
label: 'Funding',
route: '/maintenance/funding',
component: Funding
@@ -66,39 +67,39 @@ const tree = [
},
children: [
{
- key: 'commissions',
+ key: namespaces.COMMISSIONS,
label: 'Commissions',
route: '/settings/commissions',
component: Commissions
},
{
- key: 'locale',
+ key: namespaces.LOCALE,
label: 'Locale',
route: '/settings/locale',
component: Locales
},
{
- key: 'services',
+ key: namespaces.SERVICES,
label: '3rd party services',
route: '/settings/3rd-party-services',
component: Services
},
{
- key: 'notifications',
+ key: namespaces.NOTIFICATIONS,
label: 'Notifications',
route: '/settings/notifications',
component: Notifications
},
{
- key: 'info',
+ key: namespaces.OPERATOR_INFO,
label: 'Operator Info',
route: '/settings/operator-info',
component: OperatorInfo
},
{
- key: 'wallet',
+ key: namespaces.WALLETS,
label: 'Wallet',
- route: '/settings/wallet',
+ route: '/settings/wallet-settings',
component: WalletSettings
}
]
diff --git a/new-lamassu-admin/src/utils/config.js b/new-lamassu-admin/src/utils/config.js
index 3fff3a1d..c6abad75 100644
--- a/new-lamassu-admin/src/utils/config.js
+++ b/new-lamassu-admin/src/utils/config.js
@@ -1,5 +1,14 @@
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) =>
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)
)
-export { fromNamespace, toNamespace }
+export { fromNamespace, toNamespace, namespaces }