diff --git a/ui/v2.5/src/components/Movies/MovieCardGrid.tsx b/ui/v2.5/src/components/Movies/MovieCardGrid.tsx new file mode 100644 index 00000000000..f2ce19f6559 --- /dev/null +++ b/ui/v2.5/src/components/Movies/MovieCardGrid.tsx @@ -0,0 +1,31 @@ +import React from "react"; +import * as GQL from "src/core/generated-graphql"; +import { MovieCard } from "./MovieCard"; + +interface IMovieCardGrid { + movies: GQL.MovieDataFragment[]; + selectedIds: Set; + onSelectChange: (id: string, selected: boolean, shiftKey: boolean) => void; +} + +export const MovieCardGrid: React.FC = ({ + movies, + selectedIds, + onSelectChange, +}) => { + return ( +
+ {movies.map((movie) => ( + 0} + selected={selectedIds.has(movie.id)} + onSelectedChanged={(selected: boolean, shiftKey: boolean) => + onSelectChange(movie.id, selected, shiftKey) + } + /> + ))} +
+ ); +}; diff --git a/ui/v2.5/src/components/Movies/MovieList.tsx b/ui/v2.5/src/components/Movies/MovieList.tsx index c5b6c8dedf6..16a282827b8 100644 --- a/ui/v2.5/src/components/Movies/MovieList.tsx +++ b/ui/v2.5/src/components/Movies/MovieList.tsx @@ -18,8 +18,8 @@ import { } from "../List/ItemList"; import { ExportDialog } from "../Shared/ExportDialog"; import { DeleteEntityDialog } from "../Shared/DeleteEntityDialog"; -import { MovieCard } from "./MovieCard"; import { EditMoviesDialog } from "./EditMoviesDialog"; +import { MovieCardGrid } from "./MovieCardGrid"; const MovieItemList = makeItemList({ filterMode: GQL.FilterMode.Movies, @@ -130,19 +130,11 @@ export const MovieList: React.FC = ({ filterHook, alterQuery }) => { if (filter.displayMode === DisplayMode.Grid) { return ( -
- {result.data.findMovies.movies.map((p) => ( - 0} - selected={selectedIds.has(p.id)} - onSelectedChanged={(selected: boolean, shiftKey: boolean) => - onSelectChange(p.id, selected, shiftKey) - } - /> - ))} -
+ ); } if (filter.displayMode === DisplayMode.List) { diff --git a/ui/v2.5/src/components/Performers/PerformerCardGrid.tsx b/ui/v2.5/src/components/Performers/PerformerCardGrid.tsx new file mode 100644 index 00000000000..2296486bb6f --- /dev/null +++ b/ui/v2.5/src/components/Performers/PerformerCardGrid.tsx @@ -0,0 +1,35 @@ +import React from "react"; +import * as GQL from "src/core/generated-graphql"; +import { IPerformerCardExtraCriteria, PerformerCard } from "./PerformerCard"; + +interface IPerformerCardGrid { + performers: GQL.PerformerDataFragment[]; + selectedIds: Set; + zoomIndex: number; + onSelectChange: (id: string, selected: boolean, shiftKey: boolean) => void; + extraCriteria?: IPerformerCardExtraCriteria; +} + +export const PerformerCardGrid: React.FC = ({ + performers, + selectedIds, + onSelectChange, + extraCriteria, +}) => { + return ( +
+ {performers.map((performer) => ( + 0} + selected={selectedIds.has(performer.id)} + onSelectedChanged={(selected: boolean, shiftKey: boolean) => + onSelectChange(performer.id, selected, shiftKey) + } + extraCriteria={extraCriteria} + /> + ))} +
+ ); +}; diff --git a/ui/v2.5/src/components/Performers/PerformerList.tsx b/ui/v2.5/src/components/Performers/PerformerList.tsx index a293ec4fbf8..257079bce9b 100644 --- a/ui/v2.5/src/components/Performers/PerformerList.tsx +++ b/ui/v2.5/src/components/Performers/PerformerList.tsx @@ -19,11 +19,12 @@ import { DisplayMode } from "src/models/list-filter/types"; import { PerformerTagger } from "../Tagger/performers/PerformerTagger"; import { ExportDialog } from "../Shared/ExportDialog"; import { DeleteEntityDialog } from "../Shared/DeleteEntityDialog"; -import { IPerformerCardExtraCriteria, PerformerCard } from "./PerformerCard"; +import { IPerformerCardExtraCriteria } from "./PerformerCard"; import { PerformerListTable } from "./PerformerListTable"; import { EditPerformersDialog } from "./EditPerformersDialog"; import { cmToImperial, cmToInches, kgToLbs } from "src/utils/units"; import TextUtils from "src/utils/text"; +import { PerformerCardGrid } from "./PerformerCardGrid"; const PerformerItemList = makeItemList({ filterMode: GQL.FilterMode.Performers, @@ -263,20 +264,13 @@ export const PerformerList: React.FC = ({ if (filter.displayMode === DisplayMode.Grid) { return ( -
- {result.data.findPerformers.performers.map((p) => ( - 0} - selected={selectedIds.has(p.id)} - onSelectedChanged={(selected: boolean, shiftKey: boolean) => - onSelectChange(p.id, selected, shiftKey) - } - extraCriteria={extraCriteria} - /> - ))} -
+ ); } if (filter.displayMode === DisplayMode.List) { diff --git a/ui/v2.5/src/components/Studios/StudioCardGrid.tsx b/ui/v2.5/src/components/Studios/StudioCardGrid.tsx new file mode 100644 index 00000000000..612065e11b0 --- /dev/null +++ b/ui/v2.5/src/components/Studios/StudioCardGrid.tsx @@ -0,0 +1,34 @@ +import React from "react"; +import * as GQL from "src/core/generated-graphql"; +import { StudioCard } from "./StudioCard"; + +interface IStudioCardGrid { + studios: GQL.StudioDataFragment[]; + fromParent: boolean | undefined; + selectedIds: Set; + onSelectChange: (id: string, selected: boolean, shiftKey: boolean) => void; +} + +export const StudioCardGrid: React.FC = ({ + studios, + fromParent, + selectedIds, + onSelectChange, +}) => { + return ( +
+ {studios.map((studio) => ( + 0} + selected={selectedIds.has(studio.id)} + onSelectedChanged={(selected: boolean, shiftKey: boolean) => + onSelectChange(studio.id, selected, shiftKey) + } + /> + ))} +
+ ); +}; diff --git a/ui/v2.5/src/components/Studios/StudioList.tsx b/ui/v2.5/src/components/Studios/StudioList.tsx index 19710724b86..4e75c6405ed 100644 --- a/ui/v2.5/src/components/Studios/StudioList.tsx +++ b/ui/v2.5/src/components/Studios/StudioList.tsx @@ -18,8 +18,8 @@ import { ListFilterModel } from "src/models/list-filter/filter"; import { DisplayMode } from "src/models/list-filter/types"; import { ExportDialog } from "../Shared/ExportDialog"; import { DeleteEntityDialog } from "../Shared/DeleteEntityDialog"; -import { StudioCard } from "./StudioCard"; import { StudioTagger } from "../Tagger/studios/StudioTagger"; +import { StudioCardGrid } from "./StudioCardGrid"; const StudioItemList = makeItemList({ filterMode: GQL.FilterMode.Studios, @@ -135,20 +135,12 @@ export const StudioList: React.FC = ({ if (filter.displayMode === DisplayMode.Grid) { return ( -
- {result.data.findStudios.studios.map((studio) => ( - 0} - selected={selectedIds.has(studio.id)} - onSelectedChanged={(selected: boolean, shiftKey: boolean) => - onSelectChange(studio.id, selected, shiftKey) - } - /> - ))} -
+ ); } if (filter.displayMode === DisplayMode.List) { diff --git a/ui/v2.5/src/components/Tags/TagCardGrid.tsx b/ui/v2.5/src/components/Tags/TagCardGrid.tsx new file mode 100644 index 00000000000..b65f7f11eee --- /dev/null +++ b/ui/v2.5/src/components/Tags/TagCardGrid.tsx @@ -0,0 +1,34 @@ +import React from "react"; +import * as GQL from "src/core/generated-graphql"; +import { TagCard } from "./TagCard"; + +interface ITagCardGrid { + tags: GQL.TagDataFragment[]; + selectedIds: Set; + zoomIndex: number; + onSelectChange: (id: string, selected: boolean, shiftKey: boolean) => void; +} + +export const TagCardGrid: React.FC = ({ + tags, + selectedIds, + zoomIndex, + onSelectChange, +}) => { + return ( +
+ {tags.map((tag) => ( + 0} + selected={selectedIds.has(tag.id)} + onSelectedChanged={(selected: boolean, shiftKey: boolean) => + onSelectChange(tag.id, selected, shiftKey) + } + /> + ))} +
+ ); +}; diff --git a/ui/v2.5/src/components/Tags/TagList.tsx b/ui/v2.5/src/components/Tags/TagList.tsx index 869282418c0..ea580c2c948 100644 --- a/ui/v2.5/src/components/Tags/TagList.tsx +++ b/ui/v2.5/src/components/Tags/TagList.tsx @@ -24,10 +24,10 @@ import NavUtils from "src/utils/navigation"; import { Icon } from "../Shared/Icon"; import { ModalComponent } from "../Shared/Modal"; import { DeleteEntityDialog } from "../Shared/DeleteEntityDialog"; -import { TagCard } from "./TagCard"; import { ExportDialog } from "../Shared/ExportDialog"; import { tagRelationHook } from "../../core/tags"; import { faTrashAlt } from "@fortawesome/free-solid-svg-icons"; +import { TagCardGrid } from "./TagCardGrid"; interface ITagList { filterHook?: (filter: ListFilterModel) => ListFilterModel; @@ -188,20 +188,12 @@ export const TagList: React.FC = ({ filterHook, alterQuery }) => { if (filter.displayMode === DisplayMode.Grid) { return ( -
- {result.data.findTags.tags.map((tag) => ( - 0} - selected={selectedIds.has(tag.id)} - onSelectedChanged={(selected: boolean, shiftKey: boolean) => - onSelectChange(tag.id, selected, shiftKey) - } - /> - ))} -
+ ); } if (filter.displayMode === DisplayMode.List) {