chore: reformat code

This commit is contained in:
Rafael Taranto 2025-05-12 14:49:39 +01:00
parent 3d930aa73b
commit aedabcbdee
509 changed files with 6030 additions and 4266 deletions

View file

@ -23,12 +23,12 @@ const CoinATMRadar = memo(({ wizard }) => {
const { data } = useQuery(GET_CONFIG)
const [saveConfig] = useMutation(SAVE_CONFIG, {
refetchQueries: ['getData']
refetchQueries: ['getData'],
})
const save = it =>
saveConfig({
variables: { config: toNamespace(namespaces.COIN_ATM_RADAR, it) }
variables: { config: toNamespace(namespaces.COIN_ATM_RADAR, it) },
})
const coinAtmRadarConfig =
@ -54,12 +54,12 @@ const CoinATMRadar = memo(({ wizard }) => {
elements={[
{
name: 'commissions',
display: 'Commissions'
display: 'Commissions',
},
{
name: 'limitsAndVerification',
display: 'Limits and verification'
}
display: 'Limits and verification',
},
]}
save={save}
/>

View file

@ -71,14 +71,14 @@ const ContactInfo = ({ wizard }) => {
const [saveConfig] = useMutation(SAVE_CONFIG, {
onCompleted: () => setEditing(false),
refetchQueries: () => ['getData'],
onError: e => setError(e)
onError: e => setError(e),
})
const { data } = useQuery(GET_CONFIG)
const save = it => {
return saveConfig({
variables: { config: toNamespace(namespaces.OPERATOR_INFO, it) }
variables: { config: toNamespace(namespaces.OPERATOR_INFO, it) },
})
}
@ -95,7 +95,7 @@ const ContactInfo = ({ wizard }) => {
.email('Please enter a valid email address')
.required('An email is required'),
website: Yup.string(),
companyNumber: Yup.string()
companyNumber: Yup.string(),
})
const fields = [
@ -103,32 +103,32 @@ const ContactInfo = ({ wizard }) => {
name: 'name',
label: 'Company name',
value: info.name ?? '',
component: TextInput
component: TextInput,
},
{
name: 'phone',
label: 'Phone number',
value: info.phone,
component: TextInput
component: TextInput,
},
{
name: 'email',
label: 'Email',
value: info.email ?? '',
component: TextInput
component: TextInput,
},
{
name: 'website',
label: 'Website',
value: info.website ?? '',
component: TextInput
component: TextInput,
},
{
name: 'companyNumber',
label: 'Company registration number',
value: info.companyNumber ?? '',
component: TextInput
}
component: TextInput,
},
]
const findField = name => R.find(R.propEq('name', name))(fields)
@ -143,8 +143,8 @@ const ContactInfo = ({ wizard }) => {
phone: findValue('phone'),
email: findValue('email'),
website: findValue('website'),
companyNumber: findValue('companyNumber')
}
companyNumber: findValue('companyNumber'),
},
}
const getErrorMsg = formikErrors =>

View file

