Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v1 #46

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft

Release v1 #46

wants to merge 17 commits into from

Conversation

LeoRiether
Copy link
Owner

// TODO: write changelog

There are several improvements that could be made to the current UI code. This commit:

- Separates "application state" (`struct State`) from "application main loop manager" (`struct App`)
- Reorganizes state and UI into a more Elm-like architecture
- Extracts widget event listeners, like "clickables" and "draggables", into something reusable
- Makes the code more testable
- Use tokio for async

For now the code is unfinished, the "State rewrite" commits will deal with that
* BrowseScreen: Reorganize refresh methods
* [wip] start implementing `update`
* Separate Actions from CrosstermEvents
* Add <left> <down> <up> <right> to default_config
Previously, you had to specify exactly two colors, now any number of
colors is accepted.
* Implement scroll up/down
* Extract screen-specific actions into their own update()
* A lot more stuff
Now modals receive a lambda that returns an Action. This makes modals
infinitely more reusable than the previous ones. To illustrate, this is
now possible:

```rust
let add_modal = Box::new(
    InputModal::new()
        .style(Style::default().fg(Color::BrightRed))
        .on_commit(|input| Action::AddSong(input))
);

let rename_modal = Box::new(
    InputModal::new()
        .style(Style::default().fg(Color::Blue))
        .on_commit(|input| Action::RenameSongTo(input))
);
```

No special case handling for each type of modal!

Also, modals now send Action::CloseModal when appropriate, which closes
any open modal. Previously each modal had its own match case to close
itself...
Implemented SwapSongUp, SwapSongDown, OpenHelpModal, OpenHotkeyModal and
PlayFromModal commands. The only remaining command is now OpenInEditor!
@LeoRiether LeoRiether self-assigned this Feb 11, 2024
@LeoRiether LeoRiether marked this pull request as draft February 11, 2024 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

1 participant