mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 17:40:23 +03:00
Ensured the 'all' item is selected when custom date ranges are unselected
This commit is contained in:
parent
c71e0919e9
commit
4c1d285d04
1 changed files with 2 additions and 2 deletions
|
@ -29,7 +29,7 @@ export const DateRangeSelector = (
|
||||||
!rangeIsInterval(initialDateRange) ? initialDateRange : undefined,
|
!rangeIsInterval(initialDateRange) ? initialDateRange : undefined,
|
||||||
);
|
);
|
||||||
const updateDateRange = (dateRange: DateRange) => {
|
const updateDateRange = (dateRange: DateRange) => {
|
||||||
setActiveInterval(undefined);
|
setActiveInterval(dateRangeIsEmpty(dateRange) ? 'all' : undefined);
|
||||||
setActiveDateRange(dateRange);
|
setActiveDateRange(dateRange);
|
||||||
onDatesChange(dateRange);
|
onDatesChange(dateRange);
|
||||||
};
|
};
|
||||||
|
@ -43,7 +43,7 @@ export const DateRangeSelector = (
|
||||||
<DropdownBtn disabled={disabled} text={rangeOrIntervalToString(activeInterval ?? activeDateRange) ?? defaultText}>
|
<DropdownBtn disabled={disabled} text={rangeOrIntervalToString(activeInterval ?? activeDateRange) ?? defaultText}>
|
||||||
<DateIntervalDropdownItems
|
<DateIntervalDropdownItems
|
||||||
allText={defaultText}
|
allText={defaultText}
|
||||||
active={!dateRangeIsEmpty(activeDateRange) ? undefined : activeInterval}
|
active={activeInterval}
|
||||||
onChange={(interval) => updateInterval(interval)()}
|
onChange={(interval) => updateInterval(interval)()}
|
||||||
/>
|
/>
|
||||||
<DropdownItem divider />
|
<DropdownItem divider />
|
||||||
|
|
Loading…
Reference in a new issue