fix: Fix In Library filter and add library indicator to depot games

- Changed IsInLibrary() to IsInLibraryAsync() which checks database directly
- The sync version was checking Items collection which may not be populated
- Added 📚 badge overlay on game covers for games in user's library
- Badge appears in top-right corner of cover image
This commit is contained in:
Aaron Powell 2026-01-20 10:02:34 +11:00
parent 8d04aca485
commit cd480ac2e3
2 changed files with 18 additions and 15 deletions

View file

@ -98,7 +98,8 @@ public partial class GamesListViewModel : ViewModelBase
{
if (item.DataItem is SDK.Models.DepotGame depotGame)
{
var inLibrary = libraryService.IsInLibrary(depotGame.Id);
// Use async method that checks database directly
var inLibrary = await libraryService.IsInLibraryAsync(depotGame.Id);
// Get cover path - use MediaClient which works with SDK models
string? coverPath = await GetOrDownloadCoverAsync(depotGame.Cover, mediaClient);

View file

@ -145,6 +145,17 @@
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Border>
<!-- In Library badge (📚 on top-right of cover) -->
<Border Background="#CC000000"
CornerRadius="4"
Padding="4,2"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Margin="4"
IsVisible="{Binding InLibrary}">
<TextBlock Text="📚" FontSize="14" />
</Border>
</Panel>
</Border>
@ -157,20 +168,11 @@
TextWrapping="Wrap"
Height="36" />
<!-- Year and In Library indicator -->
<StackPanel Orientation="Horizontal" Spacing="4" Margin="0,4,0,0">
<TextBlock Text="{Binding ReleasedOn, StringFormat='{}{0:yyyy}'}"
FontSize="11"
Opacity="0.6" />
<Border Background="{DynamicResource SystemAccentColor}"
CornerRadius="3"
Padding="4,1"
IsVisible="{Binding InLibrary}"
VerticalAlignment="Center">
<TextBlock Text="✓" FontSize="9" Foreground="White" />
</Border>
</StackPanel>
<!-- Year -->
<TextBlock Text="{Binding ReleasedOn, StringFormat='{}{0:yyyy}'}"
FontSize="11"
Opacity="0.6"
Margin="0,4,0,0" />
</StackPanel>
</Border>
</Button>