mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-22 20:07:42 +02:00
feat(playlists): add isMissing and isPresent operators to Navidrome smart playlist form (#2149)
This commit is contained in:
@@ -314,6 +314,8 @@
|
||||
"inTheRangeDate": "Is in the range (date)",
|
||||
"is": "Is",
|
||||
"isNot": "Is not",
|
||||
"isMissing": "Is missing",
|
||||
"isPresent": "Is present",
|
||||
"isGreaterThan": "Is greater than",
|
||||
"isLessThan": "Is less than",
|
||||
"matchesRegex": "Matches regex",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
|
||||
import { Filters } from '/@/renderer/components/query-builder';
|
||||
import { ActionIcon } from '/@/shared/components/action-icon/action-icon';
|
||||
@@ -102,9 +102,8 @@ const QueryValueInput = ({
|
||||
const isDatePickerOperator =
|
||||
operator === 'beforeDate' || operator === 'afterDate' || operator === 'inTheRangeDate';
|
||||
|
||||
switch (type) {
|
||||
case 'boolean':
|
||||
return (
|
||||
const BooleanSelectComponent = useMemo(
|
||||
() => (
|
||||
<Select
|
||||
data={[
|
||||
{ label: 'true', value: 'true' },
|
||||
@@ -114,7 +113,17 @@ const QueryValueInput = ({
|
||||
value={value}
|
||||
{...props}
|
||||
/>
|
||||
),
|
||||
[onChange, props, value],
|
||||
);
|
||||
|
||||
if (operator === 'isMissing' || operator === 'isPresent') {
|
||||
return BooleanSelectComponent;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case 'boolean':
|
||||
return BooleanSelectComponent;
|
||||
case 'date':
|
||||
if (isDatePickerOperator && operator !== 'inTheRangeDate') {
|
||||
const dateValue = value ? parseDateValue(value) : null;
|
||||
|
||||
@@ -216,6 +216,17 @@ export const NDSongQueryPlaylistOperators = [
|
||||
},
|
||||
];
|
||||
|
||||
const NDPresenceOperators = [
|
||||
{
|
||||
label: i18n.t('filterOperator.isMissing'),
|
||||
value: 'isMissing',
|
||||
},
|
||||
{
|
||||
label: i18n.t('filterOperator.isPresent'),
|
||||
value: 'isPresent',
|
||||
},
|
||||
];
|
||||
|
||||
export const NDSongQueryDateOperators = [
|
||||
{
|
||||
label: i18n.t('filterOperator.is'),
|
||||
@@ -225,6 +236,7 @@ export const NDSongQueryDateOperators = [
|
||||
label: i18n.t('filterOperator.isNot'),
|
||||
value: 'isNot',
|
||||
},
|
||||
...NDPresenceOperators,
|
||||
{
|
||||
label: i18n.t('filterOperator.before'),
|
||||
value: 'before',
|
||||
@@ -268,6 +280,7 @@ export const NDSongQueryStringOperators = [
|
||||
label: i18n.t('filterOperator.isNot'),
|
||||
value: 'isNot',
|
||||
},
|
||||
...NDPresenceOperators,
|
||||
{
|
||||
label: i18n.t('filterOperator.contains'),
|
||||
value: 'contains',
|
||||
@@ -295,6 +308,7 @@ export const NDSongQueryBooleanOperators = [
|
||||
label: i18n.t('filterOperator.isNot'),
|
||||
value: 'isNot',
|
||||
},
|
||||
...NDPresenceOperators,
|
||||
];
|
||||
|
||||
export const NDSongQueryNumberOperators = [
|
||||
@@ -306,6 +320,7 @@ export const NDSongQueryNumberOperators = [
|
||||
label: i18n.t('filterOperator.isNot'),
|
||||
value: 'isNot',
|
||||
},
|
||||
...NDPresenceOperators,
|
||||
{
|
||||
label: i18n.t('filterOperator.contains'),
|
||||
value: 'contains',
|
||||
|
||||
Reference in New Issue
Block a user