wiki-tui icon indicating copy to clipboard operation
wiki-tui copied to clipboard

Changing the UI structure

Open Builditluc opened this issue 2 years ago • 4 comments

Part of the Conversion from Cursive to Ratatui

This issue tracks the change of the UI structure. Any idea / issue or discussion is highly appreciated!

Requirements for the UI

  • Open Articles (by either ID or Page Title)
  • Search for a query (with pagination)
  • Everything has to work even when changing the language

Builditluc avatar Aug 12 '23 11:08 Builditluc

Decouple the backend from cursive (and make it cleaner)

The first thing would be to decouple the wiki module fully from the cursive library. I've been seeing the following things that would need adjustment:

  • [ ] #219 The parser currently relies on the cursive::theme::Effect and cursive::theme::Style objects to set the effect and styles of the parsed Elements. We would need to rethink about how the Elements of the parser are structured. I'll create a new issue for rewriting the parser

  • [ ] #218 The Element struct given to the article by the parser currently relies on the cursive::theme::Style object to describe its style. It would be removed and replaced by the rewrite of the parser, so that wouldn't be an issue.

    When looking through the file, there are several unused things in the Article that we could remove to reduce complexity. I'll create another issue addressing the simplification of the Article struct

  • [x] #217 Here we currently use two different methods to fetch data from the Search struct. For some properties we fetch them directly and for other properties we use getter methods. In a separate issue, I would rewrite the struct to only use one method.

    This will be addressed in a separate issue, however, I want to reduce the amount of cloning the Search struct over and over again. One example would be for continuing the search. Currently, we clone the struct but we only need some values for continuing the search, so a separate SearchContinue (the name should be chosen better of course) struct only including the values needed would be better.

Builditluc avatar Aug 14 '23 12:08 Builditluc

Check ratatui for requirements

We need to check if ratatui satisfies all of our needs. I'm collecting all of them below (additions are greatly appreciated!):

  • [ ] Work asynchronously (UI in the main and Wiki in a secondary thread)
  • [ ] Create and manage multiple layers
  • [ ] Popups
  • [ ] Custom Events
  • [ ] Custom borders (Round, Line, or no borders)
  • [ ] Custom theme (general colors, but also more specific changes)
  • [ ] Custom Views

Builditluc avatar Aug 14 '23 12:08 Builditluc

or no borders

If the UI is changed, I'd love a way to disable everything other than the main page view, including the border. I've already disabled the table of contents in my config. On a tiling window manager, there is often not enough space for multiple panes at once, and on smaller terminals, even three extra columns would be a nice addition, plus the window would better blend in with their setup.

Example where wiki-tui is scaled to 0.25 on a 1600x900 display so only 80 columns are visible _

ethamck avatar Aug 14 '23 18:08 ethamck

Yes of course and I definitely see your point. I'm planning on having different "layouts" that can be switched in the config. If you want I can notify you when I'm implementing it so you can try it out check if it fits your needs!

Builditluc avatar Aug 15 '23 17:08 Builditluc

Closing this since #220 already addresses the new UI

Builditluc avatar Aug 15 '24 10:08 Builditluc