mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Show "99+" in unplayed indicator when more 100 or more new items
This commit is contained in:
parent
b1add6f48d
commit
10198f9056
2 changed files with 12 additions and 4 deletions
|
@ -78,7 +78,7 @@ export function getPlayedIndicatorHtml(item) {
|
||||||
if (enablePlayedIndicator(item)) {
|
if (enablePlayedIndicator(item)) {
|
||||||
const userData = item.UserData || {};
|
const userData = item.UserData || {};
|
||||||
if (userData.UnplayedItemCount) {
|
if (userData.UnplayedItemCount) {
|
||||||
return '<div class="countIndicator indicator">' + datetime.toLocaleString(userData.UnplayedItemCount) + '</div>';
|
return '<div class="countIndicator indicator">' + formatCountIndicator(userData.UnplayedItemCount) + '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userData.PlayedPercentage && userData.PlayedPercentage >= 100 || (userData.Played)) {
|
if (userData.PlayedPercentage && userData.PlayedPercentage >= 100 || (userData.Played)) {
|
||||||
|
@ -93,12 +93,16 @@ export function getChildCountIndicatorHtml(item, options) {
|
||||||
const minCount = options?.minCount ? options.minCount : 0;
|
const minCount = options?.minCount ? options.minCount : 0;
|
||||||
|
|
||||||
if (item.ChildCount && item.ChildCount > minCount) {
|
if (item.ChildCount && item.ChildCount > minCount) {
|
||||||
return '<div class="countIndicator indicator">' + datetime.toLocaleString(item.ChildCount) + '</div>';
|
return '<div class="countIndicator indicator">' + formatCountIndicator(item.ChildCount) + '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatCountIndicator(count) {
|
||||||
|
return count >= 100 ? '99+' : count.toString();
|
||||||
|
}
|
||||||
|
|
||||||
export function getTimerIndicator(item) {
|
export function getTimerIndicator(item) {
|
||||||
let status;
|
let status;
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,10 @@ const enablePlayedIndicator = (item: ItemDto) => {
|
||||||
return itemHelper.canMarkPlayed(item);
|
return itemHelper.canMarkPlayed(item);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const formatCountIndicator = (count: number) => {
|
||||||
|
return count >= 100 ? '99+' : count.toString();
|
||||||
|
};
|
||||||
|
|
||||||
const useIndicator = (item: ItemDto) => {
|
const useIndicator = (item: ItemDto) => {
|
||||||
const getMediaSourceIndicator = () => {
|
const getMediaSourceIndicator = () => {
|
||||||
const mediaSourceCount = item.MediaSourceCount ?? 0;
|
const mediaSourceCount = item.MediaSourceCount ?? 0;
|
||||||
|
@ -135,7 +139,7 @@ const useIndicator = (item: ItemDto) => {
|
||||||
if (childCount > 1) {
|
if (childCount > 1) {
|
||||||
return (
|
return (
|
||||||
<Box className='countIndicator indicator childCountIndicator'>
|
<Box className='countIndicator indicator childCountIndicator'>
|
||||||
{datetime.toLocaleString(item.ChildCount)}
|
{formatCountIndicator(childCount)}
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -149,7 +153,7 @@ const useIndicator = (item: ItemDto) => {
|
||||||
if (userData.UnplayedItemCount) {
|
if (userData.UnplayedItemCount) {
|
||||||
return (
|
return (
|
||||||
<Box className='countIndicator indicator unplayedItemCount'>
|
<Box className='countIndicator indicator unplayedItemCount'>
|
||||||
{datetime.toLocaleString(userData.UnplayedItemCount)}
|
{formatCountIndicator(userData.UnplayedItemCount)}
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue