From a34458c03c250019de2be514e14cfaa6afa4dac4 Mon Sep 17 00:00:00 2001 From: DingDongSoLong4 <99329275+DingDongSoLong4@users.noreply.github.com> Date: Fri, 8 Sep 2023 13:21:21 +0200 Subject: [PATCH] Fix cyclic import --- .../src/components/List/EditFilterDialog.tsx | 2 +- ui/v2.5/src/components/List/ItemList.tsx | 2 +- ui/v2.5/src/models/list-filter/factory.ts | 31 +++++++++++++++++++ .../src/models/list-filter/filter-options.ts | 30 ------------------ ui/v2.5/src/models/list-filter/filter.ts | 2 +- 5 files changed, 34 insertions(+), 33 deletions(-) create mode 100644 ui/v2.5/src/models/list-filter/factory.ts diff --git a/ui/v2.5/src/components/List/EditFilterDialog.tsx b/ui/v2.5/src/components/List/EditFilterDialog.tsx index 0818a0e550c..67dcf4e0592 100644 --- a/ui/v2.5/src/components/List/EditFilterDialog.tsx +++ b/ui/v2.5/src/components/List/EditFilterDialog.tsx @@ -17,7 +17,7 @@ import { import { FormattedMessage, useIntl } from "react-intl"; import { ConfigurationContext } from "src/hooks/Config"; import { ListFilterModel } from "src/models/list-filter/filter"; -import { getFilterOptions } from "src/models/list-filter/filter-options"; +import { getFilterOptions } from "src/models/list-filter/factory"; import { FilterTags } from "./FilterTags"; import { CriterionEditor } from "./CriterionEditor"; import { Icon } from "../Shared/Icon"; diff --git a/ui/v2.5/src/components/List/ItemList.tsx b/ui/v2.5/src/components/List/ItemList.tsx index 83f94dee961..52c41803ce5 100644 --- a/ui/v2.5/src/components/List/ItemList.tsx +++ b/ui/v2.5/src/components/List/ItemList.tsx @@ -18,7 +18,7 @@ import { CriterionValue, } from "src/models/list-filter/criteria/criterion"; import { ListFilterModel } from "src/models/list-filter/filter"; -import { getFilterOptions } from "src/models/list-filter/filter-options"; +import { getFilterOptions } from "src/models/list-filter/factory"; import { IconDefinition } from "@fortawesome/fontawesome-svg-core"; import { useInterfaceLocalForage } from "src/hooks/LocalForage"; import { useHistory, useLocation } from "react-router-dom"; diff --git a/ui/v2.5/src/models/list-filter/factory.ts b/ui/v2.5/src/models/list-filter/factory.ts new file mode 100644 index 00000000000..36b9d66dbc7 --- /dev/null +++ b/ui/v2.5/src/models/list-filter/factory.ts @@ -0,0 +1,31 @@ +import { FilterMode } from "src/core/generated-graphql"; +import { ListFilterOptions } from "./filter-options"; +import { GalleryListFilterOptions } from "./galleries"; +import { ImageListFilterOptions } from "./images"; +import { MovieListFilterOptions } from "./movies"; +import { PerformerListFilterOptions } from "./performers"; +import { SceneMarkerListFilterOptions } from "./scene-markers"; +import { SceneListFilterOptions } from "./scenes"; +import { StudioListFilterOptions } from "./studios"; +import { TagListFilterOptions } from "./tags"; + +export function getFilterOptions(mode: FilterMode): ListFilterOptions { + switch (mode) { + case FilterMode.Scenes: + return SceneListFilterOptions; + case FilterMode.Performers: + return PerformerListFilterOptions; + case FilterMode.Studios: + return StudioListFilterOptions; + case FilterMode.Galleries: + return GalleryListFilterOptions; + case FilterMode.SceneMarkers: + return SceneMarkerListFilterOptions; + case FilterMode.Movies: + return MovieListFilterOptions; + case FilterMode.Tags: + return TagListFilterOptions; + case FilterMode.Images: + return ImageListFilterOptions; + } +} diff --git a/ui/v2.5/src/models/list-filter/filter-options.ts b/ui/v2.5/src/models/list-filter/filter-options.ts index 1c3e4e88b6f..02a0d108be2 100644 --- a/ui/v2.5/src/models/list-filter/filter-options.ts +++ b/ui/v2.5/src/models/list-filter/filter-options.ts @@ -1,13 +1,4 @@ -import { FilterMode } from "src/core/generated-graphql"; import { CriterionOption } from "./criteria/criterion"; -import { GalleryListFilterOptions } from "./galleries"; -import { ImageListFilterOptions } from "./images"; -import { MovieListFilterOptions } from "./movies"; -import { PerformerListFilterOptions } from "./performers"; -import { SceneMarkerListFilterOptions } from "./scene-markers"; -import { SceneListFilterOptions } from "./scenes"; -import { StudioListFilterOptions } from "./studios"; -import { TagListFilterOptions } from "./tags"; import { DisplayMode } from "./types"; interface ISortByOption { @@ -54,24 +45,3 @@ export class ListFilterOptions { this.criterionOptions = criterionOptions; } } - -export function getFilterOptions(mode: FilterMode): ListFilterOptions { - switch (mode) { - case FilterMode.Scenes: - return SceneListFilterOptions; - case FilterMode.Performers: - return PerformerListFilterOptions; - case FilterMode.Studios: - return StudioListFilterOptions; - case FilterMode.Galleries: - return GalleryListFilterOptions; - case FilterMode.SceneMarkers: - return SceneMarkerListFilterOptions; - case FilterMode.Movies: - return MovieListFilterOptions; - case FilterMode.Tags: - return TagListFilterOptions; - case FilterMode.Images: - return ImageListFilterOptions; - } -} diff --git a/ui/v2.5/src/models/list-filter/filter.ts b/ui/v2.5/src/models/list-filter/filter.ts index 55a207c8444..f06ccdda20c 100644 --- a/ui/v2.5/src/models/list-filter/filter.ts +++ b/ui/v2.5/src/models/list-filter/filter.ts @@ -6,7 +6,7 @@ import { SortDirectionEnum, } from "src/core/generated-graphql"; import { Criterion, CriterionValue } from "./criteria/criterion"; -import { getFilterOptions } from "./filter-options"; +import { getFilterOptions } from "./factory"; import { CriterionType, DisplayMode } from "./types"; interface IDecodedParams {