mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Added various tooltips (#4264)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { Button, ButtonGroup } from "react-bootstrap";
|
import { Button, ButtonGroup, OverlayTrigger, Tooltip } from "react-bootstrap";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import * as GQL from "src/core/generated-graphql";
|
import * as GQL from "src/core/generated-graphql";
|
||||||
@@ -112,11 +112,16 @@ export const GalleryCard: React.FC<IProps> = (props) => {
|
|||||||
function maybeRenderOrganized() {
|
function maybeRenderOrganized() {
|
||||||
if (props.gallery.organized) {
|
if (props.gallery.organized) {
|
||||||
return (
|
return (
|
||||||
|
<OverlayTrigger
|
||||||
|
overlay={<Tooltip id="organised-tooltip">{"Organized"}</Tooltip>}
|
||||||
|
placement="bottom"
|
||||||
|
>
|
||||||
<div className="organized">
|
<div className="organized">
|
||||||
<Button className="minimal">
|
<Button className="minimal">
|
||||||
<Icon icon={faBox} />
|
<Icon icon={faBox} />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
</OverlayTrigger>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,6 +237,7 @@ export const PerformerCard: React.FC<IPerformerCardProps> = ({
|
|||||||
<CountryFlag
|
<CountryFlag
|
||||||
className="performer-card__country-flag"
|
className="performer-card__country-flag"
|
||||||
country={performer.country}
|
country={performer.country}
|
||||||
|
includeOverlay
|
||||||
/>
|
/>
|
||||||
<span className="performer-card__country-string">
|
<span className="performer-card__country-string">
|
||||||
{performer.country}
|
{performer.country}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { useEffect, useMemo, useRef } from "react";
|
import React, { useEffect, useMemo, useRef } from "react";
|
||||||
import { Button, ButtonGroup } from "react-bootstrap";
|
import { Button, ButtonGroup, OverlayTrigger, Tooltip } from "react-bootstrap";
|
||||||
import { Link, useHistory } from "react-router-dom";
|
import { Link, useHistory } from "react-router-dom";
|
||||||
import cx from "classnames";
|
import cx from "classnames";
|
||||||
import * as GQL from "src/core/generated-graphql";
|
import * as GQL from "src/core/generated-graphql";
|
||||||
@@ -317,11 +317,16 @@ export const SceneCard: React.FC<ISceneCardProps> = (
|
|||||||
function maybeRenderOrganized() {
|
function maybeRenderOrganized() {
|
||||||
if (props.scene.organized) {
|
if (props.scene.organized) {
|
||||||
return (
|
return (
|
||||||
|
<OverlayTrigger
|
||||||
|
overlay={<Tooltip id="organised-tooltip">{"Organized"}</Tooltip>}
|
||||||
|
placement="bottom"
|
||||||
|
>
|
||||||
<div className="organized">
|
<div className="organized">
|
||||||
<Button className="minimal">
|
<Button className="minimal">
|
||||||
<Icon icon={faBox} />
|
<Icon icon={faBox} />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
</OverlayTrigger>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,20 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { useIntl } from "react-intl";
|
import { useIntl } from "react-intl";
|
||||||
import { getCountryByISO } from "src/utils/country";
|
import { getCountryByISO } from "src/utils/country";
|
||||||
|
import { OverlayTrigger, Tooltip } from "react-bootstrap";
|
||||||
|
|
||||||
interface ICountryFlag {
|
interface ICountryFlag {
|
||||||
country?: string | null;
|
country?: string | null;
|
||||||
className?: string;
|
className?: string;
|
||||||
includeName?: boolean;
|
includeName?: boolean;
|
||||||
|
includeOverlay?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const CountryFlag: React.FC<ICountryFlag> = ({
|
export const CountryFlag: React.FC<ICountryFlag> = ({
|
||||||
className,
|
className,
|
||||||
country: isoCountry,
|
country: isoCountry,
|
||||||
includeName,
|
includeName,
|
||||||
|
includeOverlay,
|
||||||
}) => {
|
}) => {
|
||||||
const { locale } = useIntl();
|
const { locale } = useIntl();
|
||||||
|
|
||||||
@@ -22,10 +25,19 @@ export const CountryFlag: React.FC<ICountryFlag> = ({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{includeName ? country : ""}
|
{includeName ? country : ""}
|
||||||
|
{includeOverlay ? (
|
||||||
|
<OverlayTrigger
|
||||||
|
overlay={<Tooltip id="{country}-tooltip">{country}</Tooltip>}
|
||||||
|
>
|
||||||
<span
|
<span
|
||||||
className={`${className ?? ""} fi fi-${isoCountry.toLowerCase()}`}
|
className={`${className ?? ""} fi fi-${isoCountry.toLowerCase()}`}
|
||||||
title={country}
|
|
||||||
/>
|
/>
|
||||||
|
</OverlayTrigger>
|
||||||
|
) : (
|
||||||
|
<span
|
||||||
|
className={`${className ?? ""} fi fi-${isoCountry.toLowerCase()}`}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,9 +4,10 @@ import {
|
|||||||
faImages,
|
faImages,
|
||||||
faPlayCircle,
|
faPlayCircle,
|
||||||
faUser,
|
faUser,
|
||||||
|
faMapMarkerAlt,
|
||||||
} from "@fortawesome/free-solid-svg-icons";
|
} from "@fortawesome/free-solid-svg-icons";
|
||||||
import React, { useMemo } from "react";
|
import React, { useMemo } from "react";
|
||||||
import { Button } from "react-bootstrap";
|
import { Button, OverlayTrigger, Tooltip } from "react-bootstrap";
|
||||||
import { FormattedNumber, useIntl } from "react-intl";
|
import { FormattedNumber, useIntl } from "react-intl";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { IUIConfig } from "src/core/config";
|
import { IUIConfig } from "src/core/config";
|
||||||
@@ -14,7 +15,13 @@ import { ConfigurationContext } from "src/hooks/Config";
|
|||||||
import TextUtils from "src/utils/text";
|
import TextUtils from "src/utils/text";
|
||||||
import { Icon } from "./Icon";
|
import { Icon } from "./Icon";
|
||||||
|
|
||||||
type PopoverLinkType = "scene" | "image" | "gallery" | "movie" | "performer";
|
type PopoverLinkType =
|
||||||
|
| "scene"
|
||||||
|
| "image"
|
||||||
|
| "gallery"
|
||||||
|
| "marker"
|
||||||
|
| "movie"
|
||||||
|
| "performer";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
className?: string;
|
className?: string;
|
||||||
@@ -43,6 +50,8 @@ export const PopoverCountButton: React.FC<IProps> = ({
|
|||||||
return faImage;
|
return faImage;
|
||||||
case "gallery":
|
case "gallery":
|
||||||
return faImages;
|
return faImages;
|
||||||
|
case "marker":
|
||||||
|
return faMapMarkerAlt;
|
||||||
case "movie":
|
case "movie":
|
||||||
return faFilm;
|
return faFilm;
|
||||||
case "performer":
|
case "performer":
|
||||||
@@ -67,6 +76,11 @@ export const PopoverCountButton: React.FC<IProps> = ({
|
|||||||
one: "gallery",
|
one: "gallery",
|
||||||
other: "galleries",
|
other: "galleries",
|
||||||
};
|
};
|
||||||
|
case "marker":
|
||||||
|
return {
|
||||||
|
one: "marker",
|
||||||
|
other: "markers",
|
||||||
|
};
|
||||||
case "movie":
|
case "movie":
|
||||||
return {
|
return {
|
||||||
one: "movie",
|
one: "movie",
|
||||||
@@ -105,11 +119,18 @@ export const PopoverCountButton: React.FC<IProps> = ({
|
|||||||
}, [count, abbreviateCounter]);
|
}, [count, abbreviateCounter]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link className={className} to={url} title={getTitle()}>
|
<>
|
||||||
|
<OverlayTrigger
|
||||||
|
overlay={<Tooltip id={`${type}-count-tooltip`}>{getTitle()}</Tooltip>}
|
||||||
|
placement="bottom"
|
||||||
|
>
|
||||||
|
<Link className={className} to={url}>
|
||||||
<Button className="minimal">
|
<Button className="minimal">
|
||||||
<Icon icon={getIcon()} />
|
<Icon icon={getIcon()} />
|
||||||
<span>{countEl}</span>
|
<span>{countEl}</span>
|
||||||
</Button>
|
</Button>
|
||||||
</Link>
|
</Link>
|
||||||
|
</OverlayTrigger>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
import { Button, ButtonGroup } from "react-bootstrap";
|
import { ButtonGroup } from "react-bootstrap";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import * as GQL from "src/core/generated-graphql";
|
import * as GQL from "src/core/generated-graphql";
|
||||||
import NavUtils from "src/utils/navigation";
|
import NavUtils from "src/utils/navigation";
|
||||||
import { FormattedMessage } from "react-intl";
|
import { FormattedMessage } from "react-intl";
|
||||||
import { Icon } from "../Shared/Icon";
|
|
||||||
import { TruncatedText } from "../Shared/TruncatedText";
|
import { TruncatedText } from "../Shared/TruncatedText";
|
||||||
import { GridCard } from "../Shared/GridCard";
|
import { GridCard } from "../Shared/GridCard";
|
||||||
import { PopoverCountButton } from "../Shared/PopoverCountButton";
|
import { PopoverCountButton } from "../Shared/PopoverCountButton";
|
||||||
import { faMapMarkerAlt, faUser } from "@fortawesome/free-solid-svg-icons";
|
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
tag: GQL.TagDataFragment;
|
tag: GQL.TagDataFragment;
|
||||||
@@ -114,12 +112,12 @@ export const TagCard: React.FC<IProps> = ({
|
|||||||
if (!tag.scene_marker_count) return;
|
if (!tag.scene_marker_count) return;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link className="marker-count" to={NavUtils.makeTagSceneMarkersUrl(tag)}>
|
<PopoverCountButton
|
||||||
<Button className="minimal">
|
className="marker-count"
|
||||||
<Icon icon={faMapMarkerAlt} />
|
type="marker"
|
||||||
<span>{tag.scene_marker_count}</span>
|
count={tag.scene_marker_count}
|
||||||
</Button>
|
url={NavUtils.makeTagSceneMarkersUrl(tag)}
|
||||||
</Link>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,12 +151,12 @@ export const TagCard: React.FC<IProps> = ({
|
|||||||
if (!tag.performer_count) return;
|
if (!tag.performer_count) return;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link className="performer-count" to={NavUtils.makeTagPerformersUrl(tag)}>
|
<PopoverCountButton
|
||||||
<Button className="minimal">
|
className="performer-count"
|
||||||
<Icon icon={faUser} />
|
type="performer"
|
||||||
<span>{tag.performer_count}</span>
|
count={tag.performer_count}
|
||||||
</Button>
|
url={NavUtils.makeTagPerformersUrl(tag)}
|
||||||
</Link>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user