fix(dashboard): show hours when needed and remove bugs for filters

This commit is contained in:
Carl-Gerhard Lindesvärd
2025-03-23 21:46:03 +01:00
parent 584c787799
commit c03ee3f617
5 changed files with 40 additions and 16 deletions

View File

@@ -59,7 +59,7 @@ export function useEventQueryFilters(options: NuqsOptions = {}) {
| undefined
| null
| (string | number | boolean | undefined | null)[],
operator: IChartEventFilterOperator = 'is',
operator: IChartEventFilterOperator,
) => {
setFilters((prev) => {
const exists = prev.find((filter) => filter.name === name);
@@ -80,7 +80,10 @@ export function useEventQueryFilters(options: NuqsOptions = {}) {
if (filter.name === name) {
return {
...filter,
operator: newValue.length === 0 ? 'isNull' : operator,
operator:
!operator && newValue.length === 0
? 'isNull'
: (operator ?? 'is'),
value: newValue,
};
}
@@ -93,7 +96,10 @@ export function useEventQueryFilters(options: NuqsOptions = {}) {
{
id: name,
name,
operator: newValue.length === 0 ? 'isNull' : operator,
operator:
!operator && newValue.length === 0
? 'isNull'
: (operator ?? 'is'),
value: newValue,
},
];