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

RFCT: Start breaking up the UI into components #96

Merged
merged 3 commits into from
Dec 29, 2024

Conversation

max-ishere
Copy link
Contributor

This PR is part of my implementation of #85. I've noticed that it is not easy to "just do X", pretty much everything is tangled up into about 3 functions (a single fn update that does everything in the app, the clock, the power buttons, the login, everything; a view generated by Relm; and the init function that sets absolutely every component up) that are "broken up" into separate steps (functions), but when you try to pull out one step into a separate component something else needs to be pulled out as well.

So I decided it would be easiest to move as much of the UI components out of the Greeter component before tackling the mess of a grid in the login ui.

Anyways, here are the changes:

  • Separate the clock from the Greeter component
  • Replace chrono with jiff
  • Add TOML config options for the clock widget
  • Minor misc. improvements

The key benefit is the customizability of the clock and use of jiff crate, which, unlike chrono, doesn't require timezones to be initialized before threading.

@rharish101
Copy link
Owner

Rebased it on the latest main. Do you plan on adding more to this PR, or should I merge it? IMO it seems complete as a PR for the clock widget.

@max-ishere
Copy link
Contributor Author

It is complete, but I haven't tested the rebased version.

@max-ishere
Copy link
Contributor Author

Sorry for the delay, life happened and I forgot to come back to this.

So, looking at the diff before and after, it seems that the only change is the #54 merging. I will try out this rebased version, but I doubt it will be broken.

@max-ishere
Copy link
Contributor Author

LGTM for the rebase.

As for the CI failure, well, this seems to be a Rust version specific issue? The suggestion from clippy not only doesnt exist on my machine, it fails to complile if applied.

@max-ishere
Copy link
Contributor Author

I also rebased this onto master so this should be ready to merge now... The CI is bugging me though, because it will probably keep failing all the later checks.

@rharish101 rharish101 force-pushed the pr/modularize_the_ui branch 2 times, most recently from 29b9e28 to 6223c2a Compare December 29, 2024 09:56
@rharish101
Copy link
Owner

I got it to compile with the CI-suggested fix with Rust 1.75. Could you try it out and see if it compiles for you now?

max-ishere and others added 3 commits December 29, 2024 11:06
- Separate the clock from the Greeter component
- Replace chrono with jiff
- Add TOML config options for the clock widget
- Update the README with config options
- Minor misc. improvements
@max-ishere
Copy link
Contributor Author

I forgot to do a <'_> 🤦

@max-ishere
Copy link
Contributor Author

Yup, it compiles

@rharish101 rharish101 merged commit 1e6d3bd into rharish101:main Dec 29, 2024
1 check passed
@max-ishere max-ishere deleted the pr/modularize_the_ui branch January 1, 2025 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants