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

@ -21,7 +21,7 @@ const GET_DATA = gql`
}
`
const Wizard = ({ fromAuthRegister }) => {
const Wizard = () => {
const { data, loading } = useQuery(GET_DATA)
const history = useHistory()
const { setWizardTested } = useContext(AppContext)
@ -68,7 +68,7 @@ const Wizard = ({ fromAuthRegister }) => {
'flex flex-col justify-between py-4 px-0 bg-white': true,
'bg-[url(/wizard-background.svg)] bg-no-repeat bg-center bg-fixed bg-cover':
isWelcome,
'blur-sm pointer-events-none': footerExp
'blur-sm pointer-events-none': footerExp,
}
return (

View file

@ -23,7 +23,7 @@ function Commissions({ isActive, doContinue }) {
const { data } = useQuery(GET_DATA)
const [saveConfig] = useMutation(SAVE_CONFIG, {
onCompleted: doContinue
onCompleted: doContinue,
})
const save = it => {
@ -32,7 +32,7 @@ function Commissions({ isActive, doContinue }) {
}
const currency = R.path(['fiatCurrency'])(
fromNamespace(namespaces.LOCALE)(data?.config)
fromNamespace(namespaces.LOCALE)(data?.config),
)
const locale = fromNamespace(namespaces.LOCALE)(data?.config)

View file

@ -8,7 +8,7 @@ import { Table as EditableTable } from 'src/components/editableTable'
import {
mainFields,
localeDefaults as defaults,
LocaleSchema as schema
LocaleSchema as schema,
} from 'src/pages/Locales/helper'
import { toNamespace } from 'src/utils/config'
@ -51,7 +51,7 @@ function Locales({ isActive, doContinue }) {
const { data } = useQuery(GET_DATA)
const [saveConfig] = useMutation(SAVE_CONFIG, {
onCompleted: doContinue
onCompleted: doContinue,
})
const save = it => {
@ -61,7 +61,7 @@ function Locales({ isActive, doContinue }) {
const cryptoCurrencies = getConfiguredCoins(
data?.config || {},
data?.cryptoCurrencies || []
data?.cryptoCurrencies || [],
)
const onChangeCoin = (prev, curr, setValue) => setValue(curr)
@ -83,7 +83,7 @@ function Locales({ isActive, doContinue }) {
data={[]}
elements={mainFields(
R.mergeRight(data, { cryptoCurrencies }),
onChangeCoin
onChangeCoin,
)}
/>
</Section>

View file

@ -1,4 +1,4 @@
import { useMutation, useQuery, gql } from "@apollo/client";
import { useMutation, useQuery, gql } from '@apollo/client'
import React, { useState, useEffect } from 'react'
import { H4, Info3 } from 'src/components/typography'
import FormRenderer from 'src/pages/Services/FormRenderer'
@ -33,12 +33,12 @@ const SAVE_ACCOUNTS = gql`
const options = [
{
code: 'enabled',
display: 'Yes, send notifications to my email'
display: 'Yes, send notifications to my email',
},
{
code: 'disabled',
display: "No, don't send email notifications"
}
display: "No, don't send email notifications",
},
]
const Mailgun = () => {
@ -111,7 +111,9 @@ const Mailgun = () => {
value={accounts.mailgun}
save={saveAccount}
elements={mailgunSchema.elements}
validationSchema={mailgunSchema.getValidationSchema(accounts.mailgun)}
validationSchema={mailgunSchema.getValidationSchema(
accounts.mailgun,
)}
buttonLabel={'Save'}
/>
</>

View file

@ -19,7 +19,7 @@ const pages = [
SETUP_CHANNELS,
TRANSACTION_ALERTS,
FIAT_BALANCE_ALERTS,
CRYPTO_BALANCE_ALERTS
CRYPTO_BALANCE_ALERTS,
]
const N = () => {

View file

@ -1,4 +1,5 @@
import React from 'react'
// import OperatorInfo from 'src/pages/OperatorInfo'
function WizardOperatorInfo() {

View file

@ -29,12 +29,12 @@ const SAVE_ACCOUNTS = gql`
const options = [
{
code: 'enable',
display: 'Yes, I will'
display: 'Yes, I will',
},
{
code: 'disable',
display: 'No, not for now'
}
display: 'No, not for now',
},
]
function Twilio({ doContinue }) {
@ -43,7 +43,7 @@ function Twilio({ doContinue }) {
const { data, refetch } = useQuery(GET_CONFIG)
const [saveAccounts] = useMutation(SAVE_ACCOUNTS, {
onCompleted: doContinue
onCompleted: doContinue,
})
const accounts = data?.accounts ?? []
@ -65,7 +65,7 @@ function Twilio({ doContinue }) {
const titleClasses = {
'ml-2 mb-2': true,
[sharedClasses.error]: error
[sharedClasses.error]: error,
}
return (

View file

@ -21,4 +21,4 @@
.info {
margin-top: 20px;
margin-bottom: 20px;
}
}

View file

@ -1,4 +1,4 @@
import { useQuery, useMutation, gql } from "@apollo/client";
import { useQuery, useMutation, gql } from '@apollo/client'
import * as R from 'ramda'
import React, { useState } from 'react'
import { P, H4 } from 'src/components/typography'
@ -9,6 +9,7 @@ import { NamespacedTable as EditableTable } from 'src/components/editableTable'
import { toNamespace, namespaces } from 'src/utils/config'
import classes from './Shared.module.css'
const GET_INFO = gql`
query getData {
config
@ -36,7 +37,7 @@ const SAVE_CONFIG = gql`
const AllSet = ({ data: currentData, doContinue }) => {
const { data } = useQuery(GET_INFO)
const [saveConfig] = useMutation(SAVE_CONFIG, {
onCompleted: doContinue
onCompleted: doContinue,
})
const [error, setError] = useState(false)
@ -49,7 +50,7 @@ const AllSet = ({ data: currentData, doContinue }) => {
const save = () => {
const adjustedData = {
zeroConfLimit: 0,
...currentData
...currentData,
}
if (!WalletSchema.isValidSync(adjustedData)) return setError(true)
@ -61,16 +62,16 @@ const AllSet = ({ data: currentData, doContinue }) => {
const presentableData = R.pipe(
R.omit(['coin', 'zeroConf', 'zeroConfLimit']),
toNamespace(coin)
toNamespace(coin),
)(currentData)
const presentableElements = R.filter(
R.pipe(
R.prop('name'),
R.flip(R.includes)(['zeroConf', 'zeroConfLimit']),
R.not()
R.not(),
),
getElements(cryptoCurrencies, accountsConfig, null, true)
getElements(cryptoCurrencies, accountsConfig, null, true),
)
return (

View file

@ -1,4 +1,4 @@
import { useMutation, useQuery, gql } from "@apollo/client";
import { useMutation, useQuery, gql } from '@apollo/client'
import React, { useState } from 'react'
import { P, H4 } from 'src/components/typography'
import FormRenderer from 'src/pages/Services/FormRenderer'
@ -23,18 +23,18 @@ const SAVE_ACCOUNTS = gql`
const options = [
{
code: 'enable',
display: 'I will enable cash-out'
display: 'I will enable cash-out',
},
{
code: 'disable',
display: "I won't enable cash-out"
}
display: "I won't enable cash-out",
},
]
const Blockcypher = ({ addData }) => {
const { data } = useQuery(GET_CONFIG)
const [saveConfig] = useMutation(SAVE_ACCOUNTS, {
onCompleted: () => addData({ zeroConf: 'blockcypher' })
onCompleted: () => addData({ zeroConf: 'blockcypher' }),
})
const [selected, setSelected] = useState(null)

View file

@ -1,4 +1,4 @@
import { useQuery, gql } from "@apollo/client";
import { useQuery, gql } from '@apollo/client'
import { Formik, Form, Field } from 'formik'
import React, { useState } from 'react'
import PromptWhenDirty from 'src/components/PromptWhenDirty'
@ -20,7 +20,7 @@ const GET_CONFIG = gql`
`
const schema = Yup.object().shape({
coin: Yup.string().required()
coin: Yup.string().required(),
})
const ChooseCoin = ({ addData }) => {

View file

@ -1,4 +1,4 @@
import { useQuery, useMutation, gql } from "@apollo/client";
import { useQuery, useMutation, gql } from '@apollo/client'
import { getEquivalentCode } from '@lamassu/coins/lightUtils'
import * as R from 'ramda'
import React, { useState } from 'react'
@ -41,7 +41,7 @@ const isConfigurable = it =>
const ChooseExchange = ({ data: currentData, addData }) => {
const { data } = useQuery(GET_CONFIG)
const [saveAccounts] = useMutation(SAVE_ACCOUNTS, {
onCompleted: () => submit()
onCompleted: () => submit(),
})
const [selected, setSelected] = useState(null)
@ -75,7 +75,7 @@ const ChooseExchange = ({ data: currentData, addData }) => {
itbit:
'https://support.lamassu.is/hc/en-us/articles/360026195032-itBit-trading',
bitstamp:
'https://support.lamassu.is/hc/en-us/articles/115001206911-Bitstamp-trading'
'https://support.lamassu.is/hc/en-us/articles/115001206911-Bitstamp-trading',
}
return (
@ -113,7 +113,9 @@ const ChooseExchange = ({ data: currentData, addData }) => {
value={accounts[selected]}
save={saveExchange(selected)}
elements={schema[selected].elements}
validationSchema={schema[selected].getValidationSchema(accounts[selected])}
validationSchema={schema[selected].getValidationSchema(
accounts[selected],
)}
buttonLabel={'Continue'}
buttonClass={classes.formButton}
/>

View file

@ -1,4 +1,4 @@
import { useQuery, gql } from "@apollo/client";
import { useQuery, gql } from '@apollo/client'
import { getEquivalentCode } from '@lamassu/coins/lightUtils'
import * as R from 'ramda'
import React, { useState } from 'react'

View file

@ -1,4 +1,4 @@
import { useQuery, useMutation, gql } from "@apollo/client";
import { useQuery, useMutation, gql } from '@apollo/client'
import * as R from 'ramda'
import React, { useState } from 'react'
import { H4, Info3 } from 'src/components/typography'
@ -45,7 +45,7 @@ const isLocalHosted = it =>
'litecoind',
'dashd',
'zcashd',
'bitcoincashd'
'bitcoincashd',
])
const ChooseWallet = ({ data: currentData, addData }) => {
@ -53,7 +53,7 @@ const ChooseWallet = ({ data: currentData, addData }) => {
const schema = _schema()
const { data } = useQuery(GET_CONFIG)
const [saveAccounts] = useMutation(SAVE_ACCOUNTS, {
onCompleted: () => submit()
onCompleted: () => submit(),
})
const [selected, setSelected] = useState(null)
@ -143,7 +143,7 @@ const ChooseWallet = ({ data: currentData, addData }) => {
save={saveWallet(selected)}
elements={schema.infura.elements}
validationSchema={schema.infura.getValidationSchema(
accounts.infura
accounts.infura,
)}
buttonLabel={'Continue'}
buttonClass={classes.formButton}
@ -158,7 +158,7 @@ const ChooseWallet = ({ data: currentData, addData }) => {
save={saveWallet(selected)}
elements={schema.trongrid.elements}
validationSchema={schema.trongrid.getValidationSchema(
accounts.trongrid
accounts.trongrid,
)}
buttonLabel={'Continue'}
buttonClass={classes.formButton}

View file

@ -42,4 +42,4 @@
.formButton {
margin: 24px 0 0;
}
}

View file

@ -13,28 +13,28 @@ import ChooseWallet from './ChooseWallet'
const steps = [
{
label: 'Choose cryptocurrency',
component: ChooseCoin
component: ChooseCoin,
},
{
label: 'Choose wallet',
component: ChooseWallet
component: ChooseWallet,
},
{
label: 'Choose ticker',
component: ChooseTicker
component: ChooseTicker,
},
{
label: 'Exchange',
component: ChooseExchange
component: ChooseExchange,
},
{
label: 'Blockcypher',
component: Blockcypher
component: Blockcypher,
},
{
label: 'All set',
component: AllSet
}
component: AllSet,
},
]
const Wallet = ({ doContinue }) => {

View file

@ -15,7 +15,7 @@ import Welcome from './components/Welcome'
const getConfiguredCoins = (config, crypto) => {
const wallet = fromNamespace(namespaces.WALLETS, config)
return R.filter(it =>
WalletSchema.isValidSync(fromNamespace(it.code, wallet))
WalletSchema.isValidSync(fromNamespace(it.code, wallet)),
)(crypto)
}
@ -25,7 +25,7 @@ const hasValidWallet = (config, crypto) => {
const hasValidConfig = R.compose(
R.any(R.identity),
R.map(it => WalletSchema.isValidSync(it))
R.map(it => WalletSchema.isValidSync(it)),
)(coins)
return hasValidConfig
@ -60,7 +60,7 @@ const getWizardStep = (config, crypto) => {
const STEPS = [
{
id: 'welcome',
Component: Welcome
Component: Welcome,
},
{
id: 'wallet',
@ -69,7 +69,7 @@ const STEPS = [
subtitle: 'Wallet settings',
text: `Your wallet settings are the first step for this wizard.
We'll start by setting up one of cryptocurrencies to get you up and running,
but you can later set up as many as you want.`
but you can later set up as many as you want.`,
},
{
id: 'locale',
@ -78,7 +78,7 @@ const STEPS = [
subtitle: 'Locales',
text: `From the Locales panel, you can define default settings
that will be applied to all machines you add to your network later on.
These settings may be overridden for specific machines in the Overrides section.`
These settings may be overridden for specific machines in the Overrides section.`,
},
{
id: 'twilio',
@ -93,7 +93,7 @@ const STEPS = [
You'll need to configure Twilio if you're offering cash-out or any
compliance options
</>
)
),
},
{
id: 'commissions',
@ -105,8 +105,8 @@ const STEPS = [
you'll later add to your network. Default settings keep you from
having to enter the same values everytime you add a new machine. Once
a machine is added, you may override these values per machine and per
cryptocurrency in the overrides section.`
}
cryptocurrency in the overrides section.`,
},
// {
// id: 'notifications',
// Component: Notifications,