Gituser143 / cryptgo

A terminal application to watch crypto prices!
Apache License 2.0
154 stars 17 forks source link

Add Search Option #3

Closed Gituser143 closed 3 years ago

Gituser143 commented 3 years ago

Description

Add functionality to be able to search for coins, either by name or symbol.

Proposed Solution

Add preferably a search window or shortcut to search for coins. Search can be done either naively, or through a regex maybe? (Unsure of how to search).

prithvianilk commented 3 years ago

Hello,

Do you want to search in real-time? Meaning, as the user types some text, the list will update with corresponding symbols. The user can then choose the ticker they want by moving up / down, and then they will be redirected to the coin's own view.

Or, Do you want a search bar, where users can type an input string and post validation (if it is a valid ticker) they will be redirected to the coin's own view?

Gituser143 commented 3 years ago

Hi @prithvianilk! I'm not particular about either of the two methods, they both seem great! I'd prefer whichever can be easily implemented from the two (I feel updating real time might be harder said than done).

On the other hand, maybe just displaying a scrollable list of results from a given search query might be the best of both worlds.

What do you think would be better?

prithvianilk commented 3 years ago

Yup, I agree that the scrollable list of results idea is easier to implement than the real-time update and gives an option to scroll through the list ( so "ET", would yield a list of "ETH" and "ETC"), but it has one problem. Since Crypto tickers/symbols are usually only ~4 characters, the list itself would be pretty small. If someone searches for a ticker and searches correctly, it does not make sense to show a list of one element, similarly, if they misspell, they might get an empty list.

So a simple search and validation + redirect ( or error message due to invalid ticker ) would be better than a list.

Let me know what you think about it! I probably will pick up this task :)

Gituser143 commented 3 years ago

That's a fair point, but the search should match both the symbol and the name of the coin too. So if someone searches for "car", ADA should pop up in the list, because it's name is "Cardano". Additionally, I don't think it's a good idea to directly jump into the coin page for a matching coin post search (I'm biased towards showing a results list, even if it's a short one).

Edit: Error message when the list is empty does sound like a good idea to me though!

prithvianilk commented 3 years ago

The name + ticker search sounds good. I am thinking of popping up a search table, similar to help, on pressing <C-s>. Is this fine?

Gituser143 commented 3 years ago

The name + ticker search sounds good. I am thinking of popping up a search table, similar to help, on pressing <C-s>. Is this fine?

Sounds perfect! Feel free to open a draft PR if you'd want to!