Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(manage): add has_box_art filter to GameResource #3125

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions app/Filament/Resources/GameResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,25 @@ public static function table(Table $table): Table
false: fn (Builder $query): Builder => $query->where('achievements_published', '<', 6),
blank: fn (Builder $query): Builder => $query,
),

Tables\Filters\TernaryFilter::make('has_box_art')
->label('Has box art')
->placeholder('Any')
->trueLabel('Yes')
->falseLabel('No')
->queries(
true: fn (Builder $query): Builder => $query
->whereNotNull('ImageBoxArt')
->whereNotIn('ConsoleID', System::getNonGameSystems())
->where('ImageBoxArt', '!=', '/Images/000002.png'),
false: fn (Builder $query): Builder => $query
->whereNotIn('ConsoleID', System::getNonGameSystems())
->where(fn (Builder $query): Builder => $query
->whereNull('ImageBoxArt')
->orWhere('ImageBoxArt', '/Images/000002.png')
),
blank: fn (Builder $query): Builder => $query,
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be restricted to just box art? I have a local script that I run that returns a handful of random games that are missing any media (box art, icon, title/in-game image). I try to add media (particularly icons) to at least 3 or 4 games a week. A game is more likely to attract a developer from media than its title.

I can definitely see the use case of finding games with published sets that are missing box art, but isn't it equally important to see if they're missing other media too?

Outside of that particular use case, I think the other thing that would make this feature useful is the ability to filter on active systems. Because of the way IDs were recycled, selecting "no box art" with the default filters provides 20ish Wii games, then a couple Dreamcast games, then 20 ZX spectrum games before getting into systems that are easily accessible for players.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should all be covered in latest. Here's where I've landed:

Screenshot 2025-01-25 at 3 43 04 PM

There's a new system filter option for only active systems. Additionally, new filters have been added for each media kind. These things can all be mixed and matched.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That many menu options is undesirable for something that won't be used very frequently, or in all the available combinations. Can we come up with good descriptors for a single option that would have multiple levels of filter?

Missing Media
* Don't Care          <- This needs a better name
* None
* All                 <- Is this desirable, or is "Any" good enough?
* Any
* Badge
* Box Art             <- Is this really desirable by itself?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's where I've landed in latest: a single multi-select filter with all the media options we currently support. The user can pick 0 to N choices.

Screenshot 2025-01-26 at 10 34 51 AM

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default option "All" implies having the other four selected. It should be "None", but in reality it's still the "Don't Care" option, so how do I find stuff that isn't missing any media?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's where I've landed in latest. It's now back to a single-select modeled after the options you've provided in your feedback:

Screenshot 2025-01-29 at 7 32 14 PM

Screenshot 2025-01-29 at 7 32 18 PM

])
->actions([
Tables\Actions\ActionGroup::make([
Expand Down