AM1CODES/Poke-Dex

Ability to sort cards

HARDY8118 opened this issue · 7 comments

It could be helpful if a button was provided to sort the cads.
Since the pokemon number (#) can be used to identify a pokemon uniquely, maybe a sort button can be added with a dropdown for sorting cards according to their # (number) or name (alphabetically) and maybe default the sort to the order in which the cards were added.
New contributors can add the pokemon number along with the name and for existing ones maybe I can write a simple script which will fetch the pokemon api and add the required details in the existing cards.

If you are confident that you can work on this, sure go ahead. You can also team up with other collaborators and work on this. Very interesting.

Would it be overkill to use something like a relational DB such as sqlite3? @HARDY8118 @AM1CODES

Would it be overkill to use something like a relational DB such as sqlite3? @HARDY8118 @AM1CODES

I believe the project is as simple as it can be, adding a database will increase complexity since there would be some way required to manage the database probably some kind of backend server.

Is there any way we can add a database without increasing the complexity to contributors @rehman000 ?
Edit: Also can we add a database for everyone without requiring a backend?

Sqlite3 is not really a full featured RDMS. Like PostgreSQL, or MariaDB. It's just a local unencrypted file that stores all the information for all tables. From my understanding it does not require any back-end server.

Source: https://www.sqlite.org/serverless.html

My issue is I used it quite frequently for Python and flask. With SQLAlchemy as the ORM. I'm a bit of a novice when it comes to javascript so ofcourse more research would be needed here. I'm not sure what kind of ORM (if any) would apply here.

We could also store the pokemon info using JSON format. Which honestly sounds less overkill.

What do you think? @HARDY8118

That's true, Sqlite3 isn't a full RDBMS, it uses a file to store its contents.
In Python (as you mentioned) its easy to work with Sqlite but with client side javascript, it comes with its own limitations. Client side javascript isn't allowed to read/write files like in a Python environment. So it will require to use browser APIs which will make it complex also the browser will be showing a popup confirming users to agree to give disk space to the website (which I think is unnecessary).
Other options I have seen like https://sql.js.org/#/ which use wasm which I believe will be like overkill.
Although I would be interested if you have some other way of using Sqlite with client side javascript and will be glad to work on it with you.

Can't we somehow manipulate the divs to rearrange by Name with Javascript instead of adding a DB?

@anirbandey303 you are right I have done the same.