Add gallery icon to image card (#2324)

This commit is contained in:
WithoutPants 2022-02-20 11:07:47 +11:00 committed by GitHub
parent 1fab368328
commit 4a6e26dcc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 0 deletions

View File

@ -62,6 +62,27 @@ export const ImageCard: React.FC<IImageCardProps> = (
}
}
function maybeRenderGallery() {
if (props.image.galleries.length <= 0) return;
const popoverContent = props.image.galleries.map((gallery) => (
<TagLink key={gallery.id} gallery={gallery} />
));
return (
<HoverPopover
className="gallery-count"
placement="bottom"
content={popoverContent}
>
<Button className="minimal">
<Icon icon="images" />
<span>{props.image.galleries.length}</span>
</Button>
</HoverPopover>
);
}
function maybeRenderOrganized() {
if (props.image.organized) {
return (
@ -79,6 +100,7 @@ export const ImageCard: React.FC<IImageCardProps> = (
props.image.tags.length > 0 ||
props.image.performers.length > 0 ||
props.image.o_counter ||
props.image.galleries.length > 0 ||
props.image.organized
) {
return (
@ -88,6 +110,7 @@ export const ImageCard: React.FC<IImageCardProps> = (
{maybeRenderTagPopoverButton()}
{maybeRenderPerformerPopoverButton()}
{maybeRenderOCounter()}
{maybeRenderGallery()}
{maybeRenderOrganized()}
</ButtonGroup>
</>