Images section (#813)

* Add new configuration options
* Refactor scan/clean
* Schema changes
* Add details to galleries
* Remove redundant code
* Refine thumbnail generation
* Gallery overhaul
* Don't allow modifying zip gallery images
* Show gallery card overlays
* Hide zoom slider when not in grid mode
This commit is contained in:
WithoutPants
2020-10-13 10:12:46 +11:00
committed by GitHub
parent df3252e24f
commit aca2c7c5f4
147 changed files with 12483 additions and 946 deletions

View File

@@ -18,6 +18,8 @@ import {
MovieDataFragment,
FindTagsQueryResult,
TagDataFragment,
FindImagesQueryResult,
SlimImageDataFragment,
} from "src/core/generated-graphql";
import {
useInterfaceLocalForage,
@@ -29,6 +31,7 @@ import { Pagination, PaginationIndex } from "src/components/List/Pagination";
import {
useFindScenes,
useFindSceneMarkers,
useFindImages,
useFindMovies,
useFindStudios,
useFindGalleries,
@@ -62,7 +65,7 @@ interface IListHookData {
onSelectChange: (id: string, selected: boolean, shiftKey: boolean) => void;
}
interface IListHookOperation<T> {
export interface IListHookOperation<T> {
text: string;
onClick: (
result: T,
@@ -74,6 +77,7 @@ interface IListHookOperation<T> {
filter: ListFilterModel,
selectedIds: Set<string>
) => boolean;
postRefetch?: boolean;
}
interface IListHookOptions<T, E> {
@@ -280,12 +284,19 @@ const RenderList = <
setZoomIndex(newZoomIndex);
}
async function onOperationClicked(o: IListHookOperation<QueryResult>) {
await o.onClick(result, filter, selectedIds);
if (o.postRefetch) {
result.refetch();
}
}
const operations =
otherOperations &&
otherOperations.map((o) => ({
text: o.text,
onClick: () => {
o.onClick(result, filter, selectedIds);
onOperationClicked(o);
},
isDisplayed: () => {
if (o.isDisplayed) {
@@ -542,6 +553,19 @@ export const useSceneMarkersList = (
result?.data?.findSceneMarkers?.count ?? 0,
});
export const useImagesList = (
props: IListHookOptions<FindImagesQueryResult, SlimImageDataFragment>
) =>
useList<FindImagesQueryResult, SlimImageDataFragment>({
...props,
filterMode: FilterMode.Images,
useData: useFindImages,
getData: (result: FindImagesQueryResult) =>
result?.data?.findImages?.images ?? [],
getCount: (result: FindImagesQueryResult) =>
result?.data?.findImages?.count ?? 0,
});
export const useGalleriesList = (
props: IListHookOptions<FindGalleriesQueryResult, GalleryDataFragment>
) =>