diff --git a/ui/v2.5/src/components/Galleries/GalleryCard.tsx b/ui/v2.5/src/components/Galleries/GalleryCard.tsx index 01b21bcc744..1a4b5ff90a5 100644 --- a/ui/v2.5/src/components/Galleries/GalleryCard.tsx +++ b/ui/v2.5/src/components/Galleries/GalleryCard.tsx @@ -27,6 +27,13 @@ export const GalleryPreview: React.FC = ({ gallery, onScrubberClick, }) => { + const [isPortrait, setIsPortrait] = React.useState(false); + + function identifyPortaitImage(e: React.UIEvent) { + const img = e.target as HTMLImageElement; + setIsPortrait(img.width < img.height); + } + const [imgSrc, setImgSrc] = useState( gallery.paths.cover ?? undefined ); @@ -36,9 +43,10 @@ export const GalleryPreview: React.FC = ({ {!!imgSrc && ( {gallery.title )} {gallery.image_count > 0 && ( @@ -60,6 +68,7 @@ interface IProps { selecting?: boolean; selected?: boolean | undefined; zoomIndex?: number; + titleOnImage?: boolean; onSelectedChanged?: (selected: boolean, shiftKey: boolean) => void; } @@ -231,6 +240,7 @@ export const GalleryCard: React.FC = (props) => { selected={props.selected} selecting={props.selecting} onSelectedChanged={props.onSelectedChanged} + titleOnImage={props.titleOnImage} /> ); }; diff --git a/ui/v2.5/src/components/Galleries/GalleryDetails/Gallery.tsx b/ui/v2.5/src/components/Galleries/GalleryDetails/Gallery.tsx index 7dc2a17b6ac..e88ba72e3ff 100644 --- a/ui/v2.5/src/components/Galleries/GalleryDetails/Gallery.tsx +++ b/ui/v2.5/src/components/Galleries/GalleryDetails/Gallery.tsx @@ -43,6 +43,7 @@ import cx from "classnames"; import { useRatingKeybinds } from "src/hooks/keybinds"; import { ConfigurationContext } from "src/hooks/Config"; import { TruncatedText } from "src/components/Shared/TruncatedText"; +import ScreenUtils from "src/utils/screen"; interface IProps { gallery: GQL.GalleryDataFragment; @@ -59,9 +60,11 @@ export const GalleryPage: React.FC = ({ gallery, add }) => { const Toast = useToast(); const intl = useIntl(); const { configuration } = useContext(ConfigurationContext); + const uiConfig = configuration?.ui; + const enableBackgroundImage = uiConfig?.enableGalleryBackgroundImage ?? false; const showLightbox = useGalleryLightbox(gallery.id, gallery.chapters); - const [collapsed, setCollapsed] = useState(false); + const [collapsed, setCollapsed] = useState(ScreenUtils.isSmallScreen()); const [activeTabKey, setActiveTabKey] = useState("gallery-details-panel"); @@ -118,6 +121,30 @@ export const GalleryPage: React.FC = ({ gallery, add }) => { return collapsed ? faChevronRight : faChevronLeft; } + function maybeRenderHeaderBackgroundImage() { + if (enableBackgroundImage && gallery != null && gallery.studio != null) { + let image = gallery.studio.image_path; + if (image) { + const imageURL = new URL(image); + let isDefaultImage = imageURL.searchParams.get("default"); + if (!isDefaultImage) { + return ( +
+ + + {`${gallery.studio.name} + +
+ ); + } + } + } + } + async function onRescan() { if (!gallery || !path) { return; @@ -380,63 +407,74 @@ export const GalleryPage: React.FC = ({ gallery, add }) => { const title = galleryTitle(gallery); return ( -
+ +
+ +
{renderRightTabs()}
diff --git a/ui/v2.5/src/components/Galleries/GalleryDetails/GalleryChaptersPanel.tsx b/ui/v2.5/src/components/Galleries/GalleryDetails/GalleryChaptersPanel.tsx index ea970b7ae88..a8bf60985a4 100644 --- a/ui/v2.5/src/components/Galleries/GalleryDetails/GalleryChaptersPanel.tsx +++ b/ui/v2.5/src/components/Galleries/GalleryDetails/GalleryChaptersPanel.tsx @@ -52,7 +52,7 @@ export const GalleryChapterPanel: React.FC = ({ ); return ( -
+