fix: small bugfixes and improvements

This commit is contained in:
Taranto 2020-09-24 09:33:43 +01:00 committed by Josh Harvey
parent f6547341f1
commit c45241471e
14 changed files with 97 additions and 205 deletions

View file

@ -11,7 +11,7 @@ import WizardSplash from './WizardSplash'
import WizardStep from './WizardStep'
import { DenominationsSchema } from './helper'
const LAST_STEP = 3
const LAST_STEP = 4
const MODAL_WIDTH = 554
const MODAL_HEIGHT = 520
@ -60,6 +60,13 @@ const Wizard = ({ machine, locale, onClose, save, error }) => {
type: 'bottom',
display: 'Cassette 2',
component: Autocomplete
},
{
type: 'zeroConfLimit',
display: '0-conf Limit',
schema: Yup.object().shape({
zeroConfLimit: Yup.number().required()
})
}
]

View file

@ -39,10 +39,10 @@ const WizardStep = ({
<div className={classes.content}>
<div className={classes.titleDiv}>
<Info2 className={classes.title}>{name}</Info2>
<Stepper steps={3} currentStep={step} />
<Stepper steps={4} currentStep={step} />
</div>
{!lastStep && (
{step <= 2 && (
<Formik
onSubmit={onContinue}
initialValues={{ top: '', bottom: '' }}
@ -94,6 +94,43 @@ const WizardStep = ({
</Formik>
)}
{step === 3 && (
<Formik
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}>
<Info2 className={classes.title}>Cashout Bill Count</Info2>

View file

@ -41,7 +41,11 @@ export default {
},
header: {
display: 'flex',
paddingBottom: 96
paddingBottom: 95
},
thirdStepHeader: {
display: 'flex',
paddingBottom: 188
},
step: {
flex: 1

View file

@ -52,6 +52,7 @@ const getOverridesFields = (getData, currency, auxElements) => {
)
const suggestionFilter = (it, cryptoData) => {
console.log(it)
if (!it?.machine) return cryptoData
return R.differenceWith(

View file

@ -34,7 +34,7 @@ const GET_MACHINES = gql`
}
`
const NUM_LOG_RESULTS = 1000
const NUM_LOG_RESULTS = 500
const GET_MACHINE_LOGS = gql`
query MachineLogs($deviceId: ID!, $limit: Int, $from: Date, $until: Date) {
@ -72,11 +72,7 @@ const Logs = () => {
const deviceId = selected?.deviceId
const { data: machineResponse } = useQuery(GET_MACHINES, {
variables: {
limit: NUM_LOG_RESULTS
}
})
const { data: machineResponse } = useQuery(GET_MACHINES)
const [sendSnapshot, { loading }] = useMutation(SUPPORT_LOGS, {
variables: { deviceId },
@ -85,7 +81,7 @@ const Logs = () => {
})
const { data: logsResponse } = useQuery(GET_MACHINE_LOGS, {
variables: { deviceId },
variables: { deviceId, limit: NUM_LOG_RESULTS },
skip: !selected,
onCompleted: () => setSaveMessage('')
})

View file

@ -1,8 +1,7 @@
import { useQuery, useMutation } from '@apollo/react-hooks'
import { makeStyles } from '@material-ui/core/styles'
import gql from 'graphql-tag'
import * as R from 'ramda'
import React, { useState, memo } from 'react'
import React, { memo } from 'react'
import Tooltip from 'src/components/Tooltip'
import { Switch } from 'src/components/inputs'
@ -13,14 +12,8 @@ import { mainStyles } from './CoinATMRadar.styles'
const useStyles = makeStyles(mainStyles)
const initialValues = {
active: false,
commissions: false,
limitsAndVerification: false
}
const GET_CONFIG = gql`
{
query getData {
config
}
`
@ -50,29 +43,12 @@ const Row = memo(({ title, disabled = false, checked, save, label }) => {
})
const CoinATMRadar = memo(() => {
const [coinAtmRadarConfig, setCoinAtmRadarConfig] = useState(null)
const classes = useStyles()
const { refetch: getCoinAtmRadarConfig } = useQuery(GET_CONFIG, {
onCompleted: configResponse => {
const response = fromNamespace(
namespaces.COIN_ATM_RADAR,
configResponse.config
)
const values = R.merge(initialValues, response)
setCoinAtmRadarConfig(values)
}
})
const { data } = useQuery(GET_CONFIG)
const [saveConfig] = useMutation(SAVE_CONFIG, {
onCompleted: configResponse => {
setCoinAtmRadarConfig(
fromNamespace(namespaces.COIN_ATM_RADAR, configResponse.saveConfig)
)
getCoinAtmRadarConfig()
}
refetchQueries: ['getData']
})
const save = it =>
@ -80,6 +56,8 @@ const CoinATMRadar = memo(() => {
variables: { config: toNamespace(namespaces.COIN_ATM_RADAR, it) }
})
const coinAtmRadarConfig =
data?.config && fromNamespace(namespaces.COIN_ATM_RADAR, data.config)
if (!coinAtmRadarConfig) return null
return (

View file

@ -88,7 +88,7 @@ const Field = ({ editing, field, displayValue, ...props }) => {
}
const GET_CONFIG = gql`
{
query getData {
config
}
`
@ -104,24 +104,18 @@ const styles = R.merge(globalStyles, contactInfoStyles)
const contactUseStyles = makeStyles(styles)
const ContactInfo = () => {
const classes = contactUseStyles()
const [editing, setEditing] = useState(false)
const [info, setInfo] = useState(null)
const [locale, setLocale] = useState(null)
const [error, setError] = useState(null)
const [saveConfig] = useMutation(SAVE_CONFIG, {
onCompleted: data => {
setInfo(fromNamespace(namespaces.OPERATOR_INFO, data.saveConfig))
setEditing(false)
},
onCompleted: () => setEditing(false),
refetchQueries: () => ['getData'],
onError: e => setError(e)
})
useQuery(GET_CONFIG, {
onCompleted: data => {
setInfo(fromNamespace(namespaces.OPERATOR_INFO, data.config))
setLocale(fromNamespace(namespaces.LOCALE, data.config))
}
})
const { data } = useQuery(GET_CONFIG)
const save = it => {
return saveConfig({
@ -129,7 +123,9 @@ const ContactInfo = () => {
})
}
const classes = contactUseStyles()
const info =
data?.config && fromNamespace(namespaces.OPERATOR_INFO, data.config)
const locale = data?.config && fromNamespace(namespaces.LOCALE, data.config)
if (!info) return null

View file

@ -2,7 +2,7 @@ import { useQuery, useMutation } from '@apollo/react-hooks'
import { makeStyles } from '@material-ui/core/styles'
import gql from 'graphql-tag'
import * as R from 'ramda'
import React, { useState, memo } from 'react'
import React, { memo } from 'react'
import { BooleanPropertiesTable } from 'src/components/booleanPropertiesTable'
import { Switch } from 'src/components/inputs'
@ -13,20 +13,8 @@ import { mainStyles } from './ReceiptPrinting.styles'
const useStyles = makeStyles(mainStyles)
const initialValues = {
active: 'off',
operatorWebsite: false,
operatorEmail: false,
operatorPhone: false,
companyNumber: false,
machineLocation: false,
customerNameOrPhoneNumber: false,
exchangeRate: false,
addressQRCode: false
}
const GET_CONFIG = gql`
{
query getData {
config
}
`
@ -38,26 +26,12 @@ const SAVE_CONFIG = gql`
`
const ReceiptPrinting = memo(() => {
const [receiptPrintingConfig, setReceiptPrintingConfig] = useState(null)
const classes = useStyles()
const { refetch: getReceiptPrintingConfig } = useQuery(GET_CONFIG, {
onCompleted: configResponse => {
const response = fromNamespace(namespaces.RECEIPT, configResponse.config)
const values = R.merge(initialValues, response)
setReceiptPrintingConfig(values)
}
})
const { data } = useQuery(GET_CONFIG)
const [saveConfig] = useMutation(SAVE_CONFIG, {
onCompleted: configResponse => {
setReceiptPrintingConfig(
fromNamespace(namespaces.RECEIPT, configResponse.saveConfig)
)
getReceiptPrintingConfig()
}
refetchQueries: () => ['getData']
})
const save = it =>
@ -65,6 +39,8 @@ const ReceiptPrinting = memo(() => {
variables: { config: toNamespace(namespaces.RECEIPT, it) }
})
const receiptPrintingConfig =
data?.config && fromNamespace(namespaces.RECEIPT, data.config)
if (!receiptPrintingConfig) return null
return (

View file

@ -74,7 +74,7 @@ const Field = ({
}
const GET_CONFIG = gql`
{
query getData {
config
}
`
@ -90,36 +90,25 @@ const styles = R.merge(globalStyles, termsConditionsStyles)
const useTermsConditionsStyles = makeStyles(styles)
const TermsConditions = () => {
const [showOnScreen, setShowOnScreen] = useState(false)
const [formData, setFormData] = useState(null)
const [error, setError] = useState(null)
const [editing, setEditing] = useState(false)
const [saveConfig] = useMutation(SAVE_CONFIG, {
onCompleted: data => {
const termsAndConditions = fromNamespace(
namespaces.TERMS_CONDITIONS,
data.saveConfig
)
setFormData(termsAndConditions)
setShowOnScreen(termsAndConditions.active)
onCompleted: () => {
setError(null)
setEditing(false)
},
refetchQueries: () => ['getData'],
onError: e => setError(e)
})
const classes = useTermsConditionsStyles()
useQuery(GET_CONFIG, {
onCompleted: data => {
const termsAndConditions = fromNamespace(
namespaces.TERMS_CONDITIONS,
data.config
)
setFormData(termsAndConditions ?? {})
setShowOnScreen(termsAndConditions?.active ?? false)
}
})
const { data } = useQuery(GET_CONFIG)
const termsAndConditions =
data?.config && fromNamespace(namespaces.TERMS_CONDITIONS, data.config)
const formData = termsAndConditions ?? {}
const showOnScreen = termsAndConditions?.active ?? false
const save = it => {
setError(null)

View file

@ -60,7 +60,7 @@ const formatDate = date => {
return moment(date).format('YYYY-MM-DD HH:mm')
}
const NUM_LOG_RESULTS = 1000
const NUM_LOG_RESULTS = 500
const GET_DATA = gql`
query ServerData($limit: Int) {

View file

@ -13,11 +13,11 @@ import TitleSection from 'src/components/layout/TitleSection'
import { P, Label2 } from 'src/components/typography'
import { fromNamespace, toNamespace, namespaces } from 'src/utils/config'
import { mainStyles } from './Triggers.styles'
import styles from './Triggers.styles'
import Wizard from './Wizard'
import { Schema, getElements, sortBy, fromServer, toServer } from './helper'
const useStyles = makeStyles(mainStyles)
const useStyles = makeStyles(styles)
const SAVE_CONFIG = gql`
mutation Save($config: JSONObject) {

View file

@ -1,25 +1,7 @@
import { booleanPropertiesTableStyles } from 'src/components/booleanPropertiesTable/BooleanPropertiesTable.styles'
import baseStyles from 'src/pages/Logs.styles'
const { titleWrapper, titleAndButtonsContainer, buttonsWrapper } = baseStyles
const { rowWrapper, radioButtons } = booleanPropertiesTableStyles
const mainStyles = {
titleWrapper,
titleAndButtonsContainer,
buttonsWrapper,
rowWrapper,
radioButtons,
radioGroup: {
flexDirection: 'row'
},
radioLabel: {
width: 150,
height: 40
},
radio: {
padding: 4,
margin: 4
export default {
switchLabel: {
margin: 6,
width: 24
},
tableRadioGroup: {
flexDirection: 'row',
@ -27,82 +9,5 @@ const mainStyles = {
},
tableRadioLabel: {
marginRight: 0
},
closeButton: {
position: 'absolute',
width: 16,
height: 16,
top: 20,
right: 0
},
stepOneRadioButtons: {
'& > *': {
marginRight: 48
}
},
stepTwoRadioButtons: {
'& > *': {
minWidth: 174,
marginRight: 72
}
},
stepThreeRadioButtons: {
'& > *': {
minWidth: 160,
marginRight: 12
}
},
wizardHeaderText: {
display: 'flex',
margin: [[24, 0]]
},
paper: {
padding: [[5, 20, 32, 24]],
position: 'relative',
display: 'flex',
flexDirection: 'column',
width: 520,
height: 480,
overflow: 'hidden',
'& > button': {
position: 'absolute',
top: 16,
right: 16,
border: 'none',
backgroundColor: 'transparent',
cursor: 'pointer',
'& svg': {
width: 18
}
},
'& form': {
display: 'flex',
flexDirection: 'column',
flexGrow: 2
}
},
transparentButton: {
'& > *': {
margin: 'auto 12px'
},
'& button': {
border: 'none',
backgroundColor: 'transparent',
cursor: 'pointer'
}
},
popoverContent: {
width: 272,
padding: [[10, 15]]
},
radioGroupWrapper: {
marginBottom: 46
},
textInput: {
width: 96,
height: 40,
marginRight: 8
}
}
export { mainStyles }

View file

@ -117,6 +117,8 @@ const getRequirementText = config => {
return 'asked to scan a ID'
case 'facephoto':
return 'asked to have a photo taken'
case 'us-ssn':
return 'asked to input his social security number'
case 'sanctions':
return 'matched against the OFAC sanctions list'
case 'superuser':

View file

@ -261,6 +261,7 @@ const requirementOptions = [
{ display: 'ID data', code: 'idCardData' },
{ display: 'Customer camera', code: 'facephoto' },
{ display: 'Sanctions', code: 'sanctions' },
{ display: 'US SSN', code: 'us-ssn' },
// { display: 'Super user', code: 'superuser' },
{ display: 'Suspend', code: 'suspend' },
{ display: 'Block', code: 'block' }