mirror of
https://github.com/stashapp/stash.git
synced 2025-12-15 12:52:38 +01:00
Add filter country when click the performer flag (#795)
This commit is contained in:
parent
b541322d0a
commit
981b2622a5
3 changed files with 32 additions and 1 deletions
|
|
@ -38,7 +38,9 @@ export const PerformerCard: React.FC<IPerformerCardProps> = ({
|
|||
<div className="card-section">
|
||||
<h5 className="text-truncate">{performer.name}</h5>
|
||||
{age !== 0 ? <div className="text-muted">{ageString}</div> : ""}
|
||||
<CountryFlag country={performer.country} />
|
||||
<Link to={NavUtils.makePerformersCountryUrl(performer)}>
|
||||
<CountryFlag country={performer.country} />
|
||||
</Link>
|
||||
<div className="text-muted">
|
||||
Stars in
|
||||
<FormattedNumber value={performer.scene_count ?? 0} />
|
||||
|
|
|
|||
16
ui/v2.5/src/models/list-filter/criteria/country.ts
Normal file
16
ui/v2.5/src/models/list-filter/criteria/country.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { CriterionModifier } from "src/core/generated-graphql";
|
||||
import { Criterion, CriterionType, ICriterionOption } from "./criterion";
|
||||
|
||||
export class CountryCriterion extends Criterion {
|
||||
public type: CriterionType = "country";
|
||||
public parameterName: string = "performers";
|
||||
public modifier = CriterionModifier.Equals;
|
||||
public modifierOptions = [];
|
||||
public options: string[] = [true.toString(), false.toString()];
|
||||
public value: string = "";
|
||||
}
|
||||
|
||||
export class CountryCriterionOption implements ICriterionOption {
|
||||
public label: string = Criterion.getLabel("performers");
|
||||
public value: CriterionType = "country";
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
import * as GQL from "src/core/generated-graphql";
|
||||
import { PerformersCriterion } from "src/models/list-filter/criteria/performers";
|
||||
import { CountryCriterion } from "src/models/list-filter/criteria/country";
|
||||
import {
|
||||
StudiosCriterion,
|
||||
ParentStudiosCriterion,
|
||||
|
|
@ -22,6 +23,17 @@ const makePerformerScenesUrl = (
|
|||
return `/scenes?${filter.makeQueryParameters()}`;
|
||||
};
|
||||
|
||||
const makePerformersCountryUrl = (
|
||||
performer: Partial<GQL.PerformerDataFragment>
|
||||
) => {
|
||||
if (!performer.id) return "#";
|
||||
const filter = new ListFilterModel(FilterMode.Performers);
|
||||
const criterion = new CountryCriterion();
|
||||
criterion.value = `${performer.country}`;
|
||||
filter.criteria.push(criterion);
|
||||
return `/performers?${filter.makeQueryParameters()}`;
|
||||
};
|
||||
|
||||
const makeStudioScenesUrl = (studio: Partial<GQL.StudioDataFragment>) => {
|
||||
if (!studio.id) return "#";
|
||||
const filter = new ListFilterModel(FilterMode.Scenes);
|
||||
|
|
@ -82,6 +94,7 @@ const makeSceneMarkerUrl = (
|
|||
|
||||
export default {
|
||||
makePerformerScenesUrl,
|
||||
makePerformersCountryUrl,
|
||||
makeStudioScenesUrl,
|
||||
makeTagSceneMarkersUrl,
|
||||
makeTagScenesUrl,
|
||||
|
|
|
|||
Loading…
Reference in a new issue