fix: Language typos

This commit is contained in:
Ahmed Bouhuolia
2024-08-18 11:11:17 +02:00
parent 4477ada1ad
commit 93732430fc
8 changed files with 89 additions and 477 deletions

View File

@@ -27,7 +27,7 @@ export const accountNameAccessor = (account) => {
export const handleDeleteErrors = (errors) => {
if (errors.find((e) => e.type === 'ACCOUNT.PREDEFINED')) {
AppToaster.show({
message: intl.get('you_could_not_delete_predefined_accounts'),
message: intl.get('cannot_delete_predefined_accounts'),
intent: Intent.DANGER,
});
}

View File

@@ -1,73 +0,0 @@
// @ts-nocheck
import React, { useState } from 'react';
import { FormattedMessage as T } from '@/components';
import intl from 'react-intl-universal';
import { Intent, Alert } from '@blueprintjs/core';
import { size } from 'lodash';
import { AppToaster } from '@/components';
import withAlertStoreConnect from '@/containers/Alert/withAlertStoreConnect';
import withAlertActions from '@/containers/Alert/withAlertActions';
import { compose } from '@/utils';
/**
* Exchange rate bulk delete alert.
*/
function ExchangeRateBulkDeleteAlert({
name,
// #withAlertStoreConnect
isOpen,
payload: { exchangeRatesIds },
// #withAlertActions
closeAlert,
}) {
// handle cancel item bulk delete alert.
const handleCancelBulkDelete = () => {
closeAlert(name);
};
// handle confirm Exchange Rates bulk delete.
// const handleConfirmBulkDelete = () => {
// bulkDeleteExchangeRate(exchangeRatesIds)
// .then(() => {
// AppToaster.show({
// message: formatMessage({
// id: 'the_exchange_rates_has_been_successfully_deleted',
// }),
// intent: Intent.SUCCESS,
// });
// })
// .catch(({ errors }) => {
// handleDeleteErrors(errors);
// });
// };
return (
<Alert
cancelButtonText={<T id={'cancel'} />}
confirmButtonText={
<T id={'delete_count'} values={{ count: size(exchangeRatesIds) }} />
}
icon="trash"
intent={Intent.DANGER}
isOpen={isOpen}
onCancel={handleCancelBulkDelete}
// onConfirm={}
// loading={isLoading}
>
<p>
<T
id={'once_delete_these_exchange_rates_you_will_not_able_restore_them'}
/>
</p>
</Alert>
);
}
export default compose(
withAlertStoreConnect(),
withAlertActions,
)(ExchangeRateBulkDeleteAlert);

View File

@@ -1,72 +0,0 @@
// @ts-nocheck
import React from 'react';
import intl from 'react-intl-universal';
import {
AppToaster,
FormattedMessage as T,
FormattedHTMLMessage,
} from '@/components';
import { Intent, Alert } from '@blueprintjs/core';
import { useDeleteExchangeRate } from '@/hooks/query';
import withAlertStoreConnect from '@/containers/Alert/withAlertStoreConnect';
import withAlertActions from '@/containers/Alert/withAlertActions';
import { compose } from '@/utils';
/**
* exchange rate delete alerts.
*/
function ExchangeRateDeleteAlert({
name,
// #withAlertStoreConnect
isOpen,
payload: { exchangeRateId },
// #withAlertActions
closeAlert,
}) {
const { mutateAsync: deleteExchangeRate, isLoading } =
useDeleteExchangeRate();
// Handle cancel delete exchange rate alert.
const handleCancelExchangeRateDelete = () => closeAlert(name);
const handelConfirmExchangeRateDelete = () => {
deleteExchangeRate(exchangeRateId)
.then((response) => {
AppToaster.show({
message: intl.get('the_exchange_rates_has_been_deleted_successfully'),
intent: Intent.SUCCESS,
});
closeAlert(name);
})
.catch(() => {
closeAlert(name);
});
};
return (
<Alert
cancelButtonText={<T id={'cancel'} />}
confirmButtonText={<T id={'delete'} />}
intent={Intent.DANGER}
isOpen={isOpen}
onCancel={handleCancelExchangeRateDelete}
onConfirm={handelConfirmExchangeRateDelete}
loading={isLoading}
>
<p>
<FormattedHTMLMessage
id={'once_delete_this_exchange_rate_you_will_able_to_restore_it'}
/>
</p>
</Alert>
);
}
export default compose(
withAlertStoreConnect(),
withAlertActions,
)(ExchangeRateDeleteAlert);

View File

@@ -1,99 +0,0 @@
// @ts-nocheck
import React from 'react';
import intl from 'react-intl-universal';
import * as Yup from 'yup';
import { Formik } from 'formik';
import { Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom';
import '@/style/pages/Setup/PaymentViaVoucherDialog.scss';
import { usePaymentByVoucher } from '@/hooks/query';
import { AppToaster as Toaster, DialogContent } from '@/components';
import PaymentViaLicenseForm from './PaymentViaVoucherForm';
import withDialogActions from '@/containers/Dialog/withDialogActions';
import { compose } from '@/utils';
/**
* Payment via license dialog content.
*/
function PaymentViaLicenseDialogContent({
// #ownProps
subscriptionForm,
// #withDialog
closeDialog,
}) {
const history = useHistory();
// Payment via voucher
const { mutateAsync: paymentViaVoucherMutate } = usePaymentByVoucher();
// Handle submit.
const handleSubmit = (values, { setSubmitting, setErrors }) => {
setSubmitting(true);
const mutateValues = {
plan_slug: `essentials-monthly`,
license_code: values.license_code,
};
// Payment via voucher mutate.
paymentViaVoucherMutate({ ...mutateValues })
.then(() => {
Toaster.show({
message: intl.get('payment_via_voucher.success_message'),
intent: Intent.SUCCESS,
});
return closeDialog('payment-via-voucher');
})
.then(() => {
history.push('initializing');
})
.catch(
({
response: {
data: { errors },
},
}) => {
if (errors.find((e) => e.type === 'LICENSE.CODE.IS.INVALID')) {
setErrors({
license_code: 'payment_via_voucher.license_code_not_valid',
});
}
},
)
.finally((errors) => {
setSubmitting(false);
});
};
// Initial values.
const initialValues = {
license_code: '',
plan_slug: '',
period: '',
...subscriptionForm,
};
// Validation schema.
const validationSchema = Yup.object().shape({
license_code: Yup.string()
.required()
.min(10)
.max(10)
.label(intl.get('license_code')),
});
return (
<DialogContent>
<Formik
initialValues={initialValues}
validationSchema={validationSchema}
onSubmit={handleSubmit}
component={PaymentViaLicenseForm}
/>
</DialogContent>
);
}
export default compose(withDialogActions)(PaymentViaLicenseDialogContent);

View File

@@ -1,77 +0,0 @@
// @ts-nocheck
import React from 'react';
import { Button, FormGroup, InputGroup, Intent } from '@blueprintjs/core';
import { Form, FastField, ErrorMessage, useFormikContext } from 'formik';
import { FormattedMessage as T } from '@/components';
import { compose } from 'redux';
import { CLASSES } from '@/constants/classes';
import { inputIntent } from '@/utils';
import { useAutofocus } from '@/hooks';
import withDialogActions from '@/containers/Dialog/withDialogActions';
/**
* Payment via license form.
*/
function PaymentViaLicenseForm({
// #withDialogActions
closeDialog,
}) {
// Formik context.
const { isSubmitting } = useFormikContext();
const licenseNumberRef = useAutofocus();
// Handle close button click.
const handleCloseBtnClick = () => {
closeDialog('payment-via-voucher');
};
return (
<Form>
<div className={CLASSES.DIALOG_BODY}>
<p>
<T id={'payment_via_voucher.dialog.description'} />
</p>
<FastField name="license_code">
{({ field, meta: { error, touched } }) => (
<FormGroup
label={<T id={'voucher_number'} />}
intent={inputIntent({ error, touched })}
helperText={<ErrorMessage name="license_code" />}
className={'form-group--voucher_number'}
>
<InputGroup
large={true}
intent={inputIntent({ error, touched })}
{...field}
inputRef={(ref) => (licenseNumberRef.current = ref)}
/>
</FormGroup>
)}
</FastField>
</div>
<div className={CLASSES.DIALOG_FOOTER}>
<div className={CLASSES.DIALOG_FOOTER_ACTIONS}>
<Button onClick={handleCloseBtnClick} disabled={isSubmitting}>
<T id={'close'} />
</Button>
<Button
intent={Intent.PRIMARY}
disabled={false}
type="submit"
loading={isSubmitting}
>
<T id={'submit'} />
</Button>
</div>
</div>
</Form>
);
}
export default compose(withDialogActions)(PaymentViaLicenseForm);

View File

@@ -1,37 +0,0 @@
// @ts-nocheck
import React, { lazy } from 'react';
import { Dialog, DialogSuspense, FormattedMessage as T } from '@/components';
import withDialogRedux from '@/components/DialogReduxConnect';
import { compose } from '@/utils';
// Lazy loading the content.
const PaymentViaLicenseDialogContent = lazy(
() => import('./PaymentViaVoucherDialogContent'),
);
/**
* Payment via license dialog.
*/
function PaymentViaLicenseDialog({ dialogName, payload, isOpen }) {
return (
<Dialog
name={dialogName}
title={<T id={'payment_via_voucher'} />}
className={'dialog--payment-via-voucher'}
autoFocus={true}
canEscapeKeyClose={true}
isOpen={isOpen}
>
<DialogSuspense>
<PaymentViaLicenseDialogContent
dialogName={dialogName}
subscriptionForm={payload}
/>
</DialogSuspense>
</Dialog>
);
}
export default compose(withDialogRedux())(PaymentViaLicenseDialog);