Pull request: all: make stats disableable, imp code
Updates #2141. Squashed commit of the following: commit d8f3bcd9927b00a1d4b8b60b43144bc4b4469311 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Jun 17 19:10:53 2021 +0300 stats: imp docs, names commit 97eae3c2da5585467ca024bdacdbf922bcc8b444 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Jun 17 18:51:49 2021 +0300 all: make stats disableable, imp code
This commit is contained in:
@@ -8,22 +8,27 @@ import { renderRadioField, toNumber } from '../../../helpers/form';
|
||||
import { FORM_NAME, STATS_INTERVALS_DAYS } from '../../../helpers/constants';
|
||||
import '../FormButton.css';
|
||||
|
||||
const getIntervalFields = (processing, t, toNumber) => STATS_INTERVALS_DAYS.map((interval) => {
|
||||
const title = interval === 1 ? t('interval_24_hour') : t('interval_days', { count: interval });
|
||||
const getIntervalTitle = (interval, t) => {
|
||||
switch (interval) {
|
||||
case 0:
|
||||
return t('disabled');
|
||||
case 1:
|
||||
return t('interval_24_hour');
|
||||
default:
|
||||
return t('interval_days', { count: interval });
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Field
|
||||
key={interval}
|
||||
name="interval"
|
||||
type="radio"
|
||||
component={renderRadioField}
|
||||
value={interval}
|
||||
placeholder={title}
|
||||
normalize={toNumber}
|
||||
disabled={processing}
|
||||
/>
|
||||
);
|
||||
});
|
||||
const getIntervalFields = (processing, t, toNumber) => STATS_INTERVALS_DAYS.map((interval) => <Field
|
||||
key={interval}
|
||||
name="interval"
|
||||
type="radio"
|
||||
component={renderRadioField}
|
||||
value={interval}
|
||||
placeholder={getIntervalTitle(interval, t)}
|
||||
normalize={toNumber}
|
||||
disabled={processing}
|
||||
/>);
|
||||
|
||||
const Form = (props) => {
|
||||
const {
|
||||
|
||||
Reference in New Issue
Block a user