Skip to content

Commit

Permalink
Fix cyclic import
Browse files Browse the repository at this point in the history
  • Loading branch information
DingDongSoLong4 committed Sep 8, 2023
1 parent 7546b7e commit a34458c
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 33 deletions.
2 changes: 1 addition & 1 deletion ui/v2.5/src/components/List/EditFilterDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion ui/v2.5/src/components/List/ItemList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
31 changes: 31 additions & 0 deletions ui/v2.5/src/models/list-filter/factory.ts
Original file line number Diff line number Diff line change
@@ -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;
}
}
30 changes: 0 additions & 30 deletions ui/v2.5/src/models/list-filter/filter-options.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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;
}
}
2 changes: 1 addition & 1 deletion ui/v2.5/src/models/list-filter/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a34458c

Please sign in to comment.