mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 16:34:02 +01:00
Show correct image in lightbox (#5659)
This commit is contained in:
parent
638398808b
commit
50a900e83c
4 changed files with 13 additions and 13 deletions
|
|
@ -182,7 +182,7 @@ const ImageListImages: React.FC<IImageListImages> = ({
|
|||
const handleImageOpen = useCallback(
|
||||
(index) => {
|
||||
setSlideshowRunning(true);
|
||||
showLightbox(index, true);
|
||||
showLightbox({ initialIndex: index, slideshowEnabled: true });
|
||||
},
|
||||
[showLightbox, setSlideshowRunning]
|
||||
);
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ export const Tagger: React.FC<ITaggerProps> = ({ scenes, queue }) => {
|
|||
});
|
||||
function showLightboxImage(imagePath: string) {
|
||||
setSpriteImage(imagePath);
|
||||
showLightbox();
|
||||
showLightbox({ images: lightboxImage });
|
||||
}
|
||||
|
||||
const filteredScenes = useMemo(
|
||||
|
|
|
|||
|
|
@ -6,16 +6,17 @@ import { Button } from "react-bootstrap";
|
|||
export const LightboxLink: React.FC<
|
||||
PropsWithChildren<{ images?: ILightboxImage[] | undefined; index?: number }>
|
||||
> = ({ images, index, children }) => {
|
||||
const showLightbox = useLightbox({
|
||||
images,
|
||||
});
|
||||
const showLightbox = useLightbox();
|
||||
|
||||
if (!images || images.length === 0) {
|
||||
return <>{children}</>;
|
||||
}
|
||||
|
||||
return (
|
||||
<Button variant="link" onClick={() => showLightbox(index)}>
|
||||
<Button
|
||||
variant="link"
|
||||
onClick={() => showLightbox({ images, initialIndex: index })}
|
||||
>
|
||||
{children}
|
||||
</Button>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { IState, useLightboxContext } from "./context";
|
|||
import { IChapter } from "./types";
|
||||
|
||||
export const useLightbox = (
|
||||
state: Partial<Omit<IState, "isVisible">>,
|
||||
state: Partial<Omit<IState, "isVisible">> = {},
|
||||
chapters: IChapter[] = []
|
||||
) => {
|
||||
const { setLightboxState } = useLightboxContext();
|
||||
|
|
@ -33,14 +33,13 @@ export const useLightbox = (
|
|||
]);
|
||||
|
||||
const show = useCallback(
|
||||
(index?: number, slideshowEnabled = false) => {
|
||||
(props: Partial<IState>) => {
|
||||
setLightboxState({
|
||||
initialIndex: index,
|
||||
...props,
|
||||
isVisible: true,
|
||||
slideshowEnabled,
|
||||
page: state.page,
|
||||
pages: state.pages,
|
||||
pageSize: state.pageSize,
|
||||
page: props.page ?? state.page,
|
||||
pages: props.pages ?? state.pages,
|
||||
pageSize: props.pageSize ?? state.pageSize,
|
||||
chapters: chapters,
|
||||
});
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue