-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: extract app sub-states for better modularization
In `patch-hub`, the `App` represents the state of the application (the model component), i.e., every action/event done/triggered by the controller (currently completely defined at `src/main.rs`) changes the state of the app, while the view component (`src/ui.rs`) queries it for displaying screens to the user. For organization, the app state is broken down into "sub-states" - types that have a `State` prefix - in a way that we have a state for each screen. However, all sub-states, as well as the top `App` state, are all defined in the file `src/app.rs`. It goes without saying that this is a bad engeneering choice and the big ball of mud keeps growing uncontrollably. In this sense, extract all the sub-states to a dedicated file in the directory `src/app/screens` to better modularize the app state. Adaptations all throughout the project had to be made, so this commit involves a lot of changes. However, most of them are represented by moving files and correcting imports. Helps: #7 [Maintainer edits] - Fix some merge conflicts, which result in additional changes (adding of getters, for example) - Rephrase commit message subject - Add more context to commit message body - Add tag "Helps" - Format with `cargo fmt --all` Signed-off-by: Thiago Duvanel <thiago.duvanel@usp.br> Reviewed-by: David Tadokoro <davidbtadokoro@usp.br> Signed-off-by: David Tadokoro <davidbtadokoro@usp.br>
- Loading branch information
1 parent
c1dd31f
commit 676581e
Showing
11 changed files
with
365 additions
and
346 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
pub mod bookmarked; | ||
pub mod details; | ||
pub mod edit_config; | ||
pub mod latest; | ||
pub mod mail_list; | ||
|
||
#[derive(Debug, Clone, PartialEq)] | ||
pub enum CurrentScreen { | ||
MailingListSelection, | ||
BookmarkedPatchsets, | ||
LatestPatchsets, | ||
PatchsetDetails, | ||
EditConfig, | ||
} |
Oops, something went wrong.