mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Include subsidiary studios/tags in tab badge counters (#3816)
* Add '_all' counts * Use '_all' counts in UI * Make other counts non-nullable * Hide tab counts if zero * Add resolver parameter
This commit is contained in:
@@ -6,16 +6,23 @@ import TextUtils from "src/utils/text";
|
||||
interface IProps {
|
||||
abbreviateCounter?: boolean;
|
||||
count: number;
|
||||
hideZero?: boolean;
|
||||
hideOne?: boolean;
|
||||
}
|
||||
|
||||
export const Counter: React.FC<IProps> = ({
|
||||
abbreviateCounter = false,
|
||||
count,
|
||||
hideZero = false,
|
||||
hideOne = false,
|
||||
}) => {
|
||||
const intl = useIntl();
|
||||
|
||||
if (hideZero && count === 0) return null;
|
||||
if (hideOne && count === 1) return null;
|
||||
|
||||
if (abbreviateCounter) {
|
||||
const formated = TextUtils.abbreviateCounter(count);
|
||||
const formatted = TextUtils.abbreviateCounter(count);
|
||||
return (
|
||||
<Badge
|
||||
className="left-spacing"
|
||||
@@ -24,10 +31,10 @@ export const Counter: React.FC<IProps> = ({
|
||||
data-value={intl.formatNumber(count)}
|
||||
>
|
||||
<FormattedNumber
|
||||
value={formated.size}
|
||||
maximumFractionDigits={formated.digits}
|
||||
value={formatted.size}
|
||||
maximumFractionDigits={formatted.digits}
|
||||
/>
|
||||
{formated.unit}
|
||||
{formatted.unit}
|
||||
</Badge>
|
||||
);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user