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.
display tag description and tag image on hover
closes stashapp#2575
- Loading branch information
1 parent
334d851
commit bf2a083
Showing
11 changed files
with
116 additions
and
2 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
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,57 @@ | ||
import React from "react"; | ||
import { ErrorMessage, LoadingIndicator } from "../Shared"; | ||
import { HoverPopover } from "src/components/Shared"; | ||
import { useFindTag } from "../../core/StashService"; | ||
import { TagCard } from "./TagCard"; | ||
import { ConfigurationContext } from "../../hooks/Config"; | ||
|
||
interface ITagPopoverProps { | ||
id?: string; | ||
} | ||
|
||
export const TagPopoverCard: React.FC<ITagPopoverCardProps> = ({ id }) => { | ||
const { data, loading, error } = useFindTag(id ?? ""); | ||
|
||
if (loading) | ||
return ( | ||
<div className="tag-popover-card-placeholder"> | ||
<LoadingIndicator card={true} message={""} /> | ||
</div> | ||
); | ||
if (error) return <ErrorMessage error={error.message} />; | ||
if (!data?.findTag) | ||
return <ErrorMessage error={`No tag found with id ${id}.`} />; | ||
|
||
const tag = data.findTag; | ||
|
||
return ( | ||
<div className="tag-popover-card"> | ||
<TagCard tag={tag} zoomIndex={0} /> | ||
</div> | ||
); | ||
}; | ||
|
||
export const TagPopover: React.FC<ITagPopoverProps> = ({ id, children }) => { | ||
const { configuration: config } = React.useContext(ConfigurationContext); | ||
|
||
const showTagCardOnHover = config?.interface.showTagCardOnHover ?? true; | ||
|
||
if (!id || !showTagCardOnHover) { | ||
return <>{children}</>; | ||
} | ||
|
||
return ( | ||
<HoverPopover | ||
placement={"top"} | ||
enterDelay={500} | ||
leaveDelay={100} | ||
content={<TagPopoverCard id={id} />} | ||
> | ||
{children} | ||
</HoverPopover> | ||
); | ||
}; | ||
|
||
interface ITagPopoverCardProps { | ||
id?: string; | ||
} |
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