From 64f543de8e600a2679d2be0a92172a890f6bd0ef Mon Sep 17 00:00:00 2001 From: Bilge Date: Sun, 30 Jun 2024 12:56:25 +0100 Subject: [PATCH] Added filter for owned games. Fixed curator build status image. --- assets/css/250.less | 4 ++-- assets/js/Filter.ts | 7 ++++++- template/layout/ranking.twig | 7 +++++++ template/layout/template.twig | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/assets/css/250.less b/assets/css/250.less index c141a30059b..3b427b58eec 100644 --- a/assets/css/250.less +++ b/assets/css/250.less @@ -505,13 +505,13 @@ span.filtered { background: #1b2838; - >legend + * { + >legend + p { margin: 0 auto .8em; } } } .ranking > .filter > form.open { - max-height: 210px; + max-height: 300px; } .ranking label { white-space: nowrap; diff --git a/assets/js/Filter.ts b/assets/js/Filter.ts index 6db2d61856f..a5b5c5acf28 100644 --- a/assets/js/Filter.ts +++ b/assets/js/Filter.ts @@ -44,7 +44,8 @@ new class { private filterApps() { const ranks = document.querySelectorAll('#body .ranking > div[id]'), - checkedChecks = this.checks.filter(check => check.checked); + platformChecks = this.checks.filter(check => this.form.querySelector('fieldset')!.contains(check)), + checkedChecks = platformChecks.filter(check => check.checked); let kept = 0; @@ -53,6 +54,10 @@ new class { ranks.forEach(rank => { let keep = checkedChecks.some(check => !!rank.querySelector('.platforms > .' + check.name)); + if (this.form['owned'].checked) { + keep &&= !rank.querySelector('a.owned'); + } + rank.classList.toggle('filtered', !keep); if (keep) { diff --git a/template/layout/ranking.twig b/template/layout/ranking.twig index d04f43349b2..e25200eecc9 100644 --- a/template/layout/ranking.twig +++ b/template/layout/ranking.twig @@ -102,6 +102,13 @@ {{ include('@components/checkbox.twig', {caption_on: 'Linux', name: 'nix'}) }} {{ include('@components/checkbox.twig', {caption_on: 'Steam Deck', name: 'deck'}) }} +
+ Owned games + Show {{ include( + '@components/checkbox.twig', + {negative: 1, checked: 0, caption_on: 'Hide', name: 'owned'}) + }} +
diff --git a/template/layout/template.twig b/template/layout/template.twig index 331ed290e26..a7a3990e94a 100644 --- a/template/layout/template.twig +++ b/template/layout/template.twig @@ -195,7 +195,7 @@ - Curator sync status