diff --git a/src/JellyBox/Glyphs.cs b/src/JellyBox/Glyphs.cs index 45fe067..0f946f3 100644 --- a/src/JellyBox/Glyphs.cs +++ b/src/JellyBox/Glyphs.cs @@ -34,4 +34,7 @@ internal static class Glyphs // Favorites public const string HeartOutline = "\uEB51"; public const string HeartFilled = "\uEB52"; + + // Indicators + public const string Checkmark = "\uE73E"; } diff --git a/src/JellyBox/Models/Card.cs b/src/JellyBox/Models/Card.cs index 71c596a..ad3d42c 100644 --- a/src/JellyBox/Models/Card.cs +++ b/src/JellyBox/Models/Card.cs @@ -1,3 +1,4 @@ +using System.Globalization; using System.Windows.Input; using JellyBox.Services; @@ -22,4 +23,22 @@ internal sealed record Card : INavigable public required JellyfinImage Image { get; init; } public required ICommand NavigateCommand { get; init; } + + public bool IsFavorite { get; init; } + + public bool IsPlayed { get; init; } + + public double PlayedPercentage { get; init; } + + public int UnplayedItemCount { get; init; } + + public bool HasProgress => PlayedPercentage > 0 && !IsPlayed; + + public bool ShowPlayedIndicator => IsPlayed && UnplayedItemCount == 0; + + public bool ShowUnplayedCount => UnplayedItemCount > 0; + + public string UnplayedCountText => UnplayedItemCount >= 100 ? "99+" : UnplayedItemCount.ToString(CultureInfo.InvariantCulture); + + public double ProgressWidth => ImageWidth * PlayedPercentage / 100.0; } diff --git a/src/JellyBox/Models/CardFactory.cs b/src/JellyBox/Models/CardFactory.cs index bba354a..b970b9f 100644 --- a/src/JellyBox/Models/CardFactory.cs +++ b/src/JellyBox/Models/CardFactory.cs @@ -67,6 +67,10 @@ public Card CreateFromItem( ImageHeight = imageHeight, Image = image, NavigateCommand = new RelayCommand(() => _navigationManager.NavigateToItem(item)), + IsFavorite = item.UserData?.IsFavorite ?? false, + IsPlayed = item.UserData?.Played ?? false, + PlayedPercentage = item.UserData?.PlayedPercentage ?? 0, + UnplayedItemCount = item.UserData?.UnplayedItemCount ?? 0, }; } diff --git a/src/JellyBox/Resources/Styles.xaml b/src/JellyBox/Resources/Styles.xaml index b339367..ac596c0 100644 --- a/src/JellyBox/Resources/Styles.xaml +++ b/src/JellyBox/Resources/Styles.xaml @@ -28,6 +28,9 @@ + + + 16 diff --git a/src/JellyBox/Resources/Templates.xaml b/src/JellyBox/Resources/Templates.xaml index 86d9400..6331e70 100644 --- a/src/JellyBox/Resources/Templates.xaml +++ b/src/JellyBox/Resources/Templates.xaml @@ -56,11 +56,83 @@ - + + + + + + + + + + + + + + + + + + + + + + + +