@@ -6,6 +6,7 @@ use xilem::WidgetView;
66use xilem:: palette:: css;
77use xilem:: style:: Padding ;
88use xilem:: style:: Style ;
9+ use xilem:: view:: FlexSequence ;
910use xilem:: view:: flex_row;
1011use xilem:: view:: portal;
1112use xilem:: view:: {
@@ -33,7 +34,31 @@ pub(crate) fn timeline_status(
3334 avatars : & mut Avatars ,
3435 status : & Status ,
3536) -> impl WidgetView < Placehero > + use < > {
36- sized_box ( flex ( (
37+ let ( info_line, primary_status) = if let Some ( reblog) = status. reblog . as_ref ( ) {
38+ (
39+ Some ( prose ( format ! ( "🔄 {} boosted" , status. account. display_name) ) ) ,
40+ & * * reblog,
41+ )
42+ } else {
43+ ( None , status)
44+ } ;
45+ sized_box ( flex ( ( info_line, base_status ( avatars, primary_status) ) ) )
46+ . border ( css:: WHITE , 2.0 )
47+ . padding ( 10.0 )
48+ . corner_radius ( 5. )
49+ }
50+
51+ /// Renders the key parts of a Status, in a shared way.
52+ ///
53+ /// This is the shared funcitionality between a timeline and the list of views.
54+ // TODO: Determine our UX for boosting/reblogging.
55+ // In particular, do we want to have the same design as "normal" Mastodon, where the
56+ // avatar for the booster is shown in the "child" avatar.
57+ fn base_status ( avatars : & mut Avatars , status : & Status ) -> impl FlexSequence < Placehero > + use < > {
58+ // TODO: In theory, it's possible to reblog a reblog; it's not clear what happens in this case.
59+ debug_assert ! ( status. reblog. is_none( ) , "`base_status` can't show reblogs." ) ;
60+ // We return a child list.
61+ (
3762 // Account info/message time
3863 flex_row ( (
3964 avatars. avatar ( & status. account . avatar_static ) ,
@@ -63,10 +88,7 @@ pub(crate) fn timeline_status(
6388 ) )
6489 // TODO: The "extra space" amount actually ends up being zero, so this doesn't do anything.
6590 . main_axis_alignment ( MainAxisAlignment :: SpaceEvenly ) ,
66- ) ) )
67- . border ( css:: WHITE , 2.0 )
68- . padding ( 10.0 )
69- . corner_radius ( 5. )
91+ )
7092}
7193
7294/// A [`timeline`]; statuses are rendered individually.
0 commit comments