mirror of
https://github.com/stashapp/stash.git
synced 2026-04-19 21:41:42 +02:00
Small UI filter fixes (#1456)
* Fix interactive filter name/value * place `none` filter criterion first and disable it * display current criterion when editing filter
This commit is contained in:
parent
b5a26cec8b
commit
eec071f248
2 changed files with 25 additions and 4 deletions
|
|
@ -227,6 +227,22 @@ export const AddFilter: React.FC<IAddFilterProps> = (
|
|||
);
|
||||
};
|
||||
|
||||
function maybeRenderFilterCriterion() {
|
||||
if (!props.editingCriterion) {
|
||||
return;
|
||||
}
|
||||
|
||||
return (
|
||||
<Form.Group>
|
||||
<strong>
|
||||
{intl.formatMessage({
|
||||
id: props.editingCriterion.criterionOption.messageID,
|
||||
})}
|
||||
</strong>
|
||||
</Form.Group>
|
||||
);
|
||||
}
|
||||
|
||||
function maybeRenderFilterSelect() {
|
||||
if (props.editingCriterion) {
|
||||
return;
|
||||
|
|
@ -239,7 +255,11 @@ export const AddFilter: React.FC<IAddFilterProps> = (
|
|||
text: intl.formatMessage({ id: c.messageID }),
|
||||
};
|
||||
})
|
||||
.sort((a, b) => a.text.localeCompare(b.text));
|
||||
.sort((a, b) => {
|
||||
if (a.value === "none") return -1;
|
||||
if (b.value === "none") return 1;
|
||||
return a.text.localeCompare(b.text);
|
||||
});
|
||||
|
||||
return (
|
||||
<Form.Group controlId="filter">
|
||||
|
|
@ -251,7 +271,7 @@ export const AddFilter: React.FC<IAddFilterProps> = (
|
|||
className="btn-secondary"
|
||||
>
|
||||
{options.map((c) => (
|
||||
<option key={c.value} value={c.value}>
|
||||
<option key={c.value} value={c.value} disabled={c.value === "none"}>
|
||||
{c.text}
|
||||
</option>
|
||||
))}
|
||||
|
|
@ -277,6 +297,7 @@ export const AddFilter: React.FC<IAddFilterProps> = (
|
|||
<Modal.Body>
|
||||
<div className="dialog-content">
|
||||
{maybeRenderFilterSelect()}
|
||||
{maybeRenderFilterCriterion()}
|
||||
{maybeRenderFilterPopoverContents()}
|
||||
</div>
|
||||
</Modal.Body>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { BooleanCriterion, CriterionOption } from "./criterion";
|
||||
|
||||
export const InteractiveCriterionOption = new CriterionOption(
|
||||
"organized",
|
||||
"organized"
|
||||
"interactive",
|
||||
"interactive"
|
||||
);
|
||||
|
||||
export class InteractiveCriterion extends BooleanCriterion {
|
||||
|
|
|
|||
Loading…
Reference in a new issue