Skip to content

Commit 587fd9e

Browse files
authoredFeb 24, 2025··
Fix image title not appearing in lightbox (#5675)
1 parent e97f647 commit 587fd9e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed
 

‎ui/v2.5/src/hooks/Lightbox/Lightbox.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import {
4848
import { RatingSystem } from "src/components/Shared/Rating/RatingSystem";
4949
import { useDebounce } from "../debounce";
5050
import { isVideo } from "src/utils/visualFile";
51+
import { imageTitle } from "src/core/files";
5152

5253
const CLASSNAME = "Lightbox";
5354
const CLASSNAME_HEADER = `${CLASSNAME}-header`;
@@ -689,6 +690,7 @@ export const LightboxComponent: React.FC<IProps> = ({
689690
}
690691

691692
const currentImage: ILightboxImage | undefined = images[currentIndex];
693+
const title = currentImage ? imageTitle(currentImage) : undefined;
692694

693695
function setRating(v: number | null) {
694696
if (currentImage?.id) {
@@ -932,9 +934,9 @@ export const LightboxComponent: React.FC<IProps> = ({
932934
)}
933935
</div>
934936
<div>
935-
{currentImage?.title && (
937+
{currentImage && (
936938
<Link to={`/images/${currentImage.id}`} onClick={() => close()}>
937-
{currentImage.title ?? ""}
939+
{title ?? ""}
938940
</Link>
939941
)}
940942
</div>

‎ui/v2.5/src/hooks/Lightbox/types.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ interface IImagePaths {
88

99
interface IFiles {
1010
__typename?: string;
11+
path: string;
1112
width: number;
1213
height: number;
1314
video_codec?: GQL.Maybe<string>;
@@ -19,7 +20,7 @@ export interface ILightboxImage {
1920
rating100?: GQL.Maybe<number>;
2021
o_counter?: GQL.Maybe<number>;
2122
paths: IImagePaths;
22-
visual_files?: GQL.Maybe<IFiles>[];
23+
visual_files?: IFiles[];
2324
}
2425

2526
export interface IChapter {

0 commit comments

Comments
 (0)
Please sign in to comment.