2023-01-25 16:42:46 +01:00
|
|
|
import { useIntl } from 'react-intl';
|
2023-02-15 11:27:18 +01:00
|
|
|
import DateFilter from 'components/input/DateFilter';
|
2023-01-11 17:33:43 +01:00
|
|
|
import { Button, Flexbox } from 'react-basics';
|
2020-09-19 19:35:05 +02:00
|
|
|
import useDateRange from 'hooks/useDateRange';
|
|
|
|
import { DEFAULT_DATE_RANGE } from 'lib/constants';
|
2023-01-25 16:42:46 +01:00
|
|
|
import { labels } from 'components/messages';
|
2020-09-19 19:35:05 +02:00
|
|
|
|
|
|
|
export default function DateRangeSetting() {
|
2023-01-25 16:42:46 +01:00
|
|
|
const { formatMessage } = useIntl();
|
2020-09-19 19:35:05 +02:00
|
|
|
const [dateRange, setDateRange] = useDateRange();
|
|
|
|
const { startDate, endDate, value } = dateRange;
|
|
|
|
|
2023-01-11 17:33:43 +01:00
|
|
|
const handleReset = () => setDateRange(DEFAULT_DATE_RANGE);
|
2020-09-19 19:35:05 +02:00
|
|
|
|
|
|
|
return (
|
2023-01-11 17:33:43 +01:00
|
|
|
<Flexbox width={400} gap={10}>
|
2023-03-09 01:37:43 +01:00
|
|
|
<DateFilter value={value} startDate={startDate} endDate={endDate} />
|
2023-01-25 16:42:46 +01:00
|
|
|
<Button onClick={handleReset}>{formatMessage(labels.reset)}</Button>
|
2023-01-11 17:33:43 +01:00
|
|
|
</Flexbox>
|
2020-09-19 19:35:05 +02:00
|
|
|
);
|
|
|
|
}
|