hn-cli icon indicating copy to clipboard operation
hn-cli copied to clipboard

Mark visited items

Open rafaelrinaldi opened this issue 9 years ago • 5 comments

Having previously visited stories marked as read would be nice. Maybe a symbol or even through text decoration should do it.

rafaelrinaldi avatar Feb 02 '16 01:02 rafaelrinaldi

Let me ask you something, i can't see any flags or variables which control the visited items, do you think if we can implement a key named visited:boolean which controls the behaviour of each entry?

erickbelfy avatar Feb 03 '16 13:02 erickbelfy

Another idea is on keypress event, we may change text of the selected node. Maybe it should work, but i have a concern if user add the option --keep-alive, when the display update, we may lose all visited entries.

erickbelfy avatar Feb 03 '16 14:02 erickbelfy

@erickbelfy Yeah, we currently have no way to tell what item was previously visited but I was thinking about a flag on the cache object or even an array with the id of visited items. Not sure. Just keep in mind that the data should be immutable and we should try to avoid local state at all costs. Object.assign() can be our friend :+1:

Also, the feature should behave the same either or not the user runs the program with --keep-open.

I also am not sure about the UI. As I said, maybe a bullet or even a text underline should do it. We shouldn't rely on colors though, since I want to support non xterm-256 users as well.

rafaelrinaldi avatar Feb 03 '16 14:02 rafaelrinaldi

@erickbelfy Also, we can even add a feature to persist read items in the future :bulb:

rafaelrinaldi avatar Feb 03 '16 16:02 rafaelrinaldi

Hey @rafaelrinaldi I would like to ask you something, you've mentioned about avoid local state at all costs, and use the cache object to store the visited items, do you think about use a package , like node-cache or you suggest use the cache API

erickbelfy avatar Feb 13 '16 13:02 erickbelfy