mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 12:54:38 +03:00
Filter edit fixes (#3556)
* Fix country selector dropdown * Don't include search term in filter count * Use info colour for filter button count pill
This commit is contained in:
@@ -174,6 +174,7 @@ const GenericCriterionEditor: React.FC<IGenericCriterionEditor> = ({
|
|||||||
<CountrySelect
|
<CountrySelect
|
||||||
value={criterion.value}
|
value={criterion.value}
|
||||||
onChange={(v) => onValueChanged(v)}
|
onChange={(v) => onValueChanged(v)}
|
||||||
|
menuPortalTarget={document.body}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export const FilterButton: React.FC<IFilterButtonProps> = ({
|
|||||||
<Button variant="secondary" className="filter-button" onClick={onClick}>
|
<Button variant="secondary" className="filter-button" onClick={onClick}>
|
||||||
<Icon icon={faFilter} />
|
<Icon icon={faFilter} />
|
||||||
{count ? (
|
{count ? (
|
||||||
<Badge pill variant="danger">
|
<Badge pill variant="info">
|
||||||
{count}
|
{count}
|
||||||
</Badge>
|
</Badge>
|
||||||
) : undefined}
|
) : undefined}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ interface IProps {
|
|||||||
className?: string;
|
className?: string;
|
||||||
showFlag?: boolean;
|
showFlag?: boolean;
|
||||||
isClearable?: boolean;
|
isClearable?: boolean;
|
||||||
|
menuPortalTarget?: HTMLElement | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const CountrySelect: React.FC<IProps> = ({
|
export const CountrySelect: React.FC<IProps> = ({
|
||||||
@@ -20,6 +21,7 @@ export const CountrySelect: React.FC<IProps> = ({
|
|||||||
isClearable = true,
|
isClearable = true,
|
||||||
showFlag,
|
showFlag,
|
||||||
className,
|
className,
|
||||||
|
menuPortalTarget,
|
||||||
}) => {
|
}) => {
|
||||||
const { locale } = useIntl();
|
const { locale } = useIntl();
|
||||||
const options = getCountries(locale);
|
const options = getCountries(locale);
|
||||||
@@ -44,6 +46,7 @@ export const CountrySelect: React.FC<IProps> = ({
|
|||||||
IndicatorSeparator: null,
|
IndicatorSeparator: null,
|
||||||
}}
|
}}
|
||||||
className={`CountrySelect ${className}`}
|
className={`CountrySelect ${className}`}
|
||||||
|
menuPortalTarget={menuPortalTarget}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -77,12 +77,8 @@ export class ListFilterModel {
|
|||||||
|
|
||||||
// returns the number of filters applied
|
// returns the number of filters applied
|
||||||
public count() {
|
public count() {
|
||||||
const count = this.criteria.length;
|
// don't include search term
|
||||||
if (this.searchTerm) {
|
return this.criteria.length;
|
||||||
return count + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public configureFromDecodedParams(params: IDecodedParams) {
|
public configureFromDecodedParams(params: IDecodedParams) {
|
||||||
|
|||||||
Reference in New Issue
Block a user