@ -19,24 +19,24 @@ const SAVE_CONFIG = gql`
}
`
const MachineScreens = memo(({ wizard }) => {
const MachineScreens = memo(() => {
const { data } = useQuery(GET_CONFIG)
const [saveConfig] = useMutation(SAVE_CONFIG, {
refetchQueries: () => ['getData']
refetchQueries: () => ['getData'],
})
const save = it => {
const formatConfig = R.compose(
toNamespace(namespaces.MACHINE_SCREENS),
toNamespace('rates'),
R.mergeRight(ratesScreenConfig)
R.mergeRight(ratesScreenConfig),
)
return saveConfig({
variables: {
config: formatConfig({ active: it })
}
config: formatConfig({ active: it }),
},
})
}
@ -47,7 +47,7 @@ const MachineScreens = memo(({ wizard }) => {
data?.config &&
R.compose(
fromNamespace('rates'),
fromNamespace(namespaces.MACHINE_SCREENS)
fromNamespace(namespaces.MACHINE_SCREENS),
)(data.config)
if (!machineScreensConfig) return null

View file

@ -24,7 +24,7 @@ const ReceiptPrinting = memo(({ wizard }) => {
const { data } = useQuery(GET_CONFIG)
const [saveConfig] = useMutation(SAVE_CONFIG, {
refetchQueries: () => ['getData']
refetchQueries: () => ['getData'],
})
const saveSwitch = object => {
@ -32,15 +32,15 @@ const ReceiptPrinting = memo(({ wizard }) => {
variables: {
config: toNamespace(
namespaces.RECEIPT,
R.mergeRight(receiptPrintingConfig, object)
)
}
R.mergeRight(receiptPrintingConfig, object),
),
},
})
}
const save = it =>
saveConfig({
variables: { config: toNamespace(namespaces.RECEIPT, it) }
variables: { config: toNamespace(namespaces.RECEIPT, it) },
})
const receiptPrintingConfig =
@ -76,36 +76,36 @@ const ReceiptPrinting = memo(({ wizard }) => {
elements={[
{
name: 'operatorWebsite',
display: 'Operator website'
display: 'Operator website',
},
{
name: 'operatorEmail',
display: 'Operator email'
display: 'Operator email',
},
{
name: 'operatorPhone',
display: 'Operator phone'
display: 'Operator phone',
},
{
name: 'companyNumber',
display: 'Company registration number'
display: 'Company registration number',
},
{
name: 'machineLocation',
display: 'Machine location'
display: 'Machine location',
},
{
name: 'customerNameOrPhoneNumber',
display: 'Customer name or phone number (if known)'
display: 'Customer name or phone number (if known)',
},
{
name: 'exchangeRate',
display: 'Exchange rate'
display: 'Exchange rate',
},
{
name: 'addressQRCode',
display: 'Address QR code'
}
display: 'Address QR code',
},
]}
save={save}
/>

View file

@ -82,13 +82,13 @@ const TOOLTIPS = {
cashOutDispenseReady: ``,
smsReceipt:
formatContent(`The contents of this notice will be appended to the end of the SMS receipt sent, and not replace it.\n
To edit the contents of the SMS receipt, please go to the 'Receipt' tab`)
To edit the contents of the SMS receipt, please go to the 'Receipt' tab`),
}
const SMSPreview = ({ sms, coords, timezone }) => {
const matches = {
'#code': 123,
'#timestamp': formatDate(new Date(), timezone, 'HH:mm')
'#timestamp': formatDate(new Date(), timezone, 'HH:mm'),
}
return (
@ -128,17 +128,17 @@ const SMSNotices = () => {
const [editMessage] = useMutation(EDIT_SMS_NOTICE, {
onError: ({ msg }) => setErrorMsg(msg),
refetchQueries: () => ['SMSNotices']
refetchQueries: () => ['SMSNotices'],
})
const [enableMessage] = useMutation(ENABLE_SMS_NOTICE, {
onError: ({ msg }) => setErrorMsg(msg),
refetchQueries: () => ['SMSNotices']
refetchQueries: () => ['SMSNotices'],
})
const [disableMessage] = useMutation(DISABLE_SMS_NOTICE, {
onError: ({ msg }) => setErrorMsg(msg),
refetchQueries: () => ['SMSNotices']
refetchQueries: () => ['SMSNotices'],
})
const loading = messagesLoading
@ -164,7 +164,7 @@ const SMSNotices = () => {
</div>
) : (
R.prop('messageName', it)
)
),
},
{
header: 'Edit',
@ -182,7 +182,7 @@ const SMSNotices = () => {
<EditIcon />
</SvgIcon>
</IconButton>
)
),
},
{
header: 'Enable',
@ -199,7 +199,7 @@ const SMSNotices = () => {
}}
checked={it.enabled}
/>
)
),
},
{
header: '',
@ -215,7 +215,7 @@ const SMSNotices = () => {
y:
window.innerHeight -
5 -
e.currentTarget.getBoundingClientRect().bottom
e.currentTarget.getBoundingClientRect().bottom,
})
R.equals(selectedSMS, it)
? setPreviewOpen(!previewOpen)
@ -229,8 +229,8 @@ const SMSNotices = () => {
)}
</SvgIcon>
</IconButton>
)
}
),
},
]
return (

View file

@ -30,39 +30,39 @@ const PREFILL = {
name: 'has-code',
message: 'The confirmation code is missing from the message!',
exclusive: false,
test: value => value?.match(/#code/g)?.length > 0
test: value => value?.match(/#code/g)?.length > 0,
})
.test({
name: 'has-single-code',
message: 'There should be a single confirmation code!',
exclusive: false,
test: value => value?.match(/#code/g)?.length === 1
})
test: value => value?.match(/#code/g)?.length === 1,
}),
},
cashOutDispenseReady: {
validator: Yup.string().required('The message content is required!').trim()
validator: Yup.string().required('The message content is required!').trim(),
},
smsReceipt: {
validator: Yup.string().trim()
}
validator: Yup.string().trim(),
},
}
const CHIPS = {
smsCode: [
{ code: '#code', display: 'Confirmation code', obligatory: true },
{ code: '#timestamp', display: 'Timestamp', obligatory: false }
{ code: '#timestamp', display: 'Timestamp', obligatory: false },
],
cashOutDispenseReady: [
{ code: '#timestamp', display: 'Timestamp', obligatory: false }
{ code: '#timestamp', display: 'Timestamp', obligatory: false },
],
smsReceipt: [{ code: '#timestamp', display: 'Timestamp', obligatory: false }]
smsReceipt: [{ code: '#timestamp', display: 'Timestamp', obligatory: false }],
}
const DEFAULT_MESSAGES = {
smsCode: 'Your cryptomat code: #code',
cashOutDispenseReady:
'Your cash is waiting! Go to the Cryptomat and press Redeem within 24 hours. [#timestamp]',
smsReceipt: ''
smsReceipt: '',
}
const SMSNoticesModal = ({
@ -70,18 +70,18 @@ const SMSNoticesModal = ({
onClose,
sms,
creationError,
submit
submit,
}) => {
const initialValues = {
event: !R.isNil(sms) ? sms.event : '',
message: !R.isNil(sms) ? sms.message : ''
message: !R.isNil(sms) ? sms.message : '',
}
const validationSchema = Yup.object().shape({
event: Yup.string().required('An event is required!'),
message:
PREFILL[sms?.event]?.validator ??
Yup.string().required('The message content is required!').trim()
Yup.string().required('The message content is required!').trim(),
})
const handleSubmit = values => {
@ -90,14 +90,14 @@ const SMSNoticesModal = ({
variables: {
id: sms.id,
event: values.event,
message: values.message
}
message: values.message,
},
})
: submit({
variables: {
event: values.event,
message: values.message
}
message: values.message,
},
})
onClose()
}
@ -160,8 +160,8 @@ const SMSNoticesModal = ({
'message',
values.message.concat(
R.last(values.message) === ' ' ? '' : ' ',
ite.code
)
ite.code,
),
)
}}
/>

View file

@ -32,7 +32,7 @@ const Field = ({
}) => {
const info3ClassNames = {
'overflow-hidden whitespace-nowrap text-ellipsis h-6': !multiline,
'wrap-anywhere overflow-y-auto h-32 mt-4 leading-[23px]': multiline
'wrap-anywhere overflow-y-auto h-32 mt-4 leading-[23px]': multiline,
}
return (
@ -88,7 +88,7 @@ const TermsConditions = () => {
setEditing(false)
},
refetchQueries: () => ['getData'],
onError: e => setError(e)
onError: e => setError(e),
})
const { data } = useQuery(GET_CONFIG)
@ -102,7 +102,7 @@ const TermsConditions = () => {
const save = it =>
saveConfig({
variables: { config: toNamespace(namespaces.TERMS_CONDITIONS, it) }
variables: { config: toNamespace(namespaces.TERMS_CONDITIONS, it) },
})
const fields = [
@ -110,7 +110,7 @@ const TermsConditions = () => {
name: 'title',
label: 'Screen title',
value: formData.title ?? '',
width: 282
width: 282,
},
{
name: 'text',
@ -118,22 +118,22 @@ const TermsConditions = () => {
value: formData.text ?? '',
width: 502,
multiline: true,
rows: 6
rows: 6,
},
{
name: 'acceptButtonText',
label: 'Accept button text',
value: formData.acceptButtonText ?? '',
placeholder: 'I accept',
width: 282
width: 282,
},
{
name: 'cancelButtonText',
label: 'Cancel button text',
value: formData.cancelButtonText ?? '',
placeholder: 'Cancel',
width: 282
}
width: 282,
},
]
const findField = name => R.find(R.propEq('name', name))(fields)
@ -143,7 +143,7 @@ const TermsConditions = () => {
title: findValue('title'),
text: findValue('text'),
acceptButtonText: findValue('acceptButtonText'),
cancelButtonText: findValue('cancelButtonText')
cancelButtonText: findValue('cancelButtonText'),
}
const validationSchema = Yup.object().shape({
@ -151,14 +151,14 @@ const TermsConditions = () => {
.required('The screen title is required')
.max(50, 'Too long'),
text: Yup.string('The text content must be a string').required(
'The text content is required'
'The text content is required',
),
acceptButtonText: Yup.string('The accept button text must be a string')
.required('The accept button text is required')
.max(50, 'The accept button text is too long'),
cancelButtonText: Yup.string('The cancel button text must be a string')
.required('The cancel button text is required')
.max(50, 'The cancel button text is too long')
.max(50, 'The cancel button text is too long'),
})
return (