feat(library): add platform badges, remove hide duplicates

Gitea #34 slice 2 of 3. Core lists each set once now.
The hide duplicates toggle and its param are not needed.
PlatformIcons shows a badge per platform (platforms[]).
This commit is contained in:
lobo committed 2026-10-09 11:31:11 +02:00
1 parent 25cc5ff2d8
commit 16651a1f56
13 files changed
+120 -48

No files matched your search

+13 -6
View File
@@ -217,15 +217,22 @@ describe('GameLibrary short games', () => {
expect(screen.getAllByText(/^x\d/)).toHaveLength(1);
});
it('hideDuplicatesFilter_AddsHideDuplicatesToTheUrlAndTheRequest', async () => {
const lib = renderLibrary();
it('hasNoHideDuplicatesToggle_AndTheRequestNeverCarriesTheParam', async () => {
renderLibrary('/library?hideDuplicates=true');
await waitFor(() => expect(fetch).toHaveBeenCalled());
fireEvent.click(screen.getByRole('button', {name: 'LIBRARY.FILTER_HIDE_DUPLICATES'}));
expect(screen.queryByRole('button', {name: 'LIBRARY.FILTER_HIDE_DUPLICATES'})).toBeNull();
expect(fetch.mock.calls.every(([url]) => !String(url).includes('hideDuplicates'))).toBe(true);
});
await waitFor(() => expect(lib.params().get('hideDuplicates')).toBe('true'));
await waitFor(() => expect(fetch.mock.calls.at(-1)[0]).toMatch(/[?&]hideDuplicates=true(&|$)/));
expect(screen.getByRole('button', {name: 'LIBRARY.FILTER_HIDE_DUPLICATES'}).getAttribute('aria-pressed')).toBe('true');
it('showsThePlatformsOfAnEntryInsteadOfTheSinglePlatformBadge', async () => {
answer([{appid: 220, name: 'Half-Life 2', playtimeMinutes: 0, status: 'BACKLOG', source: 'STEAM', platform: null,
platforms: [{source: 'STEAM', platform: null}, {source: 'PSN', platform: 'PS5'}]}], true);
renderLibrary();
expect(await screen.findByLabelText('PS5')).toBeTruthy();
expect(screen.getByLabelText('Steam')).toBeTruthy();
expect(screen.queryByText('Steam')).toBeNull();
});
it('leaves the hidden games with a status click', async () => {