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

@ -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,
),
)
}}
/>