Fix image title not appearing in lightbox (#5675)

This commit is contained in:
WithoutPants 2025-02-24 17:55:51 +11:00 committed by GitHub
parent e97f647a43
commit 587fd9e6b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View file

@ -48,6 +48,7 @@ import {
import { RatingSystem } from "src/components/Shared/Rating/RatingSystem";
import { useDebounce } from "../debounce";
import { isVideo } from "src/utils/visualFile";
import { imageTitle } from "src/core/files";
const CLASSNAME = "Lightbox";
const CLASSNAME_HEADER = `${CLASSNAME}-header`;
@ -689,6 +690,7 @@ export const LightboxComponent: React.FC<IProps> = ({
}
const currentImage: ILightboxImage | undefined = images[currentIndex];
const title = currentImage ? imageTitle(currentImage) : undefined;
function setRating(v: number | null) {
if (currentImage?.id) {
@ -932,9 +934,9 @@ export const LightboxComponent: React.FC<IProps> = ({
)}
</div>
<div>
{currentImage?.title && (
{currentImage && (
<Link to={`/images/${currentImage.id}`} onClick={() => close()}>
{currentImage.title ?? ""}
{title ?? ""}
</Link>
)}
</div>

View file

@ -8,6 +8,7 @@ interface IImagePaths {
interface IFiles {
__typename?: string;
path: string;
width: number;
height: number;
video_codec?: GQL.Maybe<string>;
@ -19,7 +20,7 @@ export interface ILightboxImage {
rating100?: GQL.Maybe<number>;
o_counter?: GQL.Maybe<number>;
paths: IImagePaths;
visual_files?: GQL.Maybe<IFiles>[];
visual_files?: IFiles[];
}
export interface IChapter {