-
-
Notifications
You must be signed in to change notification settings - Fork 966
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
feature: type name icons #1116
Merged
Merged
feature: type name icons #1116
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e885e3f
feat: add new `sprites` field to `type`
gabeklavans 554747a
feat: add type sprites test
gabeklavans 9841870
fix: use items sprites in items test instead of pokemon sprites
gabeklavans 5598df2
chore: update sprites submodule to latest
gabeklavans d8824bf
Merge branch 'master' into feature/type_name_icons
Naramsim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Generated by Django 3.2.23 on 2024-07-29 02:09 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("pokemon_v2", "0015_pokemoncries"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="TypeSprites", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("sprites", models.JSONField()), | ||
( | ||
"type", | ||
models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="typesprites", | ||
to="pokemon_v2.type", | ||
), | ||
), | ||
], | ||
options={ | ||
"abstract": False, | ||
}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi!, I'm not too fond of the hardcoded map here. Can't we fetch it dynamically?
Why do we need this map anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we do as we did for the pokemon?
https://github.com/gabeklavans/pokeapi/blob/feature/type_name_icons/data/v2/build.py#L1447
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may be misunderstanding, but the pokemon sprites looks just as hardcoded as the type sprites I've added. The structure of the
sprites
object is written out. I just used a map so that I wouldn't have to actually write the full structure and can make the code more compact with some for loops. The only thing I see about the pokemon sprites that could be considered more "dynamic" is thetry_image_names
function, but that just seems to be accounting for inconsistencies in the pokemon sprite file names/extensions, which isn't a problem with the type sprite files since there are much fewer of them and should be easier to keep the same format, IMO.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oopsie, you're absolutely right! Maybe we could formalize that object into a single structure that can be used for pokemon, forms, items and types. But that's for the future. I only now realize that the map is basically representing this folder: https://github.com/PokeAPI/sprites/tree/master/sprites/types
Ok, sorry and thanks for pointing it out :)