fix: translation key in revert published modal (#1628)
This commit is contained in:
@@ -6,15 +6,13 @@ import { Props } from './types';
|
||||
import ReactSelect from '../ReactSelect';
|
||||
import sortableFieldTypes from '../../../../fields/sortableFieldTypes';
|
||||
import { useSearchParams } from '../../utilities/SearchParams';
|
||||
import { fieldAffectsData } from '../../../../fields/config/types';
|
||||
import { fieldAffectsData, OptionObject } from '../../../../fields/config/types';
|
||||
import { getTranslation } from '../../../../utilities/getTranslation';
|
||||
|
||||
import './index.scss';
|
||||
|
||||
const baseClass = 'sort-complex';
|
||||
|
||||
const sortOptions = [{ label: 'Ascending', value: '' }, { label: 'Descending', value: '-' }];
|
||||
|
||||
const SortComplex: React.FC<Props> = (props) => {
|
||||
const {
|
||||
collection,
|
||||
@@ -25,6 +23,7 @@ const SortComplex: React.FC<Props> = (props) => {
|
||||
const history = useHistory();
|
||||
const params = useSearchParams();
|
||||
const { t, i18n } = useTranslation('general');
|
||||
const [sortOptions, setSortOptions] = useState<OptionObject[]>();
|
||||
|
||||
const [sortFields] = useState(() => collection.fields.reduce((fields, field) => {
|
||||
if (fieldAffectsData(field) && sortableFieldTypes.indexOf(field.type) > -1) {
|
||||
@@ -56,6 +55,10 @@ const SortComplex: React.FC<Props> = (props) => {
|
||||
}
|
||||
}, [history, params, sortField, sortOrder, modifySearchQuery, handleChange]);
|
||||
|
||||
useEffect(() => {
|
||||
setSortOptions([{ label: t('ascending'), value: '' }, { label: t('descending'), value: '-' }]);
|
||||
}, [i18n, t]);
|
||||
|
||||
return (
|
||||
<div className={baseClass}>
|
||||
<React.Fragment>
|
||||
|
||||
@@ -174,7 +174,7 @@ const Status: React.FC<Props> = () => {
|
||||
type="button"
|
||||
onClick={processing ? undefined : () => toggleModal(revertModalSlug)}
|
||||
>
|
||||
{t('general:published')}
|
||||
{t('general:cancel')}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={processing ? undefined : () => performAction('revert')}
|
||||
|
||||
@@ -134,6 +134,7 @@
|
||||
"addFilter": "Add Filter",
|
||||
"adminTheme": "Admin Theme",
|
||||
"and": "And",
|
||||
"ascending": "Ascending",
|
||||
"automatic": "Automatic",
|
||||
"backToDashboard": "Back to Dashboard",
|
||||
"cancel": "Cancel",
|
||||
|
||||
@@ -533,6 +533,9 @@
|
||||
"and": {
|
||||
"type": "string"
|
||||
},
|
||||
"ascending": {
|
||||
"type": "string"
|
||||
},
|
||||
"automatic": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -789,6 +792,7 @@
|
||||
"addFilter",
|
||||
"adminTheme",
|
||||
"and",
|
||||
"ascending",
|
||||
"automatic",
|
||||
"backToDashboard",
|
||||
"cancel",
|
||||
|
||||
Reference in New Issue
Block a user