mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 16:34:02 +01:00
* Add scene detail header * Make common count button and add view count * Add titles to play count and o count buttons * Move rating from edit panel * Include frame rate in header * Remove redundant title/studio * Improve numeric rating presentation * Add star where there is no rating header * Set rating on blur when click to edit * Add star to numeric rating on gallery wall card * Apply click to rate on movie page * Apply click to rate to performer page * Apply click to rate to studio page * Fix rating number presentation on list tables * Add data-value attributes
74 lines
1.9 KiB
TypeScript
74 lines
1.9 KiB
TypeScript
import { faEye } from "@fortawesome/free-solid-svg-icons";
|
|
import React from "react";
|
|
import { Button, ButtonGroup } from "react-bootstrap";
|
|
import { Icon } from "src/components/Shared/Icon";
|
|
import { SweatDrops } from "./SweatDrops";
|
|
import cx from "classnames";
|
|
import { useIntl } from "react-intl";
|
|
|
|
interface ICountButtonProps {
|
|
value: number;
|
|
icon: React.ReactNode;
|
|
onIncrement?: () => void;
|
|
onValueClicked?: () => void;
|
|
title?: string;
|
|
countTitle?: string;
|
|
}
|
|
|
|
export const CountButton: React.FC<ICountButtonProps> = ({
|
|
value,
|
|
icon,
|
|
onIncrement,
|
|
onValueClicked,
|
|
title,
|
|
countTitle,
|
|
}) => {
|
|
return (
|
|
<ButtonGroup
|
|
className={cx("count-button", { "increment-only": !onValueClicked })}
|
|
>
|
|
<Button
|
|
className="minimal count-icon"
|
|
variant="secondary"
|
|
onClick={() => onIncrement?.()}
|
|
title={title}
|
|
>
|
|
{icon}
|
|
</Button>
|
|
<Button
|
|
className="minimal count-value"
|
|
variant="secondary"
|
|
onClick={() => (onValueClicked ?? onIncrement)?.()}
|
|
title={!!onValueClicked ? countTitle : undefined}
|
|
>
|
|
<span>{value}</span>
|
|
</Button>
|
|
</ButtonGroup>
|
|
);
|
|
};
|
|
|
|
type CountButtonPropsNoIcon = Omit<ICountButtonProps, "icon">;
|
|
|
|
export const ViewCountButton: React.FC<CountButtonPropsNoIcon> = (props) => {
|
|
const intl = useIntl();
|
|
return (
|
|
<CountButton
|
|
{...props}
|
|
icon={<Icon icon={faEye} />}
|
|
title={intl.formatMessage({ id: "media_info.play_count" })}
|
|
countTitle={intl.formatMessage({ id: "actions.view_history" })}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export const OCounterButton: React.FC<CountButtonPropsNoIcon> = (props) => {
|
|
const intl = useIntl();
|
|
return (
|
|
<CountButton
|
|
{...props}
|
|
icon={<SweatDrops />}
|
|
title={intl.formatMessage({ id: "o_count" })}
|
|
countTitle={intl.formatMessage({ id: "actions.view_history" })}
|
|
/>
|
|
);
|
|
};
|