forked from stashapp/stash
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gallery list improvement (stashapp#622)
* Add grid view to galleries * Show scene in gallery card * Add is missing scene gallery filter * Don't store galleries with no images
- Loading branch information
1 parent
fc1c80a
commit bee5dda
Showing
26 changed files
with
296 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,9 @@ fragment GalleryData on Gallery { | |
name | ||
path | ||
} | ||
scene { | ||
id | ||
title | ||
path | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { Card, Button, ButtonGroup } from "react-bootstrap"; | ||
import React from "react"; | ||
import { Link } from "react-router-dom"; | ||
import * as GQL from "src/core/generated-graphql"; | ||
import { FormattedPlural } from "react-intl"; | ||
import { HoverPopover, Icon, TagLink } from "../Shared"; | ||
|
||
interface IProps { | ||
gallery: GQL.GalleryDataFragment; | ||
zoomIndex: number; | ||
} | ||
|
||
export const GalleryCard: React.FC<IProps> = ({ gallery, zoomIndex }) => { | ||
function maybeRenderScenePopoverButton() { | ||
if (!gallery.scene) return; | ||
|
||
const popoverContent = ( | ||
<TagLink key={gallery.scene.id} scene={gallery.scene} /> | ||
); | ||
|
||
return ( | ||
<HoverPopover placement="bottom" content={popoverContent}> | ||
<Link to={`/scenes/${gallery.scene.id}`}> | ||
<Button className="minimal"> | ||
<Icon icon="play-circle" /> | ||
</Button> | ||
</Link> | ||
</HoverPopover> | ||
); | ||
} | ||
|
||
function maybeRenderPopoverButtonGroup() { | ||
if (gallery.scene) { | ||
return ( | ||
<> | ||
<hr /> | ||
<ButtonGroup className="card-popovers"> | ||
{maybeRenderScenePopoverButton()} | ||
</ButtonGroup> | ||
</> | ||
); | ||
} | ||
} | ||
|
||
return ( | ||
<Card className={`gallery-card zoom-${zoomIndex}`}> | ||
<Link to={`/galleries/${gallery.id}`} className="gallery-card-header"> | ||
{gallery.files.length > 0 ? ( | ||
<img | ||
className="gallery-card-image" | ||
alt={gallery.path} | ||
src={`${gallery.files[0].path}?thumb=true`} | ||
/> | ||
) : undefined} | ||
</Link> | ||
<div className="card-section"> | ||
<h5 className="card-section-title">{gallery.path}</h5> | ||
<span> | ||
{gallery.files.length} | ||
<FormattedPlural | ||
value={gallery.files.length ?? 0} | ||
one="image" | ||
other="images" | ||
/> | ||
. | ||
</span> | ||
</div> | ||
{maybeRenderPopoverButtonGroup()} | ||
</Card> | ||
); | ||
}; |
Oops, something went wrong.