Skip to content

Commit

Permalink
Performer country navigation
Browse files Browse the repository at this point in the history
* Added navigation for specific country within performer details section
* Included additional gender filter to performer country navigation
  • Loading branch information
purpxd committed Dec 12, 2024
1 parent 0621d87 commit 0c837c6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React, { PropsWithChildren } from "react";
import { useIntl } from "react-intl";
import { Link } from "react-router-dom";
import { TagLink } from "src/components/Shared/TagLink";
import * as GQL from "src/core/generated-graphql";
import NavUtils from "src/utils/navigation";
import TextUtils from "src/utils/text";
import { DetailItem } from "src/components/Shared/DetailItem";
import { CountryFlag } from "src/components/Shared/CountryFlag";
Expand Down Expand Up @@ -99,11 +101,13 @@ export const PerformerDetailsPanel: React.FC<IPerformerDetails> =
<DetailItem
id="country"
value={
<CountryFlag
country={performer.country}
className="mr-2"
includeName={true}
/>
<Link to={NavUtils.makePerformersCountryUrl(performer)}>
<CountryFlag
country={performer.country}
className="mr-2"
includeName={true}
/>
</Link>
}
fullWidth={fullWidth}
/>
Expand Down
20 changes: 12 additions & 8 deletions ui/v2.5/src/utils/navigation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
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 { GenderCriterion } from "src/models/list-filter/criteria/gender";
import {
StudiosCriterion,
ParentStudiosCriterion,
Expand Down Expand Up @@ -135,14 +136,17 @@ const makePerformerSceneMarkersUrl = (
performer: Partial<GQL.PerformerDataFragment>
) => {
if (!performer.id) return "#";
const filter = new ListFilterModel(GQL.FilterMode.SceneMarkers, undefined);
const criterion = new PerformersCriterion();
criterion.value.items = [
{ id: performer.id, label: performer.name || `Performer ${performer.id}` },
];

filter.criteria.push(criterion);
return `/scenes/markers?${filter.makeQueryParameters()}`;
const filter = new ListFilterModel(GQL.FilterMode.Performers, undefined);
const countryCriterion = new CountryCriterion();
countryCriterion.value = `${performer.country}`;
filter.criteria.push(countryCriterion);

if (performer.gender) {
const genderCriterion = new GenderCriterion();
genderCriterion.value = [`${performer.gender}`];
filter.criteria.push(genderCriterion);
}
return `/performers?${filter.makeQueryParameters()}`;
};

const makePerformersCountryUrl = (
Expand Down

0 comments on commit 0c837c6

Please sign in to comment.