This is exactly the same as the DisplayName enum in Damus iOS. Due to
the various inconsistencies in `name` and `display_name` between
clients, we have to generalize DisplayName into two variants: one name
or two names.
If we have two names, we treat it in the standard way of display_name is
the real name, and `name` is the username.
If only one is set, then it is considered both the username and "real name".
Signed-off-by: William Casarin <jb55@jb55.com>
In this commit we refactor the preview mechanism, and switch to
responsive views by default.
To create a preview, your view now has to implement the Preview trait.
This is very similar to SwiftUI's preview mechanism.
Signed-off-by: William Casarin <jb55@jb55.com>
Adds ability to run UI components isolated from main app.
`cargo run --bin ui_test_harness -- AccountLoginView`
Signed-off-by: kernelkind <kernelkind@gmail.com>
egui widgets are nice because there are many helper methods on the
egui::Ui struct for adding widgets to the screen in various ways. For
example, add_sized which designates an area to paint a widget. This is
useful in the note_contents case, as it allows us to reserve
available_space-20.0 pixels of the available area, saving 20.0 pixels
for a side-actionbar popout.
I'm not sure I'll use the side actionbar yet, but I've been
experimenting with that as an option to save vertical space in the
timeline.
I still need to make the side actionbar into a widget as well. It
currently uses the CollapsingHeader widget, which is designed for
expanding elements vertically. We may need to make our own widget for
animating an horizontal expansion if we want to achieve a similar effect
for the side actionbar.
Some things we definitely don't want to generate every frame, such as
relative-time formatted strings, as that would create a heap allocation
each frame.
Introduce TimeCached<T> which is responsible for updating some state
after some expiry.
Signed-off-by: William Casarin <jb55@jb55.com>
This is a simple and fast function for abbreviating usernames in the
timeline. If they are too large they make the timeline too wide. We'll
probably need to make this adjustable based on the timeline width, but
this is ok for now.
Changelog-Added: Abbreviate usernames in timelines