mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Add filter country when click the performer flag (#795)
This commit is contained in:
@@ -38,7 +38,9 @@ export const PerformerCard: React.FC<IPerformerCardProps> = ({
|
|||||||
<div className="card-section">
|
<div className="card-section">
|
||||||
<h5 className="text-truncate">{performer.name}</h5>
|
<h5 className="text-truncate">{performer.name}</h5>
|
||||||
{age !== 0 ? <div className="text-muted">{ageString}</div> : ""}
|
{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">
|
<div className="text-muted">
|
||||||
Stars in
|
Stars in
|
||||||
<FormattedNumber value={performer.scene_count ?? 0} />
|
<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 * as GQL from "src/core/generated-graphql";
|
||||||
import { PerformersCriterion } from "src/models/list-filter/criteria/performers";
|
import { PerformersCriterion } from "src/models/list-filter/criteria/performers";
|
||||||
|
import { CountryCriterion } from "src/models/list-filter/criteria/country";
|
||||||
import {
|
import {
|
||||||
StudiosCriterion,
|
StudiosCriterion,
|
||||||
ParentStudiosCriterion,
|
ParentStudiosCriterion,
|
||||||
@@ -22,6 +23,17 @@ const makePerformerScenesUrl = (
|
|||||||
return `/scenes?${filter.makeQueryParameters()}`;
|
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>) => {
|
const makeStudioScenesUrl = (studio: Partial<GQL.StudioDataFragment>) => {
|
||||||
if (!studio.id) return "#";
|
if (!studio.id) return "#";
|
||||||
const filter = new ListFilterModel(FilterMode.Scenes);
|
const filter = new ListFilterModel(FilterMode.Scenes);
|
||||||
@@ -82,6 +94,7 @@ const makeSceneMarkerUrl = (
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
makePerformerScenesUrl,
|
makePerformerScenesUrl,
|
||||||
|
makePerformersCountryUrl,
|
||||||
makeStudioScenesUrl,
|
makeStudioScenesUrl,
|
||||||
makeTagSceneMarkersUrl,
|
makeTagSceneMarkersUrl,
|
||||||
makeTagScenesUrl,
|
makeTagScenesUrl,
|
||||||
|
|||||||
Reference in New Issue
Block a user