umami/components/pages/settings/profile/DateRangeSetting.js

22 lines
755 B
JavaScript
Raw Normal View History

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';
import { Button, Flexbox } from 'react-basics';
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';
export default function DateRangeSetting() {
2023-01-25 16:42:46 +01:00
const { formatMessage } = useIntl();
const [dateRange, setDateRange] = useDateRange();
const { startDate, endDate, value } = dateRange;
const handleReset = () => setDateRange(DEFAULT_DATE_RANGE);
return (
<Flexbox width={400} gap={10}>
<DateFilter value={value} startDate={startDate} endDate={endDate} />
2023-01-25 16:42:46 +01:00
<Button onClick={handleReset}>{formatMessage(labels.reset)}</Button>
</Flexbox>
);
}