thtauhid / terminal-portfolio

A portfolio site that looks and feels like a terminal. Built with React + Tailwind.
https://my-terminal-portfolio.vercel.app/
MIT License
25 stars 22 forks source link

added history navigation #47

Closed deafwired closed 9 months ago

deafwired commented 9 months ago

i also formatted with prettier

vercel[bot] commented 9 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
terminal-portfolio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 1, 2023 10:10pm
thtauhid commented 9 months ago

Nice work.

It'd be great if you can take care of two more things-

  1. When we run the clear command, if we press the arrow up key we are supposed to see the previous command(s). But nothing is shown.
  2. When we navigate through the history if we come to the last item and press the arrow down key it should clear the prompt area, but it doesn't. It shows the last command.

Let me know if this makes sense, otherwise, I'll create a video.

Thanks for the awesome work.

deafwired commented 9 months ago

from what i can see, when you clear, it sets the history to an empty array, should this not happen?

else if (command === "clear") {
        setHistory([]);
)
thtauhid commented 9 months ago

I think we need to rewrite the code such that- When we run clear it clears the UI. Maybe we can keep two states. One that handles the elements that we'll display. Another state can just preserve the command history. We can use the later to navigate. These are just my thoughts. Might be there is a better approach?

If you want to take up the rewrite task that'd be awesome. If not, it's perfectly fine as you have done the main implementation.

Do let me know your thoughts.

Thanks

deafwired commented 9 months ago

I added the clearing when you press downarrow, but tbh i don't know typescript that well and have been relying on javascript knowlege.

thtauhid commented 9 months ago

@deafwired cool. You are a brilliant guy!

Thanks very much for the contribution.