Originally created by: endernoke
Is your feature request related to a problem? Please describe.
In the TypeScript client, we use pastel to organize subcommands and arguments in a file-based manner.
But inside TUI subcommands like chat, we have to use a lot of state variables to conditionally render different pages/views based on the user's state, e.g. chat menu vs messaging interface, normal login vs challenge required, etc. This makes UI rendering logic more complex as the project grows.
Describe the solution you'd like
Implement a navigation router (like react-router) and a next.js like file-based routing mechanism for TUI views.
It should:
router.replace("/chat/menu")router.replace(), router.push(), router.back(), etc.routes/
|-- login/
| |-- index.tsx
| |-- challenge/
| |-- index.tsx
|-- index.tsxrouter.push("/") would render routes/index.tsx; router.push("/login/challenge") would render routes/login/challenge/index.tsx[id] in next.js (optional but preferred)Describe alternatives you've considered
Keep logic for view rendering with custom logic in components, but this introduces two issues:
Additional context
Pastel uses commands as a special directory which contains subcommands so we can adopt a similar approach and dedicate a directory like routes or pages to be handled by the router.
Fellow instagramers please let me know if this proposal would make the development experience better. Feel free to roast its architecture/design/usefulness.
Originally posted by: supreme-gg-gg
+1, this would be super useful for the Ink OSS community when building terminal apps (not just CLI tools), doesn't seem like a good alternative exists really
Originally posted by: endernoke
This seems promising
https://github.com/vadimdemedes/ink/issues/